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.

How to convert 2 Analog signals to digital values, using ADC12 of MSP430F5635

Hi,

I have 2 analog signals , one is the battery voltage(signal 1) and other is a device specific signal (signal 2).

They are fed into P6.4 / A4 and P6.5 / A5  of the microcontroller .

The conversion of both the signals will be initiated by the user at different times.

when the user says "Get me the battery voltage" , the conversion for the signal 1 has to happen .

when the user says "Get me the intensity of signal 2 " , the conversion for the signal 2 has to occur .

But I understand that  ADC12SC starts the conversion for both the signals in one stretch .

Is there a way to control which signal/input channel has to be converted by the ADC ?

Please comment / correct me if i am wrong .

Thanks in advance ,

Jenitta

  • You can program which channel has to be sampled and you can do different sequences and no sequence at all, just a single channel a single time.

    You can store this information inside the MCTL (memory control) registers of the ADC12 and you can select at which MCTL the ADC12 should start  using the ADC12CTL1 register (the STARTADDR bit there).

    So you can say in ADC12MCTL0: sample channel A4, end of conversion, and in ADC12MCTL1: sample channel A5, end of conversion. (in single channel single sample mode the end of conversion shouldn't be needed but I'm not totally sure)

    Then when a button is pressed you write the according startadress to ADC12CTL1 (note that ADC12ENC has to be cleared to do this) and start the conversion. Then you can get the result from ADC12MEM0 or MEM1 respectively.

    Of course you can also just sample both and display only the requested value, but that is a waste of energy (I think setting the right channel is less of a waste). 

  • Hi,

    As complementary information, you can download code examples from here.

    Best Regards,
    AES

**Attention** This is a public forum