Welcome, Guest
Username Password: Remember me
  • Page:
  • 1

TOPIC: while command

while command 2 years, 8 months ago #1385

Hi
I like to use the while command as follow

while( a and not b)
....
loop

but the sm2 interface does not allow me to do that.
May I know what is the possible work around?
Thank you very much

Re: while command 2 years, 8 months ago #1387

  • csearcy
  • OFFLINE
  • Posts: 480
  • Karma: 23
If you have firmware version 5.0x or above, you can do math operations with more than two operators. If you are using firmware less than 5.0x, the math is has to be done with only two operators.
In either case, it may be easier to use another variable. Something like the following would work with any firmware revision.

WHILE c
'solve the value for c with IF/ENDIF statements
IF a==1
If b!=1
c=1
ELSE
c=0
ENDIF
ENDIF
....
LOOP
Last Edit: 2 years, 8 months ago by csearcy.

Re: while command 2 years, 8 months ago #1389

Hi Csearcy
Thank you very much for your advise.
I need to modify a bit of your suggestion so that is suits my application.

c=1
WHILE c
'solve the value for c with IF/ENDIF statements
IF a==1
IF b!=1
c=1
ELSE
c=0
ENDIF
ELSE
c=0
ENDIF
....
LOOP
  • Page:
  • 1
Moderators: hsummer, csearcy
Time to create page: 0.43 seconds