Creating add-on instructions

Add-On Instructions are user-defined instructions that are used to contain commonly used logic as sets of instructions. This enables easy reuse of these instructions in projects and promotes consistency in project development
Create AOI logic using the standard Ladder, Function Block Diagram, and Structured Text language already available in the Logix Designer application. When created, an Add-On Instruction can then be used in any of the Logix Designer application routines.
Add-On Instructions support source protection to limit a user of an instruction to read-only access or to allow no access to the internal logic or local tags used by the instruction. This prevents unwanted changes to the instruction as well as protects intellectual property.
To provide Add-On Instructions with the same flexibility as built-in instructions, optional scan mode routines can be configured that let you fully define the behavior of the instruction. The default behavior for executing an Add-On Instruction with no optional scan routines created may be sufficient for the intended operation of the instruction.
If creating an Add-on instruction composed of commonly-used safety logic designate it as a safety Add-On Instructions. In addition to the instruction signature used for source protection, safety Add-On Instructions include a safety instruction signature ID for use in safety-related functions.
To add a new Add-On Instruction:
  1. In the
    Controller Organizer
    pane, expand the
    Assets
    folder, right-click the
    Add-On Instruction
    folder, and choose
    New Add-On Instruction
    .
    The
    New Add-On Instruction
    dialog box opens.
  2. Type a name for the instruction.
  3. If in a safety controller project, choose the class for the instruction:
    Safety
    or
    Standard
    .
  4. Select the programming language for the definition logic (this can only be ladder diagram for Safety Add-On Instructions).
  5. (optional) Complete the
    Extended Text
    ,
    Revision Note
    , and
    Vendor
    fields.
  6. Click
    OK
    . The Add-On Instruction Definition dialog box opens. The General tab is completed with the information specified in the previous steps.
  7. Click the
    Parameters
    tab.
    1. In
      Name
      , type the name of the parameter.
    2. In
      Usage
      , select
      Input
      ,
      Output
      , or
      InOut
      .
      • Input and Output parameters must be atomic data types only. Inputs and Outputs are passed by value.
      • InOut parameters are atomic or complex (that is, structures or arrays) data types. InOut parameters are always passed by-reference.
    3. In
      Alias For
      identify the local tag or its member for which you want the parameter to be an alias.
      For the Add-On Instruction definition, only Input and Output tags can alias local tags. Local tags and InOut tags cannot alias another tag. You can have only one input and one output alias per local tag.
      Alias For
      is not available for InOut parameters.
    4. In
      Data Type
      identify the parameter data type.
      Input and Output parameters are atomic data types only. During an Add-On Instruction call, Input and Output parameters are passed by value. InOut parameters are atomic or complex data types (that is, structures or arrays). InOut parameters are always passed by reference.
      Data Type
      is not available for members of the InOut parameters and the alias parameters.
    5. In
      Default
      identify the default value that is set when an Add-On Instruction of this type is instantiated. This defines the default values that initially come from the data type.
      Default values are not applicable to InOut parameters or their members because InOuts are passed by reference.
    6. In
      Style
      identify the style displayed on the faceplate for this parameter.
      The Style value is read-only for members of the InOut parameters.
    7. In
      Req
      identify whether the parameter requires an argument.
      Req
      is selected and read-only by default for the InOut parameters because by-reference parameters require an argument.
    8. In
      Vis
      specify whether the parameter is visible on the Ladder Diagram and Function Block Diagram instructions when the Add-On Instruction is called.
      Vis
      is selected and read-only if
      Req
      is selected. However, the Visible function is not applicable for members of InOut parameters.
      (optional)In
      Description
      type a description for the parameter. If a Parameter does not have a description, the description of the data type is passed through if available.
    9. In
      External Access
      select whether the tag has Read/Write, Read Only, or no access (None) from external applications such as HMIs.
    10. In
      Constant
      select to define the parameter as a constant. When program logic is executed, constant values are not changed. If a logic routine tries to write to a constant tag, the routine will not verify.
  8. Click the
    Local Tags
    tab. Configure this tab if the Add-on instruction will be referencing local tags. Complete the settings as appropriate.
  9. (optional) Click the
    Scan Modes
    tab. Use this tab to configure custom scan modes as needed.
  10. Click the
    Signatures
    tab. Use this tab to generate a Signature ID and seal the Add-On Instruction from edits. A Safety Signature ID is included if the add-on instruction was created as a safety Add-On Instruction.
  11. Click
    OK
    to save the Add-on Instruction.
Provide Feedback
Have questions or feedback about this documentation? Please submit your feedback here.