Scanned event (sn) instructions, Sn:if condition action – 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 169

Advertising
background image

IQ Programming Structure • Scanned Event (Sn) Instructions

147

Publication 1398-PM601A-EN-P — October 2000

TUTORIAL

Scanned Event (Sn) Instructions

Scanned event instructions establish conditions that are scanned on a regular basis. Once established,
the scanned event can be enable and disable in the main body of the application program. If the condi-
tion is true, and the scanned event is enabled, when scanned, the specified action is executed.

Scanned events are used to record events and perform actions independent of the main body of the pro-
gram. For example, if you want an output to come ON when the position is greater than 4 inches, or if
you need to turn an output ON whenever input 13 and 14 are ON, you may use the following scanned
event statements.

S1: IF POS1 > 4 O3 = ON

S2: IF (I13 AND I14 = ON) O4 = ON

Scanned events may also be used with timers to time an event or perform an action after an event and
specified time delay.

The program statements contained in the action portion of a scanned event instruction can be any legal
program statement except subroutine calls, DO/WHILE, WHILE, WAIT, CLR, PRINT, READ, LOOP,
JUMP or motion statements. Motion statements include MOVD, MOVP, DV, DIF, DELAY, and
DWELL.

Scanned event routines must be placed before the main body of a program and after any ASSIGN or
TITLE statements.

Sn:IF condition action

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. The condition may be any of the conditions described for the IF
statement. If the scanned event is enabled, the condition is checked during program execution, if the
condition is found to be true, the specified action is taken. Scanned events are enabled in the program by
Sn ON/OFF/CONT statements.

If enabled with Sn CONT the scanned event will be executed every time the scanned event is tested and
the condition is found to be TRUE. If the keyword EDGE is used with a scanned event testing inputs,
the condition is only found to be TRUE when there is a transition on the input.

If enabled with Sn ON the scanned event will execute the first time the condition is TRUE. If the key-
word EDGE is used with a scanned event testing inputs, the condition is only found to be TRUE when
there is a transition on the input.

S1: IF I13 EDGE ON V11 = PCMD

S2: IF POS1 > = G10 04 = ON

ON variable label1,
label2,

Multi-dimensional branch

RETURN

Return from a subroutine

SUB

Define a subroutine

WAIT

Wait till a condition is true

WHILE

Execute while a condition is true

Note: Each program may contain up to 8 scanned events. The scan time of a scanned event is
not fixed as it is in a programmable logic controller. The frequency of the scanned event is
influenced by other factors such as printing to the operator terminal, the number of scanned
events, etc. Scan time is 2 milliseconds minimum.

Name

Description

Advertising