This topic is about the Variable Table variables. For details on local variables in a user program step, refer to Local Variables in Expressions. For details on local variables in a user functions, refer to Declaring Variables in User Functions.
Number of Variables |
|
RMC75S |
1024 |
RMC75P |
1024 |
RMC75E |
1024 |
RMC150E |
1024 |
RMC200 |
4096 |
Variables may be named by the user, and can be set to any value at any time. Variables make the User Programs very flexible. They can be used to effortlessly change programs, make programs readable, and easily influence User Programs via a PLC. Variables may be used in command parameters, the Expression (113) command, and several Link Types.
A limited number of variables can be individually selected to be retentive, if supported by the RMC. The Current Value of retentive variables will be retained between power cycles without requiring a Flash update. This is useful for retaining data such as setpoint positions, machine cycle counters, and recipe data.
PROFIBUS uses some of the variables for communications. PROFINET and EtherNet/IP may also use some variables if configured to do so. Therefore, before using any variables, you may first wish to determine which variables you will be using for the communciations to avoid having to move variables later.
The Variable data types can be REAL, DINT, or DWORD. See the Boolean variables topic for special instructions regarding how to create boolean variables. Arrays with indexed addressing are also supported.
Example Variable Table:
The Edit tab is for creating variables. The Monitor tab is for monitoring and changing the current value in real-time.
Column Details
Register |
The address of the current value of the variable. This address is used for accessing the current value of the variable externally, such as from a PLC. For the address of the initial value, see the Register Map topic. |
Tag Name |
The name of the variable. Use the Variable name to refer to the variable. You can also reference the variable by its register address, especially if communicating to the RMC with a PLC. Tag names are limited to 64 characters. |
Units |
The units of a variable is purely for the user's own reference. It has no affect on the usage of the variable. |
Type |
This can be any of the RMC data types, or an array of variables with the same data type. See the Boolean variables topic for special instructions regarding how to create boolean variables. |
Retain |
The current value of retained, or retentive, variables will automatically be saved in non-volatile memory. A variable can be set to be retained by checking the Retain cell in the Variable Table Editor. Not all RMCs support retained variables, nor can all variables be retained. See Retained Variables below for more details. |
Initial |
You can specify an initial value for a variable in the Variable Table Editor. The Current Value of a variable will be set to the Initial Value when:
The Initial Value can be saved to Flash. See the Register Map topic to find the addresses of the Initial Values. |
Current |
The current value of the variable is displayed only on the Monitor tab. There are several ways to change the current value:
See the Register Map topic to find the addresses of the Current Values. |
Description |
The description is for the user's own reference. |
Creating Variables
To define variables and set the initial value, use the Edit tab of the Variable Table Editor. All 1024 variables already exist and do not need to be declared or created. However, it is good practice to give a Tag Name, Description, and Initial Value to any variable before you use it.
After making changes on the Edit tab, you must download the Programming node to apply the changes to the RMC.
See the Boolean variables topic for special instructions regarding how to create boolean variables.
Monitoring Variables
Use the Monitor tab of the Variable Table Editor to monitor or change the current value of the variable in real time from RMCTools.
To change a current value:
On the Monitor tab, edit the Current Value of the desired variable(s).
In the toolbar, click the Download Current Values button to apply the changes to the controller.
Assigning a Value to a Variable
There are several ways to assign a value to a variable:
Use the Edit tab of the Variable Table Editor to set the initial value. The Initial value is the value the variable will take on when the RMC is reset.
Use the Monitor tab of the Variable Table Editor to set the current value of the variable.
Use the Expression (113) command in a User Program to assign a value to a variable.
Write to the Variable register via a PLC or other host controller. See Variable Locations -Using Variables with a PLC or other Host Controller below for details.
Using Variables
Variables can be used for many purposes:
Store a value for later use.
To influence User Programs.
Count how many times an event occurs.
To use the values assigned to variables, do the following:
Enter variables in the Command parameters in User Programs.
Use variables in Link Type expressions in Use Programs.
Use variables in the Expression (113) command in User Programs.
Use variables in the Program Triggers.
Examples:
If you create a variable called MySpeed, and enter it as the Speed command parameter in several Move commands in a User Program, then you can easily change the speed for all those commands at once by simply changing the value of the Speed variable.
To count how many times an event occurs, you can add 1 to a variable each time the event occurs.
Variable Locations—Using Variables with a PLC or other Host Controller
You can read or write to variables when communicating to the RMC with a PLC or other host controller. See the Register Map topic to find the addresses of the variables. Notice that each variable has two locations—one for the Current Value, and one for the Initial Value.
Retained means that the Current Value of the variable is automatically saved, or retained, in non-volatile memory and will be preserved even when power is cycled to the RMC. Retained variables are saved to non-volatile memory approximately every 100 msec.
Any variable can be set to be retained by checking the Retain cell in the Variable Table Editor.
Variables that are not retained will not retain the Current Value. When power is cycled to the RMC, the Current Value of non-retained variables will be set to the Initial Value.
Support for Retentive Variables
Maximum Retained Variables |
Board revisions |
Firmware version |
|
RMC75S |
none |
- |
- |
RMC75P |
none |
- |
- |
RMC75E |
986 |
1.4A and newer |
3.30.0 and newer |
RMC150E |
986 |
all |
3.30.0 and newer |
RMC200 |
2048 |
all |
all |
Boot-up Details
When the RMC boots up, the Current Values for all variables will start at zero, and then if a variable has an Initial Value stored in Flash, the Current Value will be overwritten with this Initial Value. Further, if the variable is marked as retentive and was retained to non-volatile memory, the Current Value will be set to the retained value. This is all done before the first loop time of the RMC. Therefore, the precedence on boot-up is (1) NVRAM, (2) Flash, (3) zero.
This precedence order means that a project can communicate what the initial default values should be for each variable, even retained variables. For example, a sample project with retentive variables will be able to specify what the values should be initially, even if they are retained. In addition to sample projects, this also allows a project to be copied to a new machine with meaningful initial values.
See Also
Programming Overview | Arrays | Data Types
Copyright © 2024 Delta Computer Systems, Inc. dba Delta Motion