I am once again having trouble measuring voltage. I have had good success with 20 volts but am having trouble with 9 volts. Code is enclosed below. I have search the forum for answers but I can't seem to get any of them to work right. Probably my fault because I am very poor at math. I am trying to read a 9 volt battery to one decimal place. (9.0 volts) If that is possible. I can get one number with no problem, its getting the decimal place that I am struggling with at this time. Any help would be appreciated.
I am using a 08m2 chip for testing.
Thank you,
mas11
Code:
init:
pause 2000
serout C.2,N2400, (254,1) 'Clear display
serout C.2,N2400,(254,%00111000) 'Set ASCII Characters
main:
readadc C.4, b2 'read voltage on pin
b4=b2*9/255 'calculated offset.
sertxd (#b3,".",#b4,"volts") 'change to ascii and display of screen
serout C.2,N2400,(254,128,#b3,".",#b4,"volts") 'display on LCD
debug
goto main
Thank you,
mas11
Last edited by a moderator: