Creating User Programs

Follow the steps below to create a User Program. For example user programs, see the Programming Examples Overview topic.

 

Note:
In order to run User Programs or the Program Triggers, the RMC must be in RUN mode. See the RUN/PROGRAM Mode topic for details.

Basics of Creating a User Program

Create a User Program

  1. In the Project Pane, expand the desired controller, expand the Programming node, right-click User Programs and choose New Programs.

  2. Enter a name for the program. Names are limited to 64 characters.

  3. If desired, change the Program Number.

  4. Click Finish. The Step Editor will open with the new user program. The user program will appear in the Project pane, under Programming and User Programs.
     

Now you can use the instructions below to add steps and commands, do any additional editing, and download the user program.

Add a Program Comment

To add a comment for the entire program, right-click anywhere in the program and choose Edit Program Comment. Enter a description of the program and click Save.

Add Steps

You may add steps to a User Program at any time. On the Step Editor menu, click the Insert Step button. Or, right-click the space below the step number and choose Add Step Before or Add Step After. To add a step to the end of the program, right-click the empty space below the last step and choose Append Step.

Edit the Step

See the Editing a Step section below.

Verify the Program

After you have created the program you must verify it before downloading it and running it. See the Verify topic for instructions. After creating and verifying a User Program,  the next step is to download it before running it on the RMC.

Editing a Step

You may edit the steps at any time. For each step in the User Program, do any of the following:

Add Commands

Each step can have multiple commands and can issue any of the RMC commands. A maximum of one command per axis can be issued in a single step. However, there is no limit to the number of immediate commands that can be issued per step. Immediate commands include the Expression (113) and discrete I/O commands. The RMC controller can process a maximum of one step of a User Program per Task per loop time. A step is not required to have a command.

  1. Add a Command to the Step

Immediate Commands

A maximum of one non-immediate command per loop time can be issued to each axis. There is no limit to the number of immediate commands that can be issued to an axis per loop time.

To determine whether a command immediate, see the List of Commands.

  1. Enter the Command Parameters

If the command has any parameters, enter their values. In most parameters, you may enter a number, tag, or an expression. If you use a tag name, register, or expression, it must evaluate to the data type required by the parameter, typically a REAL.

Tip:
For help on the command's parameters, click the command box and press F1.

  1. Selecting Commanded Axes

The Commanded Axes specifies which axes to issue the command to.

Important: A maximum of one non-immediate command per axis can be issued in a single step. If you try to issue more than one command to an axis per step, the verify will report an error and you will not be able to download the programs.

Add Expressions

To add expressions to a step, choose the Expression (113) command. Local variables can also be declared in a user programs step. To add a local variable to a user program step, on the Step Editor toolbar, click the Add Step Declarations button. Or, right-click the step and choose Add Step Declarations. See Local variables for more details.

Select a Link Type

The Link Type specifies when the program will jump to another step, and which step it jumps to. A step can jump to any step in the current user program, or to any labeled step in another user program.

Select one of the Link types in the Link Type box:

The Jump destinations can contain a step number, a step label, ”Wait”, ”Next”, or "Repeat":

To add, delete, or re-order link conditions in a Conditional Jump link type, use the Condition buttons on the Step Editor toolbar ( ).

Add a Step Comment

If you wish, you may add a comment to the step. Comments help you keep track of what the step is for and what it does.

Add a Step Label

If you wish, you may add a label to the step. Labels can be used when specifying the step to jump to. See the labels topic for details on labels.

To browse all the labels in a project, use the Browse Labels dialog.

Assigning labels to every step is not good programming practice.

Additional Tasks

Adding, Deleting and Moving Steps

When adding and deleting steps, the Step Editor automatically updates the Link Jump To numbers so that they jump to the same step that they did before the add or delete. For example, if step 3 has a Jump To number of 4, and you insert a step before step 3, then the old step 3 becomes the new step 4. Its Jump To number is automatically changed from 4 to 5.

If a deleted step was linked to with a number from some other step, a warning will appear in the Output window.

Adding, Deleting and Moving Commands

Deleting a Step or Program Comment

Showing and Hiding All Comments

Renaming User Programs

In the Project pane, right-click the User Program and click Rename, or select the User Program and press F2.

Assigning Tasks the User Program May Run On

By default, a user program is allowed to run on only one task at a time. This setting is usually sufficient for most applications.

You can change this to specify a certain task that the user program is allowed to run on, or allow the user program to run on any number of tasks simultaneously.

Restricting the tasks that a program can run on will help detect program errors and help reduce the maximum programming execution time.

To change this setting, in the Project pane, right-click the user program, choose Properties, and choose the Tasks page.

 

See Also

User Program Overview | Example: Basic User Program


Send comments on this topic.

Copyright © 2024 Delta Computer Systems, Inc. dba Delta Motion