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
Solved! Go to Solution.
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.
Let me know if I you are still having questions.
Diego.
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
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.
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.
Let me know if I you are still having questions.
Diego.