Internet PLC Forum

General => Technical support => Topic started by: mjb123 on June 07, 2006, 12:42:38 PM

Title: Displaying time on display
Post by: mjb123 on June 07, 2006, 12:42:38 PM
When I display the time on the display, I get unusual hours, minutes and seconds appearing. (hour = 94).  

H=TIME[1]+1
if h>24 then h=0
endif
SETLCD 4,1,"HE: " + STR$(H)

overflow?
Title: Re:Displaying time on display
Post by: support on June 07, 2006, 01:30:12 PM
It is because it has previously displayed two digits and later on display only one digit and the old digit did not get erased. There are two ways of doing it. One is to use the STR$(H,2) to change the number to only two digits. Another way is to add some white spaces behind the current display string so that it wipes out old characters.

E.g. SETLCD 4,1,"HE: "+STR$(H)+"    "

Third method is to clear the line first using SETLCD 4,1, "                             " . You can put this inside a function to be called as a subroutine. That way old data will not be present that lead to confusion.
Title: Re:Displaying time on display
Post by: mjb123 on June 08, 2006, 09:52:41 AM
Thanks for the quick reply. :D