Hi all. I've got a problem with the ADC. I'm running the DCO at 16MHz, and setting the SMClk at this same frequency.
The signal I want to sample has a frequency of 33kHz, and the setting for the ADC10 are
void ConfigADC10(void){
ADC10CTL1 = INCH_5 + ADC10SSEL_3; // Channel 5, Elijo SMCLK
ADC10CTL0 = SREF_1 + REFON + REF2_5V + ADC10SHT_0 + ADC10ON + ADC10IE; //2.5V & Vss as reference, 4 clk times
ADC10AE0 |= BIT5; //P1.5 ADC option
}
The part where I am sampling is
case 3:{
TACCR0 += 60;
estado = 0;
flag = 1;
ADC10CTL0 |= ENC + ADC10SC; // Sampling and conversion start
valorPixel = ADC10MEM;
break;
}
The problem is the values I'm sampling are between 0040 and 0180, when I am sampling a signal that goes between 0,4 and 2,8V... , so I expect to get values between 0163 and 1023.
What could the problem be? Thank you in advance for your help.