Download 940 Position Servo (V1) Programming manual

Transcript
IF Structure
The “IF” statement is used to execute an instruction or block of instructions one time if a condition is true. The
simplified syntax for IF is:
IF condition
…statement(s)
ENDIF
The following flowchart and code segment illustrate the use of the IF statement.
Start
…statements
IF IN_A2
OUT2 = 1
MOVED 3
ENDIF
Input1 ON?
Yes
Set Output 2 ON
Move Distance 3
inches
NO
..statements
End
s821
IF/ELSE Structure
The IF/ELSE statement is used to execute a statement or a block of statements one time if a condition is true and
a different statement or block of statements if condition is false.
The simplified syntax for the IF/ELSE statement is:
IF <condition>
…statement(s)
ELSE
…statement(s)
ENDIF
The following flowchart and code segment illustrate the use of the IF/ELSE instruction.
…statements
Start
IF IN_A2
OUT2=1
MOVED 3
ELSE
OUT2=0
MOVED 5
ENDIF
Input1 ON?
No
Yes
Set Output 2 ON
Move Distance 3
inches
Set Output 2 OFF
Move Distance 5
inches
End
s822
..statements
WAIT Statement
The WAIT statement is used to suspend program execution until or while a condition is true. The simplified syntax
for this statement is:
WAIT
WAIT
WAIT
WAIT
UNTIL <condition>
WHILE <condition>
TIME <time>
MOTION COMPLETE
PM94P01B
37