Sn: if, Words, Scanned event – 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 283

Advertising
background image

Language Reference • Reference

261

Publication 1398-PM601A-EN-P — October 2000

WORDS

Sn: IF

Scanned Event

Scanned Event

Purpose

The scanned event IF statement is used in the same way as a normal IF statement but is
preceded by Sn: , where n is a number from 1 to 8. These conditions are checked at
every step of the program. If the scanned event is enabled AND the condition is found
to be true, the specified action is taken.

Syntax

Sn: IF condition action

n

The number of the scanned event. There are eight scanned
events: n = 1, 2, 3, .... , 8.

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 deter-
mine 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
variables, 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

action

The program statements in a scanned event routine can be any
legal program statement(s) except CALL, RETURN, JUMP,
MOVD, MOVP, DV, DIF, DELAY, DWELL, PRINT, READ,
ENABLE, and DISABLE statements. Multiple statements can
be enclosed in curly braces {}.

Remarks

To detect a transition of an input with a scanned event, the keyword EDGE is used
with the IF statement. This will detect the transition of the input from OFF to ON,
rather than just the ON state. EDGE can only be used in a scanned event.

Scanned events are enabled in the program by Sn ON/OFF statements. Once a scanned
event has occurred, it will not be recognized again until the condition has gone false
and then true again or until another Sn ON statement is executed. Sn: routines must
be placed before the main body of a program after any ASSIGN or TITLE statements.

See Also

Sn: TMRm, Sn ON/OFF/CONT

Example

S1: IF I13 EDGE ON V11 = PCMD

S2: IF POS1 > = G10 04 = ON

S8: IF I5 ON

{IF I9 ON 03=ON

ELSE 03=OFF

}

Advertising