A value expression evaluates to a number. Value expressions are used in the Delay Link Type, in command parameters in user programs, and to programmatically select commanded axes in user programs.
Value expressions can be very simple, for example just a tag name, such as Axis[1].ActPos.
Sample Expressions
Example 1
MyPosition + 10
|
Note: MyPosition must exist as a variable.
Example 2
_Axis[1].ActPrs - _Axis[0].ActPrs
|
Example 3
3.0 + ABS(_Axis[].ActPos);
|
Entering an Expression
Delay Link Type
In the Delay Link Type, double-click the Time to Delay box. The Expression Editor will open.
Enter the expression:
Double-click any item in the lists on the Tags, Functions or Operators tabs to insert into the expression.
Type other items, such as register addresses or numeric values.
To mix data types, you must explicitly convert them. For example, you cannot directly assign a fractional value to an integer variable. You must use the data type conversion functions.
If you enter multiple expressions in the Expression command, each expression must end with a semi-colon. See the examples below.
If the expression is invalid, the Expression Builder give an error. When no errors are listed, the expression is valid.
Click OK to close the dialog and enter the expression in the command.
Command Parameters
In a command parameter in a user program, double-click the box.
Notice that the Expression Editor is not available when entering expressions in command parameters. it is good practice to only use short expressions in Command Parameters. If you need a long expression in a command parameter, consider creating a variable instead that is calculated in an expression command, and then entered in the command parameter.
Enter the expression:
Type your expression. The intellisense will offer suggestions for variables and tag names based on what you have typed.
If the expression is invalid, the portion in error will be red.
Press Enter to finish editing. If the expression is invalid, the entire expression text will be red. When the entire expression is in black text, the expression is valid.
See Also
Expressions Overview | Constants | Functions | Operators | If Statement | Keywords
Copyright © 2024 Delta Computer Systems, Inc. dba Delta Motion