ADC Quick Measurement Conditioner Calculator
Calculate fast measurement conditioning routines to avoid the use of floats.
Back to Tools
Some Notes:
ADC should be linear type.
Everything should be unsigned integers.
The algorithm needs 32-bit operations (compiler should be capable).
A 32-bit Unsigned Integer overflow check is peformed.
Output is 16-bit Unsigned Integer
Quick Calculator:
ADC Resolution:
bit (needed just to get 2
^{q}
- 1 maximum ADC Output value)
Example ADC Output:
(ADC unit-less magnitude)
Example Desired Output:
(Measurement units ex. milliVolts, milliAmperes, etc.)
uint16 output = ( (uint32)adcOutput * 211406 ) >> 16;
or
union{ // Only valid for BIG-ENDIAN CPUs uint32 full; struct{ uint16 high; uint16 low; } result; } conversion; conversion.full = (uint32)adcOutput * 211406; // 16-bit result is in: conversion.result.high
YAY! 32-Bit operation doesn't overflow when ADC Output is maximum:
1023
(2
^{10}
- 1)