Other Parts Discussed in Thread: MSP430F5529
Hi,
I am working on MSP430F5659 to measure the voltage through ADC. I am using the below mentioned code to initialize the ADC and the measurements are fine.
ADC12CTL0 |= ADC12ON; // Turn-on ADC
// Note: Default sample and hold time is 4 ADC clocks
// Note: Default sample and hold source is ADC10SC bit
ADC12CTL1 = ADC12SHP; // Select pulse sampling mode
ADC12CTL1 |= ADC12DIV1 | ADC12DIV0; // Divide i/p clock by 4
ADC12CTL1 |= ADC12SSEL1 | ADC12SSEL0; // Select SMCLK as ADC clock source
// Note: Default ADC conversion sequence is single channel, single conversion
ADC12CTL2 |= ADC12PDIV; // Predivide clock by 4, making the total div. ratio = 16
ADC12CTL2 |= ADC12RES1; // ADC 12bit selection
// Note: Default reference selection is AVCC for VREF+ and AVSS for VREF-
// Note: Default input channel selection is A4
ADC12MCTL0 = ADC12INCH_4;
ADC12IE |= ADC12IE0; // Enable ADC interrupt
ADC12CTL0 |= ADC12ENC; // Enable ADC conversion
### Getting the response back from ADC
adc_isr(void) {
#ifdef __MSP430F5529__
adc_result = ADC12MEM0;
#else
adc_result = ADC12MEM0;
But I need to change the channel to A5 and redo the measurement with which I am facing issue. I am using the below mentioned code to change the channel but its not happening.
ADC12CTL0 |= ~ADC12ENC; // disable ADC conversion
ADC12MCTL0 = ADC12INCH_5;
ADC12CTL0 |= ADC12ENC |ADC12SC; // enable adc convertion and start the process
Kindly let me know how to change the channel and make the measurement.