EasyManuals Logo

Embedded Systems LogiMachine5 Power User Manual

Embedded Systems LogiMachine5 Power
254 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 #185 background imageLoading...
Page #185 background image
185
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

Questions and Answers:

Question and Answer IconNeed help?

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

Embedded Systems LogiMachine5 Power Specifications

General IconGeneral
BrandEmbedded Systems
ModelLogiMachine5 Power
CategoryController
LanguageEnglish