
Publication LOGIX-AP008B-EN-P - June 2008 57
Logix Features that May Not be Familiar to S7 Users Chapter 2
Add-On Instructions
Add-On Instruction Summary
Add-on Instructions are the equivalent of STEP 7 Function Blocks, with
private data and advanced parameter choices. In particular, the INOUT
parameter type or “pass by reference” makes it possible to efficiently pass data
structures to the code.
Because the Add-On Instruction is so similar to the STEP 7 Function Block, it
is likely that the S7 programmer who is converting to Logix will make use of it
quite readily.
Comparison between FBs and Add-On Instructions:
• Both can be called as named functions from anywhere in the program.
• Both contain a private data area of static data, although it is not truly
private in the case of STEP 7.
• A STEP 7 function block also has a temporary data area.
• In the Add-On Instruction, local static data will do the same.
Both have three types of parameters – input (pass by value), output (pass by
value) and in-out (pass by reference). The pass by reference parameter is a
considerable benefit, since it allows large data structures to be passed
efficiently.
The Add-On Instruction will automatically maintain a change history by
recording a timestamp and the Windows user name at the time of the change.
This is not available with STEP 7 Function Blocks
With the Add-On Instruction a pre-scan routine can be configured to run
when the controller goes from Program mode to Run mode, or powers up in
Run mode. Under these conditions, the pre-scan routine will run once, and can
typically be used to initialise data. In STEP 7 the Organization block OB100
does the same, but the pre-scan code cannot be specifically attached to a FB.
If the Add-On Instruction is called from a SFC step and the SFC is configured
for Automatic Reset, a post-scan routine defined in the Add-On Instruction
will execute once when the SFC exits that step. It could be used for resetting
data. A STEP 7 FB has no built-in equivalent (although it is easy to program).
An Add-On Instruction can have an EnableInFalse routine, which will be
called (if present) when the rung condition at the Add-On Instruction call is
false. In this case, the input and output parameters will pass values. A STEP 7
FB has no equivalent.
Add-on Instructions are explored further in Chapter 4.
Commentaires sur ces manuels