7. LW3 Programmers’ Reference
MMX4x2 series – User's Manual
110
Applied firmware package: v1.6.0b19 | LDC software: v2.5.13b5
7.11.3.
Addition and Subtraction (Cycle 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. This method has the feature that
if the value hits the limit (min/max), the value will be stepped to the other end of the interval.
Command and Response
ç
CALL·/CTRL/VARS/V
<loc>
:cycle(
<operand>
;
<min>
;
<max>
)
æ
mO·/CTRL/VARS/V
<loc>
:cycle
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 calculated value is beyond the limit (min/max), the value will be stepped to the other end of the interval.
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
section.
Example 1 – addition
ç
GET /CTRL/VARS/V1.Value
æ
pw /CTRL/VARS/V1.Value=18
ç
CALL /CTRL/VARS/V1:cycle(1;10;20)
æ
mO /CTRL/VARS/V1:cycle
æ
CHG /CTRL/VARS/V1.Value=19
ç
CALL /CTRL/VARS/V1:cycle(1;10;20)
æ
mO /CTRL/VARS/V1:cycle
æ
CHG /CTRL/VARS/V1.Value=20
ç
CALL /CTRL/VARS/V1:cycle(1;10;20)
æ
mO /CTRL/VARS/V1:cycle
æ
CHG /CTRL/VARS/V1.Value=10
ç
CALL /CTRL/VARS/V1:cycle(1;10;20)
æ
mO /CTRL/VARS/V1:cycle
æ
CHG /CTRL/VARS/V1.Value=11
Example 2 – subtraction
ç
GET /CTRL/VARS/V1.Value
æ
pw /CTRL/VARS/V1.Value=13
ç
CALL /CTRL/VARS/V1:cycle(-2;10;20)
æ
mO /CTRL/VARS/V1:cycle
æ
CHG /CTRL/VARS/V1.Value=11
ç
CALL /CTRL/VARS/V1:cycle(-2;10;20)
æ
mO /CTRL/VARS/V1:cycle
æ
CHG /CTRL/VARS/V1.Value=20
ç
CALL /CTRL/VARS/V1:cycle(-2;10;20)
æ
mO /CTRL/VARS/V1:cycle
æ
CHG /CTRL/VARS/V1.Value=18
7.11.4.
Value Change with Intervals (Case)
This command can be used to change the value of a variable if it fits in any of the defined intervals.
Command and Response
ç
CALL·/CTRL/VARS/V
<loc>
:case(
<min> <max> <val>
;)
æ
mO·/CTRL/VARS/V
<loc>
:case
Parameters
Parameter
Parameter description
Value
<loc>
The location of the variable
1-30
<min>
The lowest value of the interval
Integer
<max>
The highest value of the interval
Integer
<val>
The new value that will be valid if the current value is in the interval
Integer
The parameters are divided by a space character, and the interval groups are divided by semicolon. Up to 16
cases can be defined.
Examples
ç
CALL /CTRL/VARS/V1:case(10 20 15)
æ
mO /CTRL/VARS/V1:case
A typical example when two different ranges of values have to meet:
Incoming values: between 0 and 255 (e.g. the slider of a controller can have these values).
Outgoing values: between 0 and 100 (e.g. the controlled device accepts these values).
Defined cases:
The command looks like:
ç
CALL /CTRL/VARS/V1:case(1 25 10;26 50 20;51 75 30;76 100 40;101 125 50;126 150 60;151 175 70;
176 200 80; 201 225 90; 226 255 100)
æ
mO /CTRL/VARS/V1:case
Min
Max
New value
Case 1
1
25
10
Case 2
26
50
20
Case 3
51
75
30
Case 4
76
100
40
Case 5
101
125
50
Case 6
126
150
60
Case 7
151
175
70
Case 8
176
200
80
Case 9
201
225
90
Case 10
226
255
100