Hi all,
I had a 16f877 automatic battery charger all working on an lcd with voltage and current shown. This from the net some time ago. However the unit crashed and corrupted the code which is no longer available.

I 'm in the process of writing my own code in PBP to suit the built board.

So far all is good, I have the voltage readout, automatic startup on connection, switching to trickle charge as appropriate.

Now I'm having trouble getting my head around determining the current. (Maybe because I've got a stinker of a head cold!)

The board has two resistor divider adc inputs across a 0.1 ohm resistor on the output.

I know if I connect a mutimeter set to volts on either side of the resistor I get a reading in mV directly proportional to the current. But for the life of me I can't figure the code out.

I know it's I=V/R so i tried something like this:-

amp = adc1 - adc2 ; subtracting output adc reading from the input adc
mamp=(amp*100)/10 ; ohms law on mV result?
LCDOUT $FE,$80,#mamp,"mA"

This doesn't work, so where am I going wrong. The maths was there in the original code to make it work with this setup.

Rob