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.

MSP430F249-EP: ADC initialization for other channels

Part Number: MSP430F249-EP

Hi, i am trying to interface 2 potentiometer in channel 0 and channel 2 of MSP430F249-ep ADC. Here i attached the initialization steps for ADC, by this way only i initialized my channel. I checked my results in proteus, Channel0 of ADC works fine but channel 2 doesn't get initialized. Please point out my mistake.

if switch1 pressed channel 0 should be active

ADC12CTL0 = SHT0_2 + ADC12ON; // Set sampling time, turn on ADC12
ADC12CTL1 |= CSTARTADD_0  + SHP; // Use sampling timer
ADC12MCTL0 |= INCH_0; /* channel 0*/
ADC12CTL0 |= ENC + ADC12SC; // Conversion enabled

value = ADC12MEM0;

if switch 2 is pressed channel 2 should be active

ADC12CTL0 = SHT0_2 + ADC12ON; // Set sampling time, turn on ADC12
ADC12CTL1 |= CSTARTADD_2  + SHP; // Use sampling timer
ADC12MCTL2 |= INCH_2; /* channel 0*/
ADC12CTL0 |= ENC + ADC12SC; // Conversion enabled

value = ADC12MEM2;