ADC08831 Help needed - My Version of Program
adcbits var byte
v var byte
R var byte
v2 var byte
v3 var byte
CS con 3
CLK con 4
D0 con 5
'Start display.
debug cls
'Main routine.
main:
gosub ADCDATA
gosub CALC_VOLTS
gosub DISPLAY
gosub COMPARE
goto main
ADCDATA:
high CS
low CS
low CLK
pulsout CLK,210
shiftin D0,CLK,msbpost,[noparse][[/noparse]adcbits\8]
return
CALC_VOLTS:
v2 = adcbits*100/255
v3 = adcbits*9/255
v = v2 + v3
return
DISPLAY:
debug home, "8 bit binary value: ", bin8 adcbits
debug CR, CR, "Decimal value: ", dec3 adcbits
v var byte
R var byte
v2 var byte
v3 var byte
CS con 3
CLK con 4
D0 con 5
'Start display.
debug cls
'Main routine.
main:
gosub ADCDATA
gosub CALC_VOLTS
gosub DISPLAY
gosub COMPARE
goto main
ADCDATA:
high CS
low CS
low CLK
pulsout CLK,210
shiftin D0,CLK,msbpost,[noparse][[/noparse]adcbits\8]
return
CALC_VOLTS:
v2 = adcbits*100/255
v3 = adcbits*9/255
v = v2 + v3
return
DISPLAY:
debug home, "8 bit binary value: ", bin8 adcbits
debug CR, CR, "Decimal value: ", dec3 adcbits