How can I get the decimal point in the right place.
It shows up as 17.0 instead of 1.7
Help Please!
How can I get the decimal point in the right place.
It shows up as 17.0 instead of 1.7
Help Please!
Because the only time 'tenths' gets displayed is AFTER you've cleared it to zero...
Main:
SerOut2 SO,16468,["Milage = ",DEC Miles,".", DEC Tenths ,13]
VSSCount = 0 ' Clear VSS counter
TMR0 = 0 ' Clear TMR0 counter
Loop:
VSSCount = TMR0 ' Get TMR0 count
IF VSSCount > 99 Then
VSSCount = 0
Tenths = Tenths + 1
IF Tenths > 9 Then
Tenths = 0
Miles = Miles + 1
GoTo Main
EndIF
EndIF
GoTo Loop
And milage is spelled MILEAGE...![]()
I have been trying everything! I cannot get this pic to count like a Cars odometer. ( ie.. 100.1, 100.2, 100.3 ect ). Anyone have a routine I can see?
Thanks,
kman
"If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte
Kman,
You almost had it.
Just need to move the GOTO Main down 1 line, and clear the timer when it reaches 100 instead of after you Print it to the LCD/Terminal.
OR, you can reduce it a little so that it works with the timer directly. Get's rid of VSSCount.Code:Main: SerOut2 SO,16468,["Milage = ",DEC Miles,".", DEC Tenths ,13] Loop: VSSCount = TMR0 ' Get TMR0 count IF VSSCount > 99 Then VSSCount = 0 TMR0 = 0 Tenths = Tenths + 1 IF Tenths > 9 Then Tenths = 0 Miles = Miles + 1 EndIF GoTo Main EndIF GoTo LoopNow you just need a way to save it to EEPROM, so you don't lose the value when power is lost.Code:Main: SerOut2 SO,16468,["Milage = ",DEC Miles,".", DEC Tenths ,13] Loop: IF TMR0 > 99 Then TMR0 = 0 Tenths = Tenths + 1 IF Tenths > 9 Then Tenths = 0 Miles = Miles + 1 EndIF GoTo Main EndIF GoTo Loop
HTH,
DT
Thanks Darrel ! Its counting away, and the decmal is in the proper Place!
Bookmarks