Tool/software: Code Composer Studio
Hey Guys,
i have a problem setting up the ADC in the MSP430F1612. I use two channels, P6.3 and P6.4 with the examble code from Ti (see below). So i applied a stable voltage at those Pins, and the first problem is, that the value starts of way to high, and every time i run the code (the examble below is for a single conversion), the value changes randomly between1400-2000 [decimal].
My first guess is that i set up the wrong channel of these pins, so how exactly can i set the Pins P6.3 and P6.4 as ADC Input?
Does anyboy knows the problem from their project?
I use CCS with the FET430 Flash Emulation Tool.
Cheers
Raphael
#include <msp430.h>
int main(void)
{
volatile unsigned int i;
WDTCTL = WDTPW+WDTHOLD; // Stop watchdog timer
P6SEL |= 0x01; // Enable A/D channel A0
ADC12CTL0 = ADC12ON+SHT0_2+REFON+REF2_5V; // Turn on and set up ADC12
ADC12CTL1 = SHP; // Use sampling timer
ADC12MCTL0 = SREF_1; // Vr+=Vref+
for ( i=0; i<0x3600; i++) // Delay for reference start-up
{
}
ADC12CTL0 |= ENC; // Enable conversions
while (1)
{
ADC12CTL0 |= ADC12SC; // Start conversion
while ((ADC12IFG & BIT0)==0);
__no_operation(); // SET BREAKPOINT HERE
}
}