omron — DO program instruction

DO program instruction DO program instruction Syntax DO Function Introduce a DO program structure. Usage Considerations The DO program structure must be concluded with an UNTIL instruction. Details The DO structure provides a way to control the execution of a group of instructions based on a control expression. The syntax for the DO structure is as follows: DO group_of_steps UNTIL logical_expression Processing of the DO structure can be described as follows: 1. The group of instruction steps is executed. 2. The logical expression is evaluated. If the result is FALSE, return to item 1. Otherwise, proceed to item 3. 3. Program execution continues at the first instruction after the UNTIL step.

When this structure is used, it is assumed that some action occurs within the group of enclosed instructions that changes the result of the logical expression from TRUE to FALSE when the structure should be exited. Alternately, logical_expression can be replaced with an expression that evaluates the state of a digital I/O signal (see example). Note that the group of instructions within the DO structure is always executed at least one time. (The WHILE structure differs in that respect.) There do not need to be any instructions between the DO and UNTIL instructions.

When there are no such instructions, the UNTIL criterion is continuously evaluated until it is satisfied, at which time program execution continues with the instructions following the UNTIL instruction. Example The following example uses a DO structure to control a task that involves moving parts from one place to another. The sequence assumes that the digital signal line buffer.full changes to eV+Language Reference Guide, v2.x, 18319-000 Rev A Page 181