Mitsubishi QD51 Programming Manual page 570

Logic controller
Hide thumbs Also See for QD51:
Table of Contents

Advertisement

11 INSTRUCTIONS AND FUNCTIONS
WHILE WEND
• These instructions are used to execute the group of instructions between WHILE and
WEND repeatedly, while the specified condition holds.
WHILE <expression>
Syntax
WEND
expression
WHILE K>5
Examples
to
WEND
• The WHILE to WEND instructions are used to execute a selected processing under a
Description
given condition. The group of instructions from the WHILE instruction to the WEND
instruction are executed repeatedly while the condition specified in <expression> holds.
• A pair of WHILE and WEND instructions constitute one loop together.
The difference from the FOR to NEXT instructions is instead of specifying the number of
repetitions of the execution, a condition for repeated execution is specified.
• If the value of <expression> is True (any other value than 0), the instructions from the one
immediately after the WHILE until the WEND instruction are executed and then the
execution returns to the WHILE instruction to evaluate <expression> again. This routine is
repeated while the value of <expression> is True. If the value of <expression> is False (0),
the instruction immediately after the WEND instruction is executed.
• The repeated processing between the WHILE to WEND instructions is stopped if a GOTO
or RESUME instruction is executed inside the WHILE to WEND loop in an error handling
routine.
• Lines where WHILE or WEND instructions are written can be specified as the branch
destination of a GOTO instruction, etc.
• It is possible to write the WHILE to WEND instructions within a loop created by another pair
of WHILE-WEND instructions.
• When using more than one pair of WHILE to WEND instructions, take precautions so that
the inner WHILE to WEND loop is completely contained within the outer loop.
(Correct)
11 - 400
Instruction
WHILE to While END
WHILE
WHILE
:
WEND
WEND
• • • •
Specify the condition under which the instructions
enclosed by the WHILE to WEND instructions are
executed repeatedly.
• • • •
Repeats the instructions between the WHILE to
WEND instructions as long as the value of K is
greater than 5.
(Incorrect)
WHILE
WHILE
:
WEND
WEND
MELSEC-Q
11 - 400

Advertisement

Table of Contents
loading

This manual is also suitable for:

Ad51h-s3Qd51-r24A1sd51s

Table of Contents