Expressions are used to assign values to tags or variable, and perform mathematical calculations, both simple and complex. Expressions provide for efficient calculations and compact User Programs. RMCTools provides an Expression Editor, which includes the Expression Browser, to help you create expressions. Expressions can be used in the following places:
Expression Command
Expressions are used in the Expression (113) command to assign values to variables or other registers.
Link Conditions
Expressions are used in the Wait For and Conditional Jump Link Types to specify what conditions should be fulfilled before jumping the next step.
Expressions are used in the Delay Link Type to specify the time delay before jumping the next step.
Program Triggers
Expressions define the trigger conditions.
Command Parameters in User Programs
Expressions can be entered in command parameters in user programs, although the Expression Browser cannot be used for this. The expressions must evaluate to the data type required by the parameter, typically a REAL.
Commanded Axes in User Programs
Expressions can be entered to programmatically select the commanded axes for commands in user programs. See Using Expressions for Commanded Axes for details.
How to Create Expressions
See the Condition Expressions topic for creating expressions in the Program Triggers and in link types.
See the Assignment Expressions topic for creating expressions in user programs with the Expression (113) command.
See the Value Expressions topic for details on creating expressions in the Delay Link Type and in command parameters.
Examples
For examples of expressions, see the Condition Expressions and Assignment Expressions topics.
For examples of user programs that use expressions, see the Programming Examples topic.
Parts of an Expression
The building blocks of all expressions are:
These are symbols that represent an action to be performed, such as +, -, /, etc. |
|||||||||
These are predefined, named formulas, such as SIN(), MIN(), LOG_EVENT(), etc. |
|||||||||
User functions are custom functions created or imported by the user. User functions can be edited in the User Function Editor. |
|||||||||
Operands |
These are the elements that the operators and functions work on:
|
||||||||
These are words that have a specific meaning for the code, such as IF, THEN, ELSE, True, False, etc. |
|||||||||
Comments |
Comments are a good way of documenting the code. |
Expression Color-Coding
Expressions are color-coded as follows:
Blue: Keywords
Dark Red: System-defined tags
Beige: User-defined tags
Black: Operators and numbers
Magenta: Functions
Red with yellow background: Invalid value
Troubleshooting Expressions
For help on troubleshooting expressions, see the Troubleshooting Expressions topic.
Operators and Functions
For details on the operators and functions used in expressions, see the Operators and Functions topics.
See Also
Assignment Expressions | Condition Expressions | Value Expressions | Functions | User Functions | Operators | Keywords | If Statement | Arrays | Limitations of 32-bit Numbers | Comments
Copyright © 2024 Delta Computer Systems, Inc. dba Delta Motion