- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I am having some difficulty with using the ADC on the 20732 chip. I checked the Hardware Interface Guide and it seems the only code you have to use to read from the ADC is the following:
adc_readVoltage(ADC_INPUT_CHANNEL);
is that correct? Does there need to be any type of configuring to make sure the pin is configured to be used as an ADC input?
I ask because I get the same adc reading whether I choose 2.4V or 3.6V as a reference voltage, which I'm pretty sure is not right.
Your help is greatly appreciated,
Gurpal
Solved! Go to Solution.
- Labels:
-
ADC
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Once initialized (and so calibrated or you perform your own calibration using your own reference input if required), you don't need to configure a GPIO separately as an ADC input. The ADC input channel parameter to readVoltage is sufficient. This will internally configure the GPIO as an ADC input, turn on the ADC, acquire a sample and then turn off the ADC.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for the quick response.
Yes, it helps a little. So just to confirm, there is no code required to configure a certain pin to be an ADC input?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Once initialized (and so calibrated or you perform your own calibration using your own reference input if required), you don't need to configure a GPIO separately as an ADC input. The ADC input channel parameter to readVoltage is sufficient. This will internally configure the GPIO as an ADC input, turn on the ADC, acquire a sample and then turn off the ADC.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Ok, I understand now. So the adc_readvoltage already converts the reading to the voltage on the pin. I think I misunderstood the use of the function.
Thank You.