
8 GCS Commands
C-863.12 Mercury Controller
MS249E
Version: 1.2.1
175
1 ActiveHigh
end of help
MAT (Calculate And Save To Variable)
Description:
Carries out a mathematical operation or bit operation and
saves the result as a variable (p. 118).
The variable is in volatile memory (RAM) only.
Format:
MAT <Variable> "=" <FLOAT1> <OP> <FLOAT2>
Arguments:
<Variable> is the name of the variable where the result is
to be saved.
<FLOAT1> and <FLOAT2> are the values for calculating the
result. They can be specified directly or via the value of a
variable.
<OP> is the operator to be used: The following operators
are possible:
<OP>
Operation
Type
+
Addition
Mathematical operation
-
Subtraction
Mathematical operation
*
Multiplication
Mathematical operation
AND
UND
Bit operation
OR
ODER
Bit operation
XOR
XOR
Bit operation
Important: There must be a blank space before and after
each "=" and the operator!
Response:
None
Notes:
Using MAT to set local variables is only possible in macros.
Example 1:
Send:
MAT TARGET = ${POS} * 2.0
The
TARGET
variable contains 2.0 times the value of the
POS
variable.
Example 2:
Send:
MAT TARGET = 2 * 0x10
Send:
VAR? TARGET
Receive:
TARGET=32
NOTICE: The values from which the result is to be
calculated can be written in hexadecimal or decimal
format. The result is always output in decimal format.