131
46.
function
mbproxy:setslave
(
slaveid
)
47.
self.slaveid
=
slaveid
48.
end
49.
50.
-- send rpc request for a spefic function
51.
function
mbproxy:request
(
fn, ...
)
52.
local
res, err
=
self.rpc:request
({
53.
fn
=
fn,
54.
params
=
{
...
}
,
55.
slaveid
=
self.slaveid
or
0
,
56.
})
57.
58.
-- request error
59.
if
err
then
60.
return
nil
, err
61.
-- request ok
62.
else
63.
-- reply with an error
64.
if
res
[
1
]
==
nil
then
65.
return
nil
, res
[
2
]
66.
-- normal reply
67.
else
68.
return
unpack
(
res
)
69.
end
70.
end
71.
end
Handler (resident script with 0 delay) configuration
1.
mb:open('/dev/ttyS2', 38400, 'E', 8, 1, 'H')
set baudrate and other serial port parameters
2.
mb:setslave(10)
set slave device id
3.
mb:setmapping(10, 10, 10, 10)
set number coils, discrete inputs, holding registers and input registers
4.
mb:setwritecoilcb(function(coil, value)...
callback function which is executed for each coil write
5.
mb:setwriteregistercb(function(coil, value)...
callback function which is executed for each register write
Содержание LogicMachine3 Re:actor
Страница 10: ...10 Terminal connection schemes KNX TP...
Страница 12: ...12 24V power supply...
Страница 13: ...13 Analog inputs e g reed contact...
Страница 14: ...14 Analog inputs 0 10V...
Страница 15: ...15 Digital output...
Страница 16: ...16 Resistive sensor input...
Страница 17: ...17 Analog output...
Страница 26: ...26 Make sure that bus status is Online press button in ETS...
Страница 35: ...35 o Then minimize side bar by pressing on left arrow icon to make the map more visible...
Страница 83: ...83 66 if err then 67 alert FTP upload failed s err 68 end...
Страница 107: ...107...
Страница 108: ...108 1 14 Help Documentation for scripting syntaxes is displayed in Help tab...
Страница 122: ...122 4 16 Running processes System running processes can be seen in Status Running processes window...
Страница 126: ...126 Datapoints can be shown also in a way of table which can be later exported as CSV file...
Страница 141: ...141...