Topic: DMD0084

WHILE - Loop While Condition is Non-Zero


The Loop While Condition is Non-Zero (WHILE) instruction begins a While/Wend loop in which the rungs ladder logic instructions between the While instruction and the enclosing Wend instruction will be executed as long as the value in the ending Condition location is Non-Zero (OFF).

 

 

While/Wend loops can be nested, and there is no limit to how deep the nesting can go.

 

Note: All of the looping instructions are 'power-rail' instructions. Even though the instructions are displayed in the left-most column of the ladder diagram (the power rail), they are created in the right-most column of the ladder logic diagram (the output column). Creating these instructions in Do-more Designer is a bit counter-intuitive because the first step is to position the edit cursor in the output column of the ladder logic diagram (the far right) instead of positioning it against the power rail (the far left).

 

Note: All of the looping instructions are unconditional so they will run any time the code-block in which they reside is enabled. The preferred method for making them conditional is to place the loop in a Task code-block and use the Enable Task (ENTASK) instruction to run the loop whenever required.

 


Parameters:

Note: Use the F9 key (Element Browser) or Down-Arrow key (Auto-Complete) at any time to see a complete list of the memory locations that are valid in the current field of the instruction.

 

Condition - designates a location that contains the value used to terminate the While/Wend loop. This value can be any constant value, any readable bit location, or any numeric location.

 


Status Display:

 

The WHILE instruction will show the current .TimeSlice value of the Program or Task when status is ON.

 


See Also:

 


Rung Example: