DUEMMEGI
MCP 4 – User's manual
Contatto
script
2
TRIGGER
= 5
var
RTEMP
RTEMP.1 = TEST(
R0
,
R1
)
if
RTEMP.1 == 1
then
R20
= 100
else
R20
= 0
endif
RTEMP.1 = TEST(
R2
,
R3
)
if
RTEMP.1 == 1
then
R21
= 200
else
R21
= 0
endif
exit
sub
BIT
(TEST)(REG1, REG2)
REG1 = REG1 / 2
REG2 = REG2 / 4
if
REG1 > REG2
then
TEST = 1
else
TEST = 0
endif
endsub
endscript
The following script o script is a combination of the previous two examples. This script uses a function having
as input parameters a value (REG) and a bit (ENABLE), therefore declared by BIT(ENABLE); the function
returns a bit (TEST), therefore declared by BIT(TEST) ( REG1, BIT(ENABLE) ).
script
3
TRIGGER
= 5
V17
= TEST(
R50
,
V1
)
V18
= TEST(
R51
,
V2
)
V19
= TEST(
R52
,
V3
)
V20
= TEST(
R53
,
V4
)
exit
sub
BIT
(TEST)( REG,
BIT
(ENABLE) )
if
ENABLE == 1
then
REG = REG / 2
if
REG > 100
then
TEST = 1
else
TEST = 0
endif
else
TEST = 0
endif
endsub
endscript
DUEMMEGI
s.r.l. - Via Longhena, 4 – 20139 MILANO
Tel. 02/57300377 - Fax 02/55213686 –
www.duemmegi.it
Rel.: 1.2 October 2018
Page 41 of 87