Battery monitor
RV
Posts: 9
I am attempting to build a remote battery monitor using a BS2 and Xbee. The program works well for one battery but I would like to monitor two. I have attempted to change the code to read the output on pin 1 in addition to the existing pin 0 but am unable to get it to work properly and would like any suggestions and or code.
The program is as follows:
rct var word ' RCtime value
Vx var word ' voltage value calculated
' we want this to = applied voltage Vx
Cn1 con 48576 ' first constant, see below
Cn2 con 8 ' second constant, ditto
' circuit attached to P0
low 0
loop:
RCtime 0,0,rct
low 0
Vx=Cn1 / rct + Cn2
debug home,dec? rct,"Vx=",dec Vx/10,".",dec1 Vx
pause 500
goto loop
This is from emesystems.com and I did attempt to contact them for suggestions to no avail.
Thank you in advance for any help. I am a rank newbie....
Pete
P.S. The article is at www.emesystems.com/BS2rct.htm
The program is as follows:
rct var word ' RCtime value
Vx var word ' voltage value calculated
' we want this to = applied voltage Vx
Cn1 con 48576 ' first constant, see below
Cn2 con 8 ' second constant, ditto
' circuit attached to P0
low 0
loop:
RCtime 0,0,rct
low 0
Vx=Cn1 / rct + Cn2
debug home,dec? rct,"Vx=",dec Vx/10,".",dec1 Vx
pause 500
goto loop
This is from emesystems.com and I did attempt to contact them for suggestions to no avail.
Thank you in advance for any help. I am a rank newbie....
Pete
P.S. The article is at www.emesystems.com/BS2rct.htm
Comments
Two batteries? In series or what?
If it's a matter of two different batteries then you need two battery monitor circuits
and this (?) re-hashing of your code using P0 and P1, I think:
That could be made more compact, but I didn't want to complicate.
I am still playing with the hardware side and have just about worked it out.
Pete