Go Down

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

#### pcoe149

##### Mar 20, 2016, 01:33 pm
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

#1
##### Mar 20, 2016, 05:45 pm
I'm certainly no math whiz, but I think you want the algebraic sum, 200 + -200 = 0 or -200 + 200 = 0.

#### PaulS

#2
##### Mar 21, 2016, 02:56 pm
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?