Display Help
Tom P
Posts: 97
I Need help with a display problem.
Below is a program section which displays wind speed.
Orignal program·displayed speed via the debug screen,see at third line from bottom.
I'am also trying to send the display out the serial port but have a display problem.
HERE is the PROBLEM:
If speed is 3.9 miles per hour on the debug screen, I get .39 out the serial display.
Can't seem to get the display on the LCD to read the decimal in the right place.
Please help with idea
thanks
Tom
' *******************************
' Retrieve and display wind speed
' -- mph = rps * 2.453
' *******************************
'
Show_Wind_Speed:
· eeAddr = DS2423
· GOSUB Load_SN
· ' get starting count
· '
· OWOUT OWpin, OW_FERst, [noparse][[/noparse]ODMatchROM]
· OWOUT OWpin, OW_HighSpd, [noparse][[/noparse]STR romData\8, ReadMemCntr, $DF, $01]
· OWIN· OWpin, (OW_HighSpd | OW_BERst), [noparse][[/noparse]cntrA.LOWBYTE, cntrA.LOWBYTE, cntrA.HIGHBYTE]
· PAUSE 2500··································· ' = revs for 5 seconds
· GOSUB Comm_Status
· IF (commStat = CommOkay) THEN Get_End_Count
· GOTO Main2··································· ' abort if comm down
· ' get ending count
· '
Get_End_Count:
· OWOUT OWpin, OW_FERst, [noparse][[/noparse]ODMatchROM]
· OWOUT OWpin, OW_HighSpd, [noparse][[/noparse]STR romData\8, ReadMemCntr, $DF, $01]
· OWIN· OWpin, (OW_HighSpd | OW_BERst), [noparse][[/noparse]cntrB.LOWBYTE, cntrB.LOWBYTE, cntrB.HIGHBYTE]
Calc_CPS:
· rps = cntrB - cntrA·························· ' get diffential count
· IF (cntrB >= cntrA) THEN Calc_Speed
· rps = rps + $FFFF···························· ' correct for rollover
Calc_Speed:
· speed = rps */ $04E7························· ' rps * 4.906 (tenths @ 5 seconds)
· DEBUG MoveTo, 19, 7
· width = 3···································· ' width of whole portion
· rjNum = speed / 10··························· ' get whole portion
· GOSUB RJ_Print······························· ' print it
· DEBUG ".", DEC1 speed, " mph "··············· ' then print tenths
DISPLAY
· SEROUT TX,bdmd,[noparse][[/noparse]".",DEC2 speed," MPH",10,13]
DISPLAY
· GOTO Main2
Below is a program section which displays wind speed.
Orignal program·displayed speed via the debug screen,see at third line from bottom.
I'am also trying to send the display out the serial port but have a display problem.
HERE is the PROBLEM:
If speed is 3.9 miles per hour on the debug screen, I get .39 out the serial display.
Can't seem to get the display on the LCD to read the decimal in the right place.
Please help with idea
thanks
Tom
' *******************************
' Retrieve and display wind speed
' -- mph = rps * 2.453
' *******************************
'
Show_Wind_Speed:
· eeAddr = DS2423
· GOSUB Load_SN
· ' get starting count
· '
· OWOUT OWpin, OW_FERst, [noparse][[/noparse]ODMatchROM]
· OWOUT OWpin, OW_HighSpd, [noparse][[/noparse]STR romData\8, ReadMemCntr, $DF, $01]
· OWIN· OWpin, (OW_HighSpd | OW_BERst), [noparse][[/noparse]cntrA.LOWBYTE, cntrA.LOWBYTE, cntrA.HIGHBYTE]
· PAUSE 2500··································· ' = revs for 5 seconds
· GOSUB Comm_Status
· IF (commStat = CommOkay) THEN Get_End_Count
· GOTO Main2··································· ' abort if comm down
· ' get ending count
· '
Get_End_Count:
· OWOUT OWpin, OW_FERst, [noparse][[/noparse]ODMatchROM]
· OWOUT OWpin, OW_HighSpd, [noparse][[/noparse]STR romData\8, ReadMemCntr, $DF, $01]
· OWIN· OWpin, (OW_HighSpd | OW_BERst), [noparse][[/noparse]cntrB.LOWBYTE, cntrB.LOWBYTE, cntrB.HIGHBYTE]
Calc_CPS:
· rps = cntrB - cntrA·························· ' get diffential count
· IF (cntrB >= cntrA) THEN Calc_Speed
· rps = rps + $FFFF···························· ' correct for rollover
Calc_Speed:
· speed = rps */ $04E7························· ' rps * 4.906 (tenths @ 5 seconds)
· DEBUG MoveTo, 19, 7
· width = 3···································· ' width of whole portion
· rjNum = speed / 10··························· ' get whole portion
· GOSUB RJ_Print······························· ' print it
· DEBUG ".", DEC1 speed, " mph "··············· ' then print tenths
DISPLAY
· SEROUT TX,bdmd,[noparse][[/noparse]".",DEC2 speed," MPH",10,13]
DISPLAY
· GOTO Main2
Comments
speed=39
speed_fraction=speed//10
speed_int=speed/10
SEROUT TX,bdmd,[noparse][[/noparse]DEC speed_int,".",DEC speed_fraction," MPH",10,13]
Jeff T.
I'am not sure if I understand?
SEROUT TX,bdmd,[noparse][[/noparse]DEC speed_int,".",DEC speed_fraction," MPH",10,13]
If I insert the SEROUT line above, then the program wants to have the definition below?
speed_fraction=speed//10
speed_int=speed/10
Do I add all these lines to the program, if so where?
Need a bit more help!
thanks
Tom
I figured out how to display the Windspeed.
When I chnaged the SEROUT to:
SEROUT TX,bdmd,[noparse][[/noparse]DEC speed/10,".",DEC speed//10," MPH",10,13]
the· display began to work fine.
thanks
Tom