Introduction to Add-On InstructionsAugust 20, 2020 by Dennis Lynch
Learn how to take advantage of this powerful feature that comes standard in Allen-Bradley PLCs.
What is an Add-On Instruction?
An Add-On Instruction (AOI) is a feature introduced by Rockwell Software in version 16 of RSLogix 5000 programming software for Controllogix and CompactLogix PLCs. An AOI enables a user to develop and package PLC code in user-defined instruction that is reused through-out their program.
The reused code appears as a simple instruction or function block, much like many of the built-in instructions included in the RSLogix 5000 software. Traditional, non-PLC programmers may find an AOI analogous to a function in other programming languages.
Advantages / Disadvantages of Add-On Instructions
There are numerous advantages of Add-On Instructions:
- AOIs allow you to develop and test code and then reuse it throughout your program and even across multiple PLC programs. This can reduce errors and promote consistency.
- If a mistake is found or enhancement is needed after implementing an AOI, updates can be made to the AOI definition or logic and all instances of the AOI may be updated.
- Logic can appear simplified when using an AOI as it appears in the logic as one instruction or function block instead of many lines of code, rungs, or function blocks.
- The AOI can be shared across projects by exporting the AOI, which can then be imported into another project.
- If source protection is enabled, the code inside the AOI can be protected from view or changes in the case of proprietary code.
- The AOI has built-in revision tracking and can be locked from editing.
- The AOI can include documentation and help for users.
Some disadvantages Add-On Instructions are:
- You cannot edit AOIs online. All edits must be made offline and downloaded to the PLC.
- There is a slight increase in the amount of memory used with AOIs when compared to the amount of memory used with the equivalent logic outside of an AOI.
- Not all built-in instructions can be used in an AOI. Although most built-in instructions are available, there is a handful that is not.
More complex code such as this ladder logic runs inside a simplified AOI structure.
How to Create an Add-On Instruction
Creating an AOI is a fairly straightforward procedure, but before jumping in and programming the designer should carefully formulate a plan and work out the framework and logic “on paper” before starting the configuration in the software.
There are four main parts that need to be configured, with several, optional, steps that can be completed to enhance and polish the AOI. The first step in creating an AOI definition is naming the AOI and choosing which type of PLC programming language the AOI will be written in.
The AOI can be one of three types: Ladder diagram, function block, or structured text. This first step is configured under the General tab in the instruction's definition as shown below. Optional information such as description, revision, revision notes, and vendor are also part of the configuration under this tab.
Add-On Instruction General tab. Image courtesy of Rockwell Automation.
The second part that needs to be configured when creating an AOI is the external parameters that will pass from/to the AOI. These are configured on the Parameters tab as shown below.
Here you will define the input and output parameters name, data type, and default value. This step does not necessarily have to be done before creating the logic, as you will have the opportunity to create the parameters as you create the logic, but it can be beneficial to do so before creating the logic.
Add-On Instruction Parameters tab. Image courtesy of Rockwell Automation.
Once the external parameters have been created, the next logical step would be to create the logic that will run inside the AOI. The logic, whether it is ladder, function block, or structured text will reference the parameters created in the second step and perform the logic function as programmed.
At this point, local tags are also created/configured as the logic is entered into the configuration of the AOI. Local tags will not be available outside of the AOI and can only be referenced inside the AOI. Local tags will include instruction tags, constants, and other variables needed to perform the logic as programmed.
The logic inside an AOI can be ladder, function block, or structure text as in the example above.
There are several optional parts of the AOI that the user may or may not choose to configure.
- Scan Modes
- Change History
Although the AOI can only have one logic routine that runs when the AOI is used, the user can configure special scan modes that operate logic on special instances such as Prescan, Postscan, and Fault. These options are configured on the Scan mode tab.
The instruction signature is another optional feature that can be configured. The instruction signature tracks the revision history of the instruction and creates a timestamp and signature ID that can be used to determine if an AOI has been modified.
The change history, although technical, not optional, has no user-configurable parameters. It simply tracks the last change that was made to the instruction and displays the Windows user name and date/time of the change.
The AOI has built-in documentation or a help feature that is optional, but highly recommended feature to take advantage of. The designer of the AOI can document the instruction for later recall by the user of the instruction. The help configuration is fairly free form and allows the designer a standard text editor to display the help of the instructions. The Help configuration tab can be seen in the picture below.
Add-On Instruction Help configuration tab. Image courtesy of Rockwell Automation.
Is An Add-On Instruction Right for your Program?
Although the AOI is a very powerful and versatile feature, it is not right for every application. Add-On Instructions work great when there is a specific, repetitive piece of logic that will be used in multiple places in a program or throughout a facility. An AOI is not typically the right tool for rare complex logic that is only to be used once in a program or at a facility.
The exception to this would be in the case where the designer would like to protect their logic or package it in a more user-friendly shell. Add-On Instructions cannot be created online and needs to be extensively tested before being used and disseminated to other projects or to be used by coworkers. Although changes are possible, the consequences of the changes and the process for the changes are not as easy as other normal changes that can be made online in the PLC. This article is merely a brief introduction to Add-On Instructions and hopefully will get you motivated to try using them.
For a more in-depth complete overview and reference, see Allen-Bradley publication 1756-PM010I-EN-P “Logix 5000 Controllers Add On Instructions”.