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 #187 background imageLoading...
Page #187 background image
187
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

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