Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

Smart Bluetooth Forum Discussions

Anonymous
Not applicable

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

0 Likes
1 Solution
ArvindS_76
Employee
500 likes received 250 likes received 100 likes received
Employee

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.

View solution in original post

0 Likes
4 Replies
ArvindS_76
Employee
500 likes received 250 likes received 100 likes received
Employee
0 Likes
Anonymous
Not applicable

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?

0 Likes
ArvindS_76
Employee
500 likes received 250 likes received 100 likes received
Employee

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.

0 Likes
Anonymous
Not applicable

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.

0 Likes