Prescan routine – Rockwell Automation Logix5000 Controllers Add-on Instructions Programming Manual User Manual

Page 51

Advertising
background image

Defining Add-On Instructions

Chapter 2

Prescan routine

When the controller transitions from Program mode to Run mode or when the

controller powers up in Run mode, all logic within the controller is executed in
Prescan mode. During this scan, each instruction may initialize itself and some

instructions also initialize any tags they may reference. For most instructions,

Prescan mode is synonymous with scanning false. For example, an OTE

instruction clears its output bit when executed during Prescan mode. For others,
special initialization may be done, such as an ONS instruction setting its storage

bit during Prescan mode. During Prescan mode, all instructions evaluate false so

conditional logic does not execute.

The optional Prescan routine for an Add-On Instruction provides a way for an
Add-On Instruction to define additional behavior for Prescan mode. When a

Prescan routine is defined and enabled, the Prescan routine executes normally

after the primary logic routine executes in Prescan mode. This is useful when you

want to initialize tag values to some known or predefined state prior to execution.
For example, setting a PID instruction to Manual mode with a 0% output prior to

its first execution or to initialize some coefficient values in your Add-On

Instruction.

When an Add-On Instruction executes in Prescan mode, any required parameters

have their data passed.

• Values are passed to Input parameters from their arguments in the

instruction call.

• Values are passed out of Output parameters to their arguments defined in

the instruction call.

These values are passed even when the rung condition is false in Ladder Diagram
or when the instruction call is in a false conditional statement in Structured Text.

When Function Block Diagram routines execute, the data values are copied to all

wired inputs and from all wired outputs, whether or not the parameters are
required.

Follow these steps to create a Prescan routine.

1. In the Controller Organizer, right-click an instruction and select Open

Definition.

2. Click the Scan Modes tab.

Rock well Automati on Publication 1756- PM010F-EN-P - Oct ober 2014

51

Advertising