16 bit ADC with SX/B
TC
Posts: 1,019
I am wondering how to take a 16 bit value from an ADC and convert it to a value I can display on a LCD? I am looking for a resolution .001V. There are only 3 voltages I will be reading 3.3V, 5V, and 12V. I will appreciate any help.

Comments
If you want to convert your Word value to "volts" with decimal, you'd need to supply more info (like what range of values is your ADC giving you)
chars VAR Byte(5) val VAR Word idx VAR Byte chars(4) = val/10000 ' ten thousands chars(3) = val//10000 chars(3) = chars(3)/1000 ' thousands chars(2) = val//1000 chars(2) = chars(2)/100 ' hundreds chars(1) = val//100 chars(1) = chars(1)/10 ' tens chars(0) = val//10 ' ones FOR idx = 0 TO 4 chars(idx) = chars(idx) + "0" ' convert to ascii char ENDIF ' now if you dump chars(0)...char(4) to an LCD, you'll have a 5 digit number that shows val