Hi!
I have an application where I need to use the ADC of the MSP430FG4617.
The problem is that I'm not having the stabilty that I need. I have a PCB with the uC soldered and I'm testing it with no other components or modules.
As the input signal for the ADC I'm using the A0 channel (P6.0) wich is connected to a 20k potenciometer
Debugging the program and seing the memory register for the ADC, I notice that the value varys in 1, 2, max 5 bits (ocational 10bits jumps) in each iterations.
The funny thing is that I mesure with a tester the voltage of the AO signal and it's stable, barely 0.1mV variations. I tried to filter the signal with a 100nF capacitor and the result was the same.
The program is the following:
void main(void)
{
WDTCTL = WDTPW + WDTHOLD; // Stop watchdog
FLL_CTL0 |= XCAP18PF;
P6SEL |= 0x01; // Enable A/D channel A0
ADC12CTL0 = REFON + REF2_5V + ADC12ON + SHT0_2; // turn on 2.5V ref, set samp time
ADC12CTL1 = SHP; // Use sampling timer
ADC12MCTL0 = SREF_1; // Vr+=Vref+
for (i = 0x3600; i; i--); // Delay for needed ref start-up.
// See datasheet for details.
ADC12CTL0 |= ENC; // Enable conversions
ADC12CTL0 |= ADC12SC; // Start conversions
while (!(ADC12IFG & 0x0001)); // Conversion done?
__no_operation(); // SET BREAKPOINT HERE
while(1);
}
Any tips for this??
Thank you!
Regards,
Pedro.