Command Descriptions
157
between the
IF
and the
NIF
are ignored, and command processing continues with the first command
following the
NIF
.
When the
ELSE
command is used in conjunction with the
IF
command, true
IF
evaluations cause the
commands between the
IF
and
ELSE
commands to be executed, and the commands after the
ELSE
until the
NIF
are ignored. False
IF
evaluations cause commands between the
ELSE
and the
NIF
to be executed, and
the commands between the
IF
and the
ELSE
are ignored. The
ELSE
command is optional and does not have
to be included in the
IF
statement.
The
IF(
)..
ELSE
..
NIF
structure can be nested up to 16 levels deep.
NOTE
:
Be careful about performing a
GOTO
between
IF
and
NIF
. Branching to a different location within
the same program will cause the next
IF
statement encountered to be nested within the previous
IF
statement, unless a
NIF
command has already been encountered.
IF
statement programming order:
IF(expression)...commands...NIF
or
IF(expression)...commands...ELSE...commands...NIF
All logical operators (
AND
,
OR
,
NOT
), and all relational operators (
=
,
>
,
>=
,
<
,
<=
,
<>
) can be used within
the
IF
expression. There is no limit on the number of logical operators, or on the number of relational
operators allowed within a single
IF
expression. The limiting factor for the
IF
expression is the command
length.
The total character count for the
IF
command and expression cannot exceed 80 characters.
(e.g., If you add up the letters in the
IF
command and the letters within the
(
)
expression, including the
parenthesis and excluding each space, this count must be less than or equal to 80.)
All assignment operators (
A
,
AD
,
AS
,
ASX
,
D
,
ER
,
IN
,
MOV
,
OUT
,
PC
,
PCE
,
PCM
,
PE
,
PER
,
PMAS
,
SEG
,
SS
,
TIM
,
US
,
V
,
VEL,
VELA,
etc.
) can be used within the
IF
expression.
Multiple parentheses may not be used within the
IF
command.
Example:
IF(IN=b1X0 AND VAR1=1)
; If input 1 is ON, input 3 is OFF, and
; variable 1 equals 1, then the IF statement evaluates
; true, so commands between this statement and NIF
; are executed
TREV
; Transfer revision level
NIF
; End IF statement
IF(A<5000 AND PC>50000)
; If the acceleration is less than 5000, and
; the commanded position is greater than
; 50000, then do the IF statement. Note: The
; acceleration value used is programmed acceleration,
; not actual.
VAR1=VAR1+1
; Increment variable 1
NIF
; End if statement
IF(VEL<123 OR VEL>156)
; If the current velocity is less than 123
; or if it is greater than 156, then do the commands
; following the IF statement
WRITE"Something's Wrong\13" ; Put message Something's Wrong<cr> in output buffer
NIF
; End if statement
IF(OUT=b110X1 AND VAR1<=13)
; If outputs 1, 2 and 5 are ON, output 3 is
; off and variable 1 is less than or equal to 13,
; then set variable 1 equal to variable 1 plus 1,
; else set variable 1 equal to variable 1 minus 1
VAR1=VAR1+1
ELSE
VAR1=VAR1-1
NIF
; End IF statement
www.comoso.com
Summary of Contents for Gemini GV6K
Page 24: ...www comoso com...
Page 40: ...www comoso com...
Page 344: ...www comoso com...
Page 350: ...www comoso com...