9 control structures, 1 do/until structure, 2 while structure – Lenze PM94P01C User Manual
Page 45: Programming

PM94P01C
43
Programming
Flag logic is shown herein.
IF
TPOS-INPOSLIM < APOS < TPOS+INPOSLIM && F_MCOMPLETE && F_MQUEUE_EMPTY
F_IN_POSITION = TRUE
ELSE
F_IN_POSITION = FALSE
ENDIF
For VELOCITY mode F_MCOMPLETE and F_MQUEUE_EMPTY flags are ignored and assumed TRUE.
2.9
Control Structures
Control structures allow the user to control the flow of the program’s execution. Most of the power and utility of any
programming language comes from its ability to change statement order with structure and loops.
2.9.1 DO/UNTIL Structure
This statement is used to execute a block of code one time and then continue executing that block until a condition
becomes true (satisfied). The difference between DO/UNTIL and WHILE statements is that the DO/UNTIL instruction
tests the condition after the block is executed so the conditional statements are always executed at least one time. The
syntax for DO/UNTIL statement is:
DO
…statements
UNTIL
The flowchart and code segment in Figure 14 illustrate the use of the DO/UNTIL statement.
… statements
DO
MOVED 3
WAIT TIME 2000
UNTIL IN_A3
…statements
Start
Move DIstance 3
units. Delay 2
seconds
Is input A3 ON?
End
YES
NO
Figure 14: DO/UNTIL Code and Flowchart
2.9.2 WHILE Structure
This statement is used if you want a block of code to execute while a condition is true.
WHILE
…statements
ENDWHILE