User guide
Chapter 1. Programming Fundamentals
25
Flow Control
Expression
Examples
This section provides examples of expressions that can be used in conditional branching and
looping commands (UNTIL, WHILE, and IF) and the WAIT command. These expressions
can be constructed, in conjunction with relational and logical operators, with the following
operands:
• Numeric variables and binary variables • Error, axis, and system status
• Inputs and outputs • Timer and counter values
• Current motion parameters and status • Data read from the serial port (stand-alone)
• Current motor & encoder position (steppers) • Data read from the RP240 (stand-alone)
• Current commanded and actual position (servos) • Following conditions
Numeric and Binary
Variables
A numeric variable (VAR) can be used within an expression if it is compared against another
numeric variable, a value, or one of the comparison commands (see list on page 7). Note that
not all of the comparison commands apply to every 6000 controller. When comparing a
variable against another value, variable, or comparison command, the relational operators (=,
>, >=, <, <=, <>) and logical operators (AND, OR, NOT) are used.
Expression Description
(VAR1<VAR2) True expression if variable 1 is less than variable 2
(VAR1>=2500) True expression if variable 1 is greater than or equal to 2500
(VAR1=1AD) True expression if variable 1 is equal to the decel of axis 1
(VAR1<VAR2 AND VAR4>1PE) True expression if variable 1 is less than variable 2 and variable
4 is greater than the value of encoder 1
A binary variable (VARB) can be used within an expression, if the variable is compared against
another binary variable, or a value. When comparing a variable against another value or
variable, the relational operators (=, >, >=, <, <=, <>) and logical operators (AND, OR, NOT)
are used.
Expression Description
(VARB1<>VARB2) True expression if binary variable 1 is not equal to binary
variable 2
(VARB1=b1101 X111) True expression if binary variable 1 is equal to 1101 X111
(VARB1<VARB2 AND VARB4>hF) True expression if binary variable 1 is less than binary
variable 2 and binary variable 4 is greater than the
hexadecimal value of F
Inputs and Outputs
An input or output operand (IN, INO, LIM, OUT) can be used within an expression, if the
operand is compared against a binary variable or a binary or hexadecimal value. When making
the comparison, the relational operators (=, >, >=, <, <=, <>) and logical operators (AND,
OR, NOT) are used.
Expression Description
(IN.12=b1) True expression if input 12 is equal to 1
(LIM>h3) True expression if limit status is greater than hexadecimal 3
Current Motion
Parameters and
Status
Motion parameters consist of A, AD, D, V, VEL, status MOV. The motion parameters can be
used within an expression, if the operand is compared against a numeric variable or value. The
motion status operand must be compared against a binary variable or a binary or hexadecimal
value. When making the comparison, the relational operators (=, >, >=, <, <=, <>) and
logical operators (AND, OR, NOT) are used. (Following conditions are addressed below.)
Expression Description
(VAR1<1VEL) True expression if the value of variable 1 is less than the
commanded velocity of axis 1
(1AD=25000) True expression if axis 1 deceleration equals 25000
(MOV=b00) True expression if moving status equals ØØ (axes 1 & 2 are not
moving)










