EasyManuals Logo

Embedded Systems LogicMachine5 User Manual

Default Icon
291 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #211 background imageLoading...
Page #211 background image
211
1.
value = event.getvalue()
2.
mb = mbproxy.new()
3.
mb:setcoils(0, value)
Example: event script which changes modbus slave register (address 5)
Must be mapped to a group address with scaling (0..100) value
1.
value = event.getvalue()
2.
mb = mbproxy.new()
3.
mb:setregisters(5, value)
LM interconnection with PLC over Modbus TCP
sleep time = 0. It only supports binary objects as coils and 1-byte / 2-byte integer objects as
registers. Number of coils and registers is not limited, object mapping can be set by filling coils,
registers and regdt tables.
1.
if not mb then
2.
require('genohm-scada.eibdgm')
3.
require('luamodbus')
4.
5.
-- list of coil mapping, starting from 0
6.
coils = { '1/1/1', '1/1/2' }
7.
8.
-- list of register mapping, starting from 0
9.
registers = { '2/2/2', '3/3/3' }
10.
11.
-- list of register data types, element count must match registers table
12.
regdt = { dt.int8, dt.uint16 }
13.
14.
-- knx group write callback
15.
function knxgroupwrite(event)
16.
local value
17.
18.
-- try to find matching coil
19.
for id, addr in ipairs(coils) do
20.
if event.dst == addr then
21.
value = knxdatatype.decode(event.datahex, dt.bool)
22.
mb:setcoils(id - 1, value)
23.
end
24.
end
25.
26.
-- try to find matching register
27.
for id, addr in ipairs(registers) do
28.
if event.dst == addr then
29.
value = knxdatatype.decode(event.datahex, regdt[ id ])

Table of Contents

Other manuals for Embedded Systems LogicMachine5

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Embedded Systems LogicMachine5 and is the answer not in the manual?

Embedded Systems LogicMachine5 Specifications

General IconGeneral
BrandEmbedded Systems
ModelLogicMachine5
CategoryDimmer
LanguageEnglish

Related product manuals