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 #213 background imageLoading...
Page #213 background image
213
80.
end
81.
82.
-- handle modbus and knx
83.
mb:handleslave()
84.
knxclient:step()
Example usage (TCP / master mode):
require('luamodbus')
mb = luamodbus.tcp()
mb:open('192.168.0.1', 5000)
mb:connect()
-- verbose output and select slave number 10
mb:setdebug(true)
mb:setslave(10)
-- read input from reg 1 to 5, get slave-specific data
mb:readinputregisters(1, 4)
mb:reportslaveid()
-- close serial connection
mb:close()
Example usage (RTU / master mode):
require('luamodbus')
mb = luamodbus.rtu()
-- open serial connection (half duplex)
mb:open('/dev/ttyS2', 38400, 'E', 8, 1, 'H')
mb:connect()
-- verbose output and select slave number 10
mb:setdebug(io.write)
mb:setslave(10)
-- read input from reg 1 to 5, get slave-specific data
mb:readinputregisters(1, 4)
mb:reportslaveid()
-- close serial connection
mb:close()
Read/write examples
-- multiple coil read
coil1, coil2, coil3 = mb:readcoils(10, 3)
-- multiple coil read to table
coils = { mb:readcoils(0, 3) }
Note: coil1 or coils[ 1 ] will be nil on error
-- multiple write
coil1 = true

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