Operators

This topic describes the operators available in the RMC expressions. For details on using the operators, see the Assignment Expressions and  Logical Expressions topics.

 

Operator

Description

Operates on these Data Types

Notes

:=

Assigns the value of the expression on the right-hand side to the register on the left-hand side. Required in all assignment expressions.

All Data Types

The assignment operator is required in the Expression command.

+

Addition

REAL, DINT

 

-

Subtraction

REAL, DINT

 

*

Multiplication

REAL, DINT

 

/

Division

REAL, DINT

 

MOD

Integer Modulo

Gives the remainder of a division of whole numbers.

DINT

Examples:

    12 MOD 5 will return 2.

    61 MOD 10 will return 1.

    5 MOD 5 will return 0.

(

Opening parenthesis.

All Data Types

The number of opening parentheses must match the number of closing parentheses.

)

Closing parenthesis.

All Data Types

The number of opening parentheses must match the number of closing parentheses.

=

Equal To (not for assigning values)

All Data Types

Cannot be used for assignment.

<>

Not Equal

All Data Types

 

<=

Less Than or Equal To

REAL, DINT

 

<

Less Than

REAL, DINT

 

>

Greater Than

REAL, DINT

 

>=

Greater Than or Equal To

REAL, DINT

 

AND

Logical and Bitwise AND

DWORD, DINT, BOOL

The data types of the operands must match.

OR

Logical and Bitwise OR

DWORD, DINT, BOOL

The data types of the operands must match.

NOT

Logical and Bitwise NOT

DWORD, DINT, BOOL

The data types of the operands must match.

XOR

Logical and Bitwise Exclusive OR

DWORD, DINT, BOOL

The data types of the operands must match.

[

Opening bracket for indexing item in an array, e.g. MyVar[i] or _Axis[0].ActPos.

All Data Types

The number of opening brackets must match the number of closing brackets.

]

Closing bracket for indexing item in an array, e.g. MyVar[i] or _Axis[0].ActPos.

All Data Types

The number of opening brackets must match the number of closing brackets.

**

Exponentiation

REAL

Example: 3**6 is three to the sixth power.

If you are calculating polynomials, consider using the POLY function.

 

 

Order of Precedence

 

Precedence

Operation

Symbol

HIGHEST

Parenthesization

(expression)

 

Function Evaluation

identifier(argument list)

ln(a), max(x,y) etc.

 

Negation

Complement

-

NOT

 

Exponent

**

 

Multiply

Divide

Modulo

*

/

MOD

 

Add

Subtract

+

-

 

Comparison

< , > , <= , >=

 

Equality

Inequality

=

<>

 

Boolean AND

AND

 

Boolean Exclusive OR

XOR

 

Boolean OR

OR

Lowest

Assignment

:=

 

 

See Also

Expressions Overview | Functions | Data Types


Send comments on this topic.

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