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/MSP430FR5994: ADC- Two different channels for same input resulting in two different values.

Part Number: MSP430FR5994

Tool/software: Code Composer Studio

Hey Community,

I am little perplexed, while using ADC. I am using two channels to measure an individual input for understanding ADC better. Contrary to my imagination and understanding as I looked up in Debuggermode for values of two channels, am getting two different values for the same input out of ADC Memoryregister. ADC12MEM0 = 2720 and ADC12MEM1 = 2000. The correct measured value is stored in ADC12MEM0 which is 2720. I calculated it manually as well. Can you please explain me what point am I missing or did I understand it falsely. Snippet of my code is attached

I'll appreciate your response.

thanks,

Jahangir

 ADC12CTL0 &= ~ADC12ENC;
 ADC12CTL0 |= ADC12SHT0_4 | ADC12ON;		// Sampling time, S&H=64 Cycles, ADC12 on
 ADC12CTL0 |= ADC12MSC;					// multiple sample and conversion
 ADC12CTL1 |= ADC12CONSEQ_2;				// Repeat-single-channel
 ADC12CTL1 |= ADC12SHP;					// Use sampling timer

ADC12CTL2 |= ADC12RES_2;				// 12-bit conversion results

ADC12MCTL0 |= ADC12INCH_8;  			// A8 ADC input select; Vref=AVCC
ADC12MCTL1 |= ADC12INCH_8;             // A8 ADC input select; Vref=AVCC
	 
ADC12CTL0 |= ADC12ENC | ADC12SC;        // Start sampling/conversion

    

  • Hi jahangir,

    This configuration will only Repeat single channel, you need to set to ADC12CONSEQ_3.

    Best Regards

    Johnson

  • Hi Johnson,

    I appreciate your Response, that was quick and indeed very helpful. Could please also shed light on another Question .

    Can I Change my ADC12CONSEQ bit during run time. I am planning to use multiple channel in which a channel would be activated and deactivated periodically. Let say I want my first channel  ADC12MCTL0 to do sampling 24/7, however I want my ADC12MCTL1 to be periodically activated and deactivated e.g every 5 mins.  Should I initialize my Control register as ADC12CONSEQ_3 and whenever I don't want to use ADC12MCTL1I turn it off as 

     

     ADC12CTL0 &= ~ADC12ENC;             // Stop Sequencing
     ADC12MCTL1 &= ~ ADC12INCH_8;        // Undo A8

    I appreciate your Response.

    thanks,

    Jahangir

     

  • Hi Jahangir,

    Yeah, you can do this, There is only one ADC module integrated inside in MSP430FR5994. There are many channels and sequence control on the outside. If you want to achieve the your describe function. You need to open the periodic sampling channel, then sampling, and then turn it off. The way of operation is as you described.

    By the way, Why do you need this function? What is the main purpose of achieving?

    Best Regards

    Johnson

  • Hi Johnson,

    I appreciate your response. As I metntioned earlier, I'll be using more than one channels for different inputs having different functionality and usage. Some inputs needs to be monitored frequently and some not so frequently. So I plan to turn my inputs off as I mentioned earlier which needs not to be monitored frequently and turn them on on hourly basis to measuer if the value has changed from last measured value. The input which needs to be monitored frequently, will remain on for the course of running.

    Can I leave multiple sampling "Q_3" on, even if I have only one input sampling all the time?

    thanks and wish you a nice start in the week.

    Jahangir 

  • Hi Jahangir,

    Yes, you can set multiple sampling "Q_3",  even you have only one input sampling all the time.

    Thanks.

    Best Regards

    Johnson

  • Hi Johnson,

    I appreciate your help and extend my gratitude.

    cheers,

    Jahangir

  • Hi Jahangir,

    I am very happy to discuss with you in the E2E community and help you solve the problem. If you encounter any problems later, please feel free to create post directly and discussion in the E2E community.

    Best Regards

    Johnson

**Attention** This is a public forum