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.

C2000 LaunchPad ADC Example

Other Parts Discussed in Thread: CONTROLSUITE

Hi,

Can anyone explain me the aim of adc_soc example on ControlSuite ?

What does this example do?

Thank you.

Metin

  • This example shows one way to use the analog-to-digital converter (ADC).  The ADC lets you convert voltages on external pins to a digital representation that you can use in your program.  The input voltage range is 0 to 3.3V and the output digital code is in the range of 0 to 4095.  0 would mean 0V and 4095 would mean 3.3V, with other digital codes representing voltages in between.  

    This example converts the voltages on ADCINA4 and ADCINA2 (on the launchpad, these connect to J1 pin 6 and J1 pin 8 respectively) to digital values, which are then stored in the arrays Voltage1 and Voltage2.  The example keeps converting and storing new values in the arrays, so if the voltage on one of the pins changes, the values in the arrays will eventually change too.

    The ePWM configs are just to create a periodic trigger to the ADC to tell it to convert some new voltages.   

    Try to apply some voltage (in the range of 0 to 3.3V) to the pins mentioned above on the launchpad, then see what digital results you get in the arrays. 

  • Devin,

    Thank you for your valuable and useful explanations.

    I understood your explanations but there is something that are not clear for me:

    1- I get some values on ADCRESULT0 etc., without applying any voltages on ADCINA4 or ADCINA2. How can it be possible?

    2- When I look at ADCRESULT0, I see some hex numbers and if I convert them to decimal, they come out too big numbers. What is the meaning of this?

    Thank you so much again.

    Metin

  • Also, when I look at Voltage1 and Voltage2 values, I see some numbers such as 1900,1700,2000 etc.. But the problem is, I see those nembers without applying any voltage to ADCs.

    I do not understand this statement. How can I see numbers on Voltage1 and Voltage2 when I do not apply any voltages?

    Could you tell me how it can be possible?

    Thank you.

    Metin

  • If the pin the ADC is converting is floating, you will still get some voltage reading.  This won't be meaningful, and may fluctuate wildly, but it will still produce a value.  This voltage is actually related to whatever voltage the design naturally drives onto the sampling capacitor internally due to leakage/parasitics. This is an extremely weak drive and will be overdrive as soon  as you supply a  voltage on the pin.

  • Thank you so much Devin.

    You respondings are very helpful for me and finally it works.

    Metin Ozturk

  • Hello,

    I have tried running all of the ADC examples yet the adc buffers never seem to update.  

    In this particular example, I my Voltage1 and Voltage 2 never change.  Is there something that happens when you debug and step through the code that disables interrupts?