Code Generation Option for Non Template Robots
With the Add Robot... dialog, you can create a program and call the robot instance and its corresponding task automatically.
Step |
Action |
---|---|
1 |
For Node type (1), select Non Template. |
2 |
For Generate POU instance (2), select Yes. ![]()
|
If you select the Generate POU instances option, the three following elements are added to your project:
oA call program SR_Call_<Robot Name> (PRG) is added to your project.
oA corresponding task TASK_SR_Call_<Robot Name> is added to your project.
oThe POU call of the call program SR_Call_<Robot Name> (PRG) within the task is added to your project.
After the automatic generation procedure by the system, the project can be build and downloaded to the controller.
NOTE: Once a robot node has been added to the Module structure, the node type cannot be modified. For further information about using the code generation option, refer to chapter Call Robot in Your Program.
Trigger for Program Call Regeneration
The most efficient way to exchange data with the robot is via ModuleInterface.
For details, refer to Data Exchange with ModuleInterface.
Regeneration Trigger
If you added / deleted variables within the ModuleInterface dialog and then entered the Configuration data object under <Robot Name>, the call program SR_Call_<Robot Name> (PRG) is regenerated with the modified ModuleInterface variables.
The regeneration procedure implies the following for the program SR_Call_<Robot Name> (PRG):
oVariable declaration is adapted because of adding / deleting variables (1).
oCall of robot is adapted because of adding / deleting variables (2).
Adding User-Specific Code to the SR_Call_<Robot Name> Program
Additional user-specific variables
Define additional user-specific variables in the declaration part of the SR_Call <Robot Name> program:
Additional user-specific code
Only integrate additional user-specific code in the body of the generated program call at the following positions:
oBefore the generated code part (1) or
oAfter the generated code part (2)
After code regeneration, the declaration is slightly different because there is only one section per variable type:
oThe section of the user-defined local variables is merged with the section of the generated local variables.
oThe other variable type sections (VAR_INPUT, VAR_OUTPUT, VAR_IN_OUT, …) remain unchanged.
The body part remains unchanged after code regeneration if the following considerations are observed for additional code implementation:
Restrictions Regarding Program Call Regeneration
Do not modify the system generated declaration and implementation of the code snippets.
This is essential for program call regeneration of the generated code.
Do not modify this generated variables block.
Do not modify this generated body block (including the two comment lines).