KK:
gosub GetVolt
SerOut LCDScreen, N2400, [LCDCmd, LCDLine1,"T= c"," V=",#LCDVHigh,".",#LCDVLow]
goto KK
GetVolt:
'For global reference to system voltage, use the Voltage variable, which is based on a
'scale of 1 to 1000, with 775 = 7.75 volts. Remember that the resistors on the board
'divide the actual battery voltage in half so the ADC can "digest" it without damage.
'ADCIN voltages are limited to 5. Voltage are compared with the onboard
'precision voltage reference which delivers a perfect 5V.
'**Voltage**
LCDVLow=0
LCDVHigh=0
Voltage=0
ADCIN VoltChannel, Voltage 'Take just 1 voltage sample. 7.6V = 194
Voltage = Voltage * 4 '194 * 4 = 776
LCDVHigh = Voltage / 100 '776 / 100 rounds to 7
LCDVLow = (Voltage // 100) / 10 '776 // 100 = 76, 76 / 10 = 7
'Final Display = 7.7
return
Bookmarks