Author Topic: number display question  (Read 10157 times)

karen

  • Newbie
  • Posts: 18
  • I love YaBB 1G - SP1!
    • View Profile
number display question
« 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



« Last Edit: December 31, 1969, 04:00:00 PM by 1076562000 »

support

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3174
    • View Profile
    • Internet Programmable PLCs
Re: number display question
« Reply #1 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.
« Last Edit: December 31, 1969, 04:00:00 PM by 1076562000 »
Email: support@triplc.com
Tel: 1-877-TRI-PLCS