low battery indicator using adc0_SE4b for kl26z

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

low battery indicator using adc0_SE4b for kl26z

Jump to solution
1,313 Views
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 Kudos
Reply
1 Solution
1,307 Views
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.

View solution in original post

3 Replies
1,298 Views
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 Kudos
Reply
1,293 Views
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,308 Views
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.