Perhaps i need to be a bit clearer.
In the below simplified sample code two hex bytes of incomming battery current data are
evaluated to give a display of current. The code works very well.
Code:
Amps = ((HEXBYTE1 * 128) + HEXBYTE2) - 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
This gives current to two decimal places when divided and a polarity sign to indicate current flow
direction. All that is fine.
Now I need to reduce the Amps by say 8-16% (That's fine) and then recreate the HEXBYTES by
some reverse calculation or application of the above code. So they contain the new value and when evaluated by the above routine would give the new current and sign etc. Does that make sense? I hope somone can give me
me some ideas. Thanks