![background image](http://html1.mh-extra.com/html/omron/trajexia-cj1w-mch72/trajexia-cj1w-mch72_operation-manual_742454184.webp)
All BASIC commands
Section 4-2
173
4-2-135 IF..THEN..ELSE..ENDIF
/i
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
Type
Program control command
Syntax
IF condition_1 THEN commands {ELSEIF condition_i 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
Содержание trajexia CJ1W-MCH72
Страница 69: ...Specifications Section 2 4 58...
Страница 83: ...FINS commands Section 3 4 72...
Страница 147: ...All BASIC commands Section 4 2 136 AXIS 1 AXIS 0...
Страница 277: ...All BASIC commands Section 4 2 266...
Страница 278: ...267 SECTION 5 Examples This chapter gives 2 categories of examples and tips How to s Practical examples...
Страница 371: ...360 Index...
Страница 373: ...362...