Forum members kindly helped me with this code a while back.
It evaluates a 16 bit hex number from an array and produces a current reading to two decimal places with a + or - sign to denote charging or discharging. It work fine.Code:Amps = ((BCM87[4] * 128) + BCM87[5]) - 2048 'Calculate Battery Current if Amps.15 = 1 then 'Calculate AmpSign AmpSign = 45 'Set AmpSign to 45 (-) else AmpSign = 43 'Set AmpSign to 43 (+) endif Amps = ABS Amps Amps = Amps * 2500 Amps = DIV32 512
Now I need to manipulate the current, so say the current is +10.00A i need to be able to reduce it by say 8 or 16% and then generate two new hex bytes in the correct format to overwrite those it came from.
Imagine the device sits passing through the traffic current data. it now needs to get the data evaluate, modify it by X% and squirt it out the other side.
I would be grateful for ideas as maths is not my strong point. Thanks Peter
Bookmarks