Go Down

Topic: Battery Monitor Display -ve current draw (Read 79 times) previous topic - next topic

pcoe149

Hi Guys,

My current project is to monitor 2 batteries in a split charging system. I am displaying on a 20x4 display and currently have the temperature of each of the batteries displayed along with voltage and then charging current from the alternator to each of the batteries and the current being drawn from each of the batteries to devices.

What i am trying to do is display the 'difference' between the charging current to current draw to monitor wether the batteries are charging or dis-charging. I am using several int statements

int mid1 = mii1 - mio1; //Calculate difference in charging current to current draw main battery

mii1 being the curent flow to the battery and mio1 being current flow from the battery, all appears to be working well other than when the current draw is a minus number obviosly basic maths dictates 200 - -200 = 400 when acually i want it to equal zero, is there any way of being able to display this number as a nagative value? i may be being stupid but i cant see any way of achieving this.


Any help or advice would be apreciated.

thanks and best regards,

Phil

outsider

I'm certainly no math whiz, but I think you want the algebraic sum, 200 + -200 = 0 or -200 + 200 = 0.

PaulS

Quote
when acually i want it to equal zero, is there any way of being able to display this number as a nagative value?
You want to display 0 as a negative number?

Post your code. Without it, your question makes little sense.

jremington

How do you "separately" measure charging current and current draw?

Current is either flowing out of the battery, or into it.

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy