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 #214 background imageLoading...
Page #214 background image
214
coil2 = false
coil3 = false
mb:writebits(10, coil1, coil2, coil3)
-- multiple write from table
coils = { true, false, false }
mb:writebits(10, unpack(coils))
Core functions:
luamodbus.rtu()
Creates new Modbus RTU object
luamodbus.tcp()
Creates new Modbus TCP object
Modbus object functions:
Core functions:
mb:open(port, [baudrate = 9600, [parity = 'N', [databits = 8, [stopbits = 2]]]])
RTU mode - opens the serial port. (parity: 'N' - none, 'E' - even, 'O' - odd; databits: 7 or
8; stopbits: 1 or 2)
mb:open(ip, [port = 502])
TCP mode - prepares connection to the specified IP and port (optional)
mb:connect()
opens serial or network connection
mb:close()
closes an open connection
mb:flush()
flushes any unsent data
Slave functions:
mb:receive()
receives data from master with 1 minute timeout
returns data as a binary string on success and nil, error description on error
mb:setmapping(coils, inputs, holding_regs, input_regs)
creates memory mapping for the registers with size specified for each type
mb:handleslave()
waits for an incoming indication from master and sends a reply when necessary
mb:getcoils(start, count)
mb:getdiscreteinputs(start, count)
mb:getinputregisters(start, count)
mb:getregisters(start, count)
gets one or many register/coil values from mapping from the start address
returns all values on success and nil, error description on error, exception code if
applicable
mb:setcoils(start, v1, [v2, [v3, ...]])
mb:setdiscreteinputs(start, v1, [v2, [v3, ...]])
mb:setinputregisters(start, v1, [v2, [v3, ...]])

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