Dim ascbfr3 As Byte 'used in convert routing
Dim ascbfr2 As Byte 'used in convert routing
Dim ascbfr1 As Byte 'used in convert routine
Dim ascbfr0 As Byte 'used in convert routine
binval = volts
Gosub bin2asc
bin2asc:
ascbfr3 = binval / 1000
temp3 = binval Mod 1000
ascbfr2 = temp3 / 100
temp3 = temp3 Mod 100
ascbfr1 = temp3 / 10
ascbfr0 = temp3 Mod 10
'results are BCD so
'convert to ASCII for LCD
ascbfr3 = ascbfr3 Or 0x30
ascbfr2 = ascbfr2 Or 0x30
ascbfr1 = ascbfr1 Or 0x30
ascbfr0 = ascbfr0 Or 0
' and to show on a lcd after it is set up
Lcdout "Volts:", ascbfr3, ascbfr2, ".", ascbfr1, ascbfr0
'this will put a decimal point in and the example shows a voltage reading to 2 decimal places