Hey guys. i'd like to ask about my tiny ADC problem which has bothered me about 3 days.
Problem is, Even if i don't give any signals to adc channels, there are values remained. Logically, system can't show any
values since there are no signals. So i checked that i' m using a reference voltage which is internally in a adc module. But
i'm not.
Specifically i use adc like below.
- 10 bit resolution
- Right justified data
- ATD Clock at least 2M to 8M (System clock is 16M)
- single conversion at once.
And below is my register setting for using adc
void initialize_ADC(void)
{
ATD1CTL2 = 0x40; // ADC enable
wait4(1);
wait4(1);
ATD1CTL3 = 0xA0; // ADC conversion start
ATD1CTL4 = 0x00;
ATD1DIEN = (ATD1DIEN || 0xFF00);
}
int get_adc(int ch)
{
ATD1CTL5 = 0x08+ch; // ch means channel i use. in this case channel 8 to 15
while(!(ATD1STAT0 & 0x80));
return ATD1DR0L+(ATD1DR0H<<8); // get_adc function is getting conversed values from each channels
} .
i really no idea of this. Plz help pity developer!