Create a prescan routine

When the controller transitions from Program mode to Run mode or when the controller powers up in Run mode, all logic in the controller executes in Prescan mode.
During the scan, each instruction may initialize itself and some instructions also initialize any referenced tags. 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 performed, 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.
A prescan routine for the definition of an Add-On Instruction is optional. The routine provides a way for the 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. Prescan mode is useful when initializing tag values to a known or predefined state before execution. For example, set a PID instruction to Manual mode with a 0% output before its first execution or to initialize coefficient values in the Add-On Instruction.
When an Add-On Instruction executes in Prescan mode, the data of any required parameters pass:
  • Values pass to Input parameters from their arguments in the instruction call.
  • Values pass out of Output parameters to their arguments defined in the instruction call.
Values pass even when the rung condition is false in Ladder Diagram. Executing the Function Block Diagram routines copies data values all wired inputs and from all wired outputs, whether the parameters are required.
To create a prescan routine
  1. In the explorer bar, select Library icon
    Library
    .
  2. In
    Library
    , select the Add-On Instruction.
  3. In the definition of the Add-On Instruction, under
    Prescan
    , select
    Create prescan routine
    .
    TIP: If a prescan routine exists for the Add-On Instruction, select
    Delete prescan routine
    to delete the routine before creating a routine.
  4. In
    Create prescan
    complete:
    • Description
      . Enter a description of what the routine performs in the logic.
    • Routine Type
      . Select the language.
  5. Select
    OK
    . The routine appears under the Add-On Instruction in
    Library
    .
  6. To edit the routine, in
    Library
    , expand the Add-On Instruction and select the routine.
Provide Feedback
Have questions or feedback about this documentation? Please submit your feedback here.