I'm trying to round up to three decimals without any luck.
Please see codes below.
<code><pre><font size=2 face='Courier'>
SYMBOL BattNomFloatVoltage = 1362
SYMBOL SenseAmp = w2 ;b4:b5
SYMBOL RestOprund = B10
DisplayLine3:
SenseAmp= 93 ;= 4.50 Amp
Byte = $94; Start Line 3
GOSUB SendCmdByte
EEPROM 26,("Ladning: " ;26..35
FOR get = 26 TO 35
READ get,byte
GOSUB SendDataByte
NEXT
LET SenseAmp = SenseAmp * 50 / 32 * 100 / 32
DisplayLine4:
'Watt = w3:b8:b9
Byte = $D4; Start Line 4
GOSUB SendCmdByte
EEPROM 36,("Power: " ;51..65
FOR get = 36 TO 45
READ get,byte
GOSUB SendDataByte
NEXT
LET Watt = SenseAmp /10 * BattNomFloatVoltage /10
RestOprund = MaxFlowDisplay / Watt
Let Watt = Watt + RestOprund + 1
SERTXD("RoundUP: ",#Watt,CR,LF)
Readout from SERTXD
At 13.62 * 4.5 SERTXD shows "6133" where it should have shown 613
Ved 13.62 * 0.8 SERTXD shows "1108" where it should have shown 111
Calculatation example with a calculator
At 13.62 * 4.5 = 6129 But want the result rounded up tol 613
At 13.62 * 0.8 = 1089 But want the result rounded up to 109
</font></pre></code>
Can you help me with a suggestion to improve my codes or a better suggestion for rounding up
A code example would be great ;-)
Best regards
Monie
Please see codes below.
<code><pre><font size=2 face='Courier'>
SYMBOL BattNomFloatVoltage = 1362
SYMBOL SenseAmp = w2 ;b4:b5
SYMBOL RestOprund = B10
DisplayLine3:
SenseAmp= 93 ;= 4.50 Amp
Byte = $94; Start Line 3
GOSUB SendCmdByte
EEPROM 26,("Ladning: " ;26..35
FOR get = 26 TO 35
READ get,byte
GOSUB SendDataByte
NEXT
LET SenseAmp = SenseAmp * 50 / 32 * 100 / 32
DisplayLine4:
'Watt = w3:b8:b9
Byte = $D4; Start Line 4
GOSUB SendCmdByte
EEPROM 36,("Power: " ;51..65
FOR get = 36 TO 45
READ get,byte
GOSUB SendDataByte
NEXT
LET Watt = SenseAmp /10 * BattNomFloatVoltage /10
RestOprund = MaxFlowDisplay / Watt
Let Watt = Watt + RestOprund + 1
SERTXD("RoundUP: ",#Watt,CR,LF)
Readout from SERTXD
At 13.62 * 4.5 SERTXD shows "6133" where it should have shown 613
Ved 13.62 * 0.8 SERTXD shows "1108" where it should have shown 111
Calculatation example with a calculator
At 13.62 * 4.5 = 6129 But want the result rounded up tol 613
At 13.62 * 0.8 = 1089 But want the result rounded up to 109
</font></pre></code>
Can you help me with a suggestion to improve my codes or a better suggestion for rounding up
A code example would be great ;-)
Best regards
Monie