If an ADC of 1023 (you can't have 1024) equals 100.0 then it is reasonable in maths to calculate...
1023/1023*100 = 100.0
But we can't do that in INTEGER maths so (and not knowing what version of PBP you've got) let's do this in a version that only has WORDS and BYTES...
Let's assume the following variables...
MyADC var WORD
Temp var WORD
VoltsResult Var WORD
So... after your ADC reading, MyADC contains say a value of 1023... let's do something like this...
Temp=MyADC*1000
VoltsResult=DIV32 1023
Now VoltsResult contains 1000 (representing 100.0), with the last (rightmost) digit being the tenths of volts... so we can extract and display what we want in any number of ways... here's just one...
Code:
Temp=VoltsResult/10
LCDOut $FE,$80,#Temp,".",#VoltsResult DIG 0," "
The displayed result will be "100.0".
You may need some additional display formatting... for example if you want to display the voltage right or left justified at a particular spot etc. The example above will display the result at the top-left of a typical LCD. The two blanks (spaces) being written to the LCD after the main display digits simply erase anything left on the LCD from a previous display that might be of a greater length than what is currently being written.
Bookmarks