This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CCS/MSP430F1612: MSPF1612/CCS/ADC

Part Number: MSP430F1612

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

}

}

  • Hey Raphael,

    To start, you need to change P6SEL accordingly. You should then change the code so that it takes multiple samples in a single sequence (ADC12MSC, ADC12CONSEQ_1, etc). You then need to modify the ADC12MCTLx registers for each ADC input, and mark the last one with ADC12EOS. There are several examples provided that are similar to your desired application (fet140_adc12_09.c)

    Regards,
    Ryan

**Attention** This is a public forum