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:
- In theController Organizerpane, expand theAssetsfolder, right-click theAdd-On Instructionfolder, and chooseNew Add-On Instruction.TheNew Add-On Instructiondialog box opens.
- Type a name for the instruction.
- If in a safety controller project, choose the class for the instruction:SafetyorStandard.
- Select the programming language for the definition logic (this can only be ladder diagram for Safety Add-On Instructions).
- (optional) Complete theExtended Text,Revision Note, andVendorfields.
- ClickOK. The Add-On Instruction Definition dialog box opens. The General tab is completed with the information specified in the previous steps.
- Click theParameterstab.
- InName, type the name of the parameter.
- InUsage, selectInput,Output, orInOut.
- 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.
- InAlias Foridentify 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 Foris not available for InOut parameters.
- InData Typeidentify 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 Typeis not available for members of the InOut parameters and the alias parameters.
- InDefaultidentify 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.
- InStyleidentify the style displayed on the faceplate for this parameter.The Style value is read-only for members of the InOut parameters.
- InReqidentify whether the parameter requires an argument.Reqis selected and read-only by default for the InOut parameters because by-reference parameters require an argument.
- InVisspecify whether the parameter is visible on the Ladder Diagram and Function Block Diagram instructions when the Add-On Instruction is called.Visis selected and read-only ifReqis selected. However, the Visible function is not applicable for members of InOut parameters.(optional)InDescriptiontype a description for the parameter. If a Parameter does not have a description, the description of the data type is passed through if available.
- InExternal Accessselect whether the tag has Read/Write, Read Only, or no access (None) from external applications such as HMIs.
- InConstantselect 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.
- Click theLocal Tagstab. Configure this tab if the Add-on instruction will be referencing local tags. Complete the settings as appropriate.
- (optional) Click theScan Modestab. Use this tab to configure custom scan modes as needed.
- Click theSignaturestab. 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.
- ClickOKto save the Add-on Instruction.
Provide Feedback