Internet PLC Forum

General => Technical support => Topic started by: karen on November 05, 2002, 10:45:05 AM

Title: number display question
Post by: karen on November 05, 2002, 10:45:05 AM

please can you tell me how i can make the screen show 1 and not 239 when i press the button other wise i have to keep pressing the button until it reaches the lower numbers



x = x - 17 ' Progressive increment after every call
IF x > 3800 THEN j=0: ENDIF
IF x > 3800 THEN x=0: ENDIF
j = 240 - X*240/3800

SETLCD 0,1,CHR$(1)  ' clear screen
SETLCD 1,1,"Select Current          "
SETLCD 2,1,"Current =" +str$(j)
SETLCD 4,1,"Press Enter"

thanks



Title: Re: number display question
Post by: support on November 05, 2002, 08:15:13 PM
I don't quite understand your problem.  Do you mean if X > 3800 you want the screen to show "current = 1"?

I think your logic could be modified a bit as follow:

x = x + 17 ' Progressive increment(??) after every call
IF x > 3800 THEN
         j = 0
         x = 0    ' you can put many lines between if and endif.
ELSE
         j = 240 - X*240/3800
ENDIF
 
SETLCD 0,1,CHR$(1)  ' clear screen
SETLCD 1,1,"Select Current     "
SETLCD 2,1,"Current =" +str$(j) +"      "  ' add spaces to erase old displayed data.
SETLCD 4,1,"Press Enter"

However, in the above case, when X > 3800, j will be set to zero and displayed as zero on the LCD.