While, Words, While program structure – Rockwell Automation 1398-PDM-xxx IQ Master Version 3.2.4 for IA-2000 and IQ-5000 Positioning Drive Modules, IQ-55 User Manual

Page 302

Advertising
background image

280

Language Reference • Reference

Publication 1398-PM601A-EN-P — October 2000

WORDS

WHILE

While

Program Structure

Purpose

The WHILE condition statement executes the statement(s) repeatedly while the condi-
tion specified is TRUE.

Syntax

WHILE condition statement(s)

condition

The condition to be tested. The condition may be a comparison,
an input being ON or OFF, or a flag being ON or OFF.

Comparisons compare the values of two operands and determine
if the condition is TRUE or FALSE. A comparison may be
greater than (>), less than (<), equal to ( = ), not equal to (<>),
less than or equal to (< = ), or greater than or equal to (> = ). The
operands of a comparison may be user variables, system vari-
ables, analog input values (ADC), or constants.

I1 ON

;an input

F1 ON

;a user flag

INPOSN

;system flag

G1 > G2

;comparison user variable

G1 > POS1

;comparison system variable

POS2 <= 7.00

;comparison constant

statement(s)

Any valid language statement. Multiple statements can enclosed
in curly braces {}.

Remarks

Unlike the Do While statement, the condition is tested before any statement in the loop
is executed. If the condition is FALSE when the loop begins, the loop body is never
executed.

See Also

DO/WHILE, IF

Example

WHILE (POSN<120)

;execute statements while the

{

; position is less than 120

... Statements

}

Advertising