Hi, I'm using the MSP430F5529 launchpad, and I'm trying to do one of the ADC12 examples.
I'm externally applying a 0.5V to P6.0, but when I ran the code, I'm continuously getting ADC12MEM0 = 0.
Can you please help? Thanks
---------------------
#include <msp430f5529.h>
unsigned int result;
int main(void)
{
volatile unsigned int i;
WDTCTL = WDTPW+WDTHOLD; // Stop watchdog timer
P6SEL |= 0x01; // Enable A/D channel A0
REFCTL0 &= ~REFMSTR; // Reset REFMSTR to hand over control to
// ADC12_A ref control registers
ADC12CTL0 = ADC12ON+ADC12SHT02+ADC12REFON+ADC12REF2_5V;
// Turn on ADC12, Sampling time
// On Reference Generator and set to
// 2.5V
ADC12CTL1 = ADC12SHP; // Use sampling timer
ADC12MCTL0 = ADC12SREF_1; // Vr+=Vref+ and Vr-=AVss
for ( i=0; i<0x30; i++); // Delay for reference start-up
ADC12CTL0 |= ADC12ENC; // Enable conversions
while (1)
{
ADC12CTL0 |= ADC12SC; // Start conversion
result = ADC12MEM0;
while (!(ADC12IFG & BIT0));
__no_operation(); // SET BREAKPOINT HERE
}
}