Is there any example code to show how to configure the MSP430FR5739's ADC in order to sample one channel first (e.g. A1) and if a condition is met, read another channel (e.g. A2)? I'm trying to do it by first configuring for one channel as shown below:
// Configure ADC
P1SEL1 |= BIT1;
P1SEL0 |= BIT1;
ADC10CTL0 |= ADC10SHT_2 + ADC10ON; // ADC10ON, S&H=16 ADC clks
ADC10CTL1 |= ADC10SHP; // ADCCLK = MODOSC; sampling timer
ADC10CTL2 |= ADC10RES; // 10-bit conversion results
ADC10MCTL0 |= ADC10INCH_1; // A1 ADC input select; Vref=AVCC
ADC10IE |= ADC10IE0; // Enable ADC conv complete interrupt
And then, I change: ADC10MCTL0 |= ADC10INCH_2; // A2 ADC input select; and enable the ADC to sample again, but ADC10MEM0 always returns the value sampled by A1.