Create a module reference parameter
A module reference parameter is an InOut parameter of the MODULE data type that points to the Module Object of a hardware module. You can use module reference parameters in both Add-on Instruction logic and program logic. Since the module reference parameter is passed by reference, it can access and modify attributes in a hardware module from an Add-On Instruction.
Use the module reference parameter in two ways:
- In a GSV or SSV instruction, or an Add-on Instruction, you can use the module reference InOut parameter as the Instance Name or Add-on Instruction parameter.
- In an Add-on Instruction, or in a GSV or SSV instruction, you can pass the module reference InOut parameter into the InOut parameter of another nested Add-on Instruction instruction.
There are several limitations on module reference parameters:
- Module references parameters can only be InOut parameters.
- You can use a module reference parameter only in standard programs and Add-on Instructions, not in Safety programs or Safety Add-on Instructions.
- Program parameters that reference a module must connect to a module, and cannot reference other module reference parameters.
- Module reference parameters must be program or Add-on Instruction scope, not controller scope.TIP:You cannot create a module reference tag. You can only reference modules using an InOut parameter of the MODULE data type.
To create a module reference parameter:
- Create a new parameter in a program or an Add-on Instruction.
- Select InOut Parameter for the Usage.
- Select MODULE for the Data Type.
- Select or enter values for the other fields to define the parameter.
To use a module reference parameter in a GSV or SSV instruction in the Ladder Editor:
- Add the GSV or SSV instruction to a rung in the Ladder Editor.
- Select Module as the Class Name in the instruction.
- In the Ladder Editor, double-click the Instance Name field in the instruction and click the down arrow to display the Module Browser. You can also manually type in the name of the parameter.
- In the Module Browser, double-click the module reference parameter that you want the instruction to reference.
- Select or enter values for the other fields to define the instruction.
To use a module reference parameter in a GSV or SSV instruction in the Structured Text Editor:
- Add the GSV or SSV instruction to a rung in the Structured Text Editor.
- Right-click the instruction name and select Argument List.
- Select Module as the Class Name.
- Select the down arrow in the Instance Name field to display the Module Browser.
- Double-click the module reference parameter or module that you want the instruction to reference.
- Select or enter values for the other fields to define the instruction.You can also right-click between the parentheses following the instruction name and select Browse Devices to display the Module Browser.
To pass a module reference parameter into an Add-on Instruction:
- Double-click the field for the module reference parameter, and click the down arrow to display the Module Browser.
- Select the module reference parameter. If inside an Add-on Instruction, when calling a GSV/SSV or nested Add-on Instruction that takes a module, clicking the module field shows a list containing only the outer Add-on Instruction's module reference parameters.
Provide Feedback