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.

ADCSequenceStepConfigure



hi all,

actually I learnt to use the onboard temperature sensor on the Tiva Launchpad and I came to know that for the onboard temperature sensor, we use ADC_CTL_TS in the ADCSequenceStepConfigure API..

But if I have to connect a different analog sensor externally, then which parameter of that external analog sensor would replace ADC_CTL_TS in the   ADCSequenceStepConfigure API ??

Please help me with the basic configurations that are required when we connect an analog sensor externally to Tiva's ADC channel..

Thanks in advance :)

  • Hello Vikas,

    An external Temp Sensor cannot be connected as an Internal Temp Sensor. However if the output of the temp sensor is analog then it can be sampled by the ADC on one of the Analog Inputs and the Cortex Core can be used to convert this into a temp reading. The following example of the ADCSequenceStepConfigure has to be used.

    ADCSequenceStepConfigure(ADC0_BASE, 0, 0, ADC_CTL_CH0 | ADC_CTL_IE | ADC_CTL_END);

    Regards

    Amit

  • Thanks Amit.

    This really helped :)

  • Perhaps further clarification results from the recognition that an external, analog output, temperature sensor must be treated "just" as any other analog signal - destined for one of your MCU's ADC inputs.  Thus - it is not strictly necessary that an analog Temp Sense output be directed to ADC_CTL_CH0 only (as was shown) - or that this Temp Sense channel be confined to ADC_CTL_END.  (i.e. any "normal" ADC Sequence Step may properly receive the analog output of an external, temperature sensor.) 

    The example provided is proper should your temperature sensor be the sole signal applied to the ADC - but we note that limiting an "8 Step" sequence (i.e. Sequence 0) - to just one step - appears inefficient.

    You must insure that any sensor's analog output remains w/in the MCU's specified, analog input signal range.  (usually between 0V and 3V3 - to prevent damage to the MCU.)

    Two predictable - added issues - usually intrude into such applications:

    a) the sensor will not output 0V at the desired/chosen lower temperature

    b) the sensor's output range - over your desired temp. span - will not match the full voltage span of the ADC (i.e. 3V3)

    Review of Op-amp basics (amp as adder/subtractor) reveal how to adjust the sensor's lower temperature output to 0V and that same op amp's gain may then scale the sensor's Voltage output range (difference between voltage output at Temp_HI minus Temp_Lo) to more closely equal that of the ADC.  (3V3) 

    It may also be that your sensor has a negative temperature coefficient - thus the voltage output will decrease w/increasing temperature.  Again - op amp to the resuce as you can subtract the sensor's output from a fixed voltage equal to the sensor's low temperature output.  (yielding low Temp op amp output = 0V while High Temp output approaches 3V3...should your gain setting be proper)

    To minimize harm to your MCU- it's alway wise to first breadboard your op-amp circuit - test/verify before feeding its signal to your precious MCU.  Op-amp "cookbooks" provide great detail & multiple circuit configs/examples...