Motion Coordinator Technical Reference Manual
Programming 7-5
Selection
Selection
Commands that enable us to selectively execute instructions depending on
certain criteria being met.
Example:
IF
we have made a complete batch
THEN
stop the machine
Trio BASIC Instructions:
IF … THEN … ELSE … ENDIF
ON ... GOTO
ON ... GOSUB
Iteration
To repeatedly execute one or more commands automatically, either for a
specified number of times, or until a certain condition is met or event occurs.
Example
REPEAT
GOSUB index_conveyor
UNTIL IN(product_sensor)=ON
Trio BASIC instructions:
FOR … TO … STEP … NEXT
REPEAT … UNTIL
WHILE … WEND
FOR..NEXT Statements
The
FOR .. NEXT
commands are used to create a finite loop in which a variable is
incremented or decremented from a value to a value.
Example:
FOR t=1 TO 5
PRINT t;" ";
NEXT t
PRINT "Done"
The output to the screen would read:
1.0000 2.0000 3.0000 4.0000 5.0000