7. LW3 Programmers’ Reference
MMX4x2 series – User's Manual
109
Applied firmware package: v1.6.0b19 | LDC software: v2.5.13b5
7.11.
Variable-Management
DIFFERENCE:
This feature and the commands below are available from firmware v1.6.0b19.
Custom variables (30 pcs.) can be defined in number or text format, which are also available in the Event
Manager. The maximum length of a variable can be 15 characters and they are stored in a non-volatile
memory, thus the value is kept in case of a reboot. The type of the variable (text or string) is determined
automatically based on the value. If an operation cannot be performed (e.g. adding number value to a string-
type variable), error will be the response.
#variables
7.11.1.
Value Assignment
Command and Response
ç
SET·/CTRL/VARS/V
<loc>
.Value=
<value>
æ
pw·/CTRL/VARS/V
<loc>
.Value=
<value>
Parameters
Parameter
Parameter description
Value
Value description
<loc>
The location of the variable
1-30
<value>
The value of the variable
Custom
Length can be max 15 characters.
Numeric variable is defined between
-2147483648 and 2147483647.
Example
ç
SET /CTRL/VARS/V1.Value=120
æ
pw /CTRL/VARS/V1.Value=120
7.11.2.
Addition and Subtraction (Add Method)
The value of a numeric variable can be increased by adding a positive value or it can be decreased by adding
a negative value. Minimum and maximum values can be defined as limits.
Command and Response
ç
CALL·/CTRL/VARS/V
<loc>
:add(
<operand>
;
<min>
;
<max>
)
æ
mO·/CTRL/VARS/V
<loc>
:add
Parameters
Parameter
Parameter description
Value
Value description
<loc>
The location of the variable
1-30
<operand>
The value that is added to the variable
Integer
Negative value is also accepted
<min>
The lowest allowed value (optional)
Integer
Negative value is also accepted
<max>
The highest allowed value (optional)
Integer
Negative value is also accepted
If the value of the variable is higher or equals with
<max>
, the new value will be
<max>
. Likewise, in case of
<min>
setting: if the value of the variable is lower or equals with
<min>
, the new value will be
<min>
.
Examples
Change messages (CHG) can be seen after each response for the better understanding, which is not part of
the command, but it can be set as described in the
Example 1 – addition
ç
GET /CTRL/VARS/V1.Value
æ
pw /CTRL/VARS/V1.Value=6
ç
CALL /CTRL/VARS/V1:add(1)
æ
mO /CTRL/VARS/V1:add
æ
CHG /CTRL/VARS/V1.Value=7
ç
CALL /CTRL/VARS/V1:add(1)
æ
mO /CTRL/VARS/V1:add
æ
CHG /CTRL/VARS/V1.Value=8
ç
CALL /CTRL/VARS/V1:add(2)
æ
mO /CTRL/VARS/V1:add
æ
CHG /CTRL/VARS/V1.Value=10
Example 3 – addition with 'max' value
ç
GET /CTRL/VARS/V1.Value
æ
pw /CTRL/VARS/V1.Value=16
ç
CALL /CTRL/VARS/V1:add(2;10;20)
æ
mO /CTRL/VARS/V1:add
æ
CHG /CTRL/VARS/V1.Value=18
ç
CALL /CTRL/VARS/V1:add(2;10;20)
æ
mO /CTRL/VARS/V1:add
æ
CHG /CTRL/VARS/V1.Value=20
ç
CALL /CTRL/VARS/V1:add(2;10;20)
æ
mO /CTRL/VARS/V1:add
æ
CHG /CTRL/VARS/V1.Value=20
Example 2 – subtraction
ç
GET /CTRL/VARS/V1.Value
æ
pw /CTRL/VARS/V1.Value=10
ç
CALL /CTRL/VARS/V1:add(-2)
æ
mO /CTRL/VARS/V1:add
æ
CHG /CTRL/VARS/V1.Value=8
ç
CALL /CTRL/VARS/V1:add(-2)
æ
mO /CTRL/VARS/V1:add
æ
CHG /CTRL/VARS/V1.Value=6
ç
CALL /CTRL/VARS/V1:add(-10)
æ
mO /CTRL/VARS/V1:add
æ
CHG /CTRL/VARS/V1.Value=-4
Example 4 – subtraction with 'min' value
ç
GET /CTRL/VARS/V1.Value
æ
pw /CTRL/VARS/V1.Value=14
ç
CALL /CTRL/VARS/V1:add(-2;10;20)
æ
mO /CTRL/VARS/V1:add
æ
CHG /CTRL/VARS/V1.Value=12
ç
CALL /CTRL/VARS/V1:add(-2;10;20)
æ
mO /CTRL/VARS/V1:add
æ
CHG /CTRL/VARS/V1.Value=10
ç
CALL /CTRL/VARS/V1:add(-2;10;20)
æ
mO /CTRL/VARS/V1:add
æ
CHG /CTRL/VARS/V1.Value=10