low battery indicator using adc0_SE4b for kl26z

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

low battery indicator using adc0_SE4b for kl26z

跳至解决方案
1,378 次查看
omkar_virkar
Contributor II

I want to write a function for low battery indicator for that I am using adc0_SE4b pin of kl26z controller. so for that is there any sample example which will help me or any code snippet

omkar
0 项奖励
回复
1 解答
1,372 次查看
diego_charles
NXP TechSupport
NXP TechSupport

Hi @omkar_virkar 

The latest SDK examples can be found in the MKL26 MCUXpresso SDK, that you can obtain from the MCUXpresso SDK builder

Specifically for the ADC you can refer to the  ADC polling example and adapt it to work with your ADC channel.

diego_charles_0-1642457539535.png

Let me know if I you are still having questions. 

Diego.

在原帖中查看解决方案

3 回复数
1,363 次查看
omkar_virkar
Contributor II

how to calculate the actual voltage value from the ADC reading value? my actual input is 3.3v and ADC value is 2427 for 16bit ADC 

omkar
0 项奖励
回复
1,358 次查看
bobpaddock
Senior Contributor III

It depends on your reference voltage value at Vref.

At the ADC level one bit will represent Vref/65536 (16 bits for a 16 bit ADC).
These direct ADC readings will be referred to as 'counts' in a lot of places, until converted into something with meaning like Volts.

Any external dividers need to be accounted for that might be between your input and the ADC input.

There could also be ADC gain settings that could change things.

Having an input higher than Vref will give the top reading of all bits set and depending on how things are setup could look like either a positive or negative number from having the most significant bit set.

Analog Devices at https://www.analog.com has a lot of good analog design information in their seminar series.

 

 

1,373 次查看
diego_charles
NXP TechSupport
NXP TechSupport

Hi @omkar_virkar 

The latest SDK examples can be found in the MKL26 MCUXpresso SDK, that you can obtain from the MCUXpresso SDK builder

Specifically for the ADC you can refer to the  ADC polling example and adapt it to work with your ADC channel.

diego_charles_0-1642457539535.png

Let me know if I you are still having questions. 

Diego.