Omron trajexia CJ1W-MCH72 Operation Manual page 184

Sysmac cj-series programmable controller
Hide thumbs Also See for trajexia CJ1W-MCH72:
Table of Contents

Advertisement

All BASIC commands
4-2-135 IF..THEN..ELSE..ENDIF
Arguments
value
Any BASIC floating point variable or parameter.
n
The byte number (0 - 3) to be extracted.
Example
a=MPOS AXIS(2)
byte0 = IEEE_OUT(a, 0)
byte1 = IEEE_OUT(a, 1)
byte2 = IEEE_OUT(a, 2)
byte3 = IEEE_OUT(a, 3)
See also
N/A
/i
Type
Program control command
Syntax
IF condition_1 THEN
commands} [ ELSE commands ] ENDIF
IF condition_1 THEN commands
Description
This structure controls the flow of the program based on the results of
the condition. If the condition is TRUE the commands following THEN
up to ELSEIF, ELSE or ENDIF are executed. If the condition is FALSE
and the command of a subsequent ELSEIF substructure is TRUE, the
commands of this substructure are executed. If all conditions are
FALSE the commands following ELSE will be executed or the program
will resume at the line after ENDIF in case no ELSE is included. The
ENDIF is used to mark the end of the conditional block.
Note: IF..THEN..ELSE..ENDIF sequences can be nested without limit.
For a multi-line IF..THEN construction, there must not be any statement
after THEN. A single-line construction must not use ENDIF.
Arguments
condition_i
A logical expression.
commands
One or more BASIC commands.
Example
IF MPOS > (0.22 * VR(0)) THEN GOTO exceeds_length
Example
IF IN(0) = ON THEN
count = count + 1
PRINT "COUNTS = ";count
fail = 0
ELSE
fail = fail + 1
ENDIF
Example
IF IN(stop)=ON THEN
OP(8,ON)
VR(cycle_flag)=0
ELSEIF IN(start_cycle)=ON THEN
VR(cycle_flag)=1
ELSEIF IN(step1)=ON THEN
VR(cycle_flag)=99
ENDIF
commands {ELSEIF condition_i THEN
Section 4-2
173

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents