' this will monitor and report the 12V Battery and Current being used out to a serial port ' at 4800 bd. This is to be used with the SWASC Power Monitor - Computer circiut. ' This uses a PICAXE-18x so the current and voltage can be displayed onto a 2 x 16 line LCD ' ' Paul Hamilton - 20070916 ' ' Local Variables SYMBOL LOOPDELAY=500 ' clear the LCD screen serout 7,N2400, (254,1) pause 30 MAIN: ' Blink a debug LED - one reading per blink/loop high 1 ' set the LED on port 1 ON pause LOOPDELAY low 1 ' set LED off pause LOOPDELAY ' lets read what the voltage is on the resistance ladder junction READADC 1,b1 w2=b1*10/16 ' convert the reading from units to voltage * 10, ie. 119 = 11.9 Volts ' lets read what the current is being reported by the ACS712 READADC 0,b2 b3=b2-121 ' because I am using a ACS712, Need to watch out for readings below 0 (ie 255) ' I really should be using a ACS713, then I wouldn't have this problem. if b3<253 then SKIP b3=0 SKIP: sertxd ("V: ", #b1,", A: ", #b3,13,10) ' send data to PC serout 7, N2400, (254,128,"V: ",#w2," ") ' display the Voltage. Need to mentally devide by 10 serout 7, N2400, (254,192,"A: ",#b3," ") ' display the current. Need to mentally devide by 10. if b1>197 then MAIN sound 6,(110,20,80,30) ' plays a Voltage Low warning sound goto MAIN