User Programs carry out complex sequences of commands on the RMC without requiring intervention from a PLC or other controller. This allows the RMC to respond to events within the control-loop time rather than the scan rate of a PLC. It also reduces the PLC programming required. The number of User Programs is only limited by the memory capacity of the RMC. Use the Verify Results window to find how much memory the User Programs are using.
Each User Program can contain any number of steps. Each step can issue commands, and link to another step. Wizards make creating links easy, or you can create your own complex link types.
Use variables to make User Programs flexible, and to easily influence them from a PLC. Perform math operations and assign values to tags and variables with expressions. You can use tag names in the Command Parameters, Link Types, and in the Expression (113) command to make the user programs very readable.
User Programs can be started by issuing the Start Task (90) command, or from the Program Triggers.
Tasks
User Programs run on Tasks. One User Program can run per Task. The RMC75 has up to four Tasks and therefore, up to four User Programs can run simultaneously. The RMC150 has ten Tasks and therefore, ten User Programs can run simultaneously. The RMC200 CPU20L has 32 tasks and the CPU40 has 64 tasks. To start a User Program, issue the Start Task (90) command. It starts the specified User Program on the specified Task. A User Program can also be started on a Task from within a User Program or from the Program Triggers. For more details, see the Running User Programs topic.
Steps for Creating and Running a User Program
Create and edit a User Program
Verify the User Program
Download the User Program
Run the User Program
Structure of User Programs
A User Program consists of multiple steps. Each step can execute several commands on one or several axes. The series of steps are linked together in sequences. Each step takes one loop time to execute. Therefore, the RMC controller can process a maximum of one step per User Program per loop time.
Each step consists of Actions and a Link:
Step Actions
The step actions are performed as soon as the task processes the step. The following actions can be performed in a user program step:
Command(s)
A step can issue any of the RMC commands. A maximum of one non-immediate command per axis can be issued in a single step (motion commands are an example of non-immediate commands). There is no limit to the number of immediate commands (aside from timing constraints), such as the Expression (113) command, that can be issued per step.
Commanded Axes
Each command in a step may be issued to one or several axes simultaneously. Each command in a User Program (except the Expression command, as described below), has a Commanded Axes section to define which axes the command should be issued to.
Expressions
The Expression (113) command can be used to perform mathematical calculations within the user program steps.
Declarations
Local variables can be declared in a step. These variables can only be accessed within the step and are not retained after the user program jumps to another step, even if it is to the same step. Local variables can be used in an expression command, in command parameters, or in link conditions.
Step Link Type
The Link Type specifies when to jump to the next step and which step to jump to. For example, a link type can wait until the axis is in position before going to the next step, or wait a certain amount of time. You can also define a complex link condition by entering a mathematical expression. See the Link Type topic for details.
Example:
This User Program makes Axis 0 move to 10 in, waits until it gets into position, turns on a discrete output for 5 seconds, then ends. The link condition in step 0 is easily created with a wizard.
Step and Condition Execution Details
When a step is executed, the commands in that step are issued in that loop time. Then, in the next loop time of the controller, the Link Type is evaluated. When the Link Type condition becomes true or tells the program to jump, the program will jump to the specified step and issue the commands in that step in the same loop time that the condition became true.
Expressions
The Expression command makes the User Programs very powerful. The Expression (113) command can only be used in User Programs. It can be used for mathematical calculations and to assign values to tags or variables.
There is no limit to the number of Expression commands that can be issued per step in the User Programs.
Local variables can be declared in a step. These variables can only be accessed within the step and are not retained after the user program jumps to another step, even if it is to the same step. Local variables can be used in an expression command, in command parameters, or in link conditions.
Importing and Exporting User Programs
User Programs can be exported to a file to be imported later into another project. When exporting a User Program, all the variables and tags it uses are included. When importing the User Program, a dialog guides you in assigning the variables and tags to the new project.
See the Exporting and Importing User Programs for details.
If you simply wish to copy a User Program from one project into another without including the variables and tags, you can use standard copy and paste functions.
Disabling User Programs
User programs can be disabled. Disabled user programs will be downloaded to the RMC, but will not be able to be run. Disabling user programs is useful if you want to keep a user program in the project for reference or later use even if it has errors.
To enable or disable a user program, right-click the program in the project pane and choose Disable program or Enable program. You can also use the Programming Properties dialog to disable and enable programs.
Copyright © 2024 Delta Computer Systems, Inc. dba Delta Motion