Modbus Library
86Diuno IDE has added this library since Coding 318 to support the Modbus communication protocol, which is an industrial communication standard published in 1979 for communication between automated electronic devices such as Programmable Logic Controllers (PLCs).
Modbus is a protocol based on the master/slave architecture. There is a master node communicating with multiple slave nodes on the entire network. Each node has a unique address. When the master node sends a packet with a specified address, only the slave node with the corresponding address will receive and parse the packet, and execute and respond to instructions according to the packet content.
86Duino's Modbus library has the following features:
- Supports Modbus RTU, TCP, and ASCII protocols.
- Can run as a Modbus master node or a Modbus slave node.
- Supports Modbus gateway functionality.
Modbus Master
Modbus Master enables 86Duino to simulate a Modbus Master and send packets to the Slave nodes on the channel.
ModbusMaster Class
Use Serail/Ethernet for Modbus transmission.
– begin()
ModbusMasterNode Class
Send the corresponding node packet command.
– attach()
– getResponseBuffer()
– clearResponseBuffer()
– setTransmitBuffer()
– clearTransmitBuffer()
– beginTransmission()
– sendBit()
– send()
– available()
– receive()
– readCoils()
– readDiscreteInputs()
– readHoldingRegisters()
– readInputRegisters()
– writeSingleCoil()
– writeSingleRegister()
– writeMultipleCoils()
– writeMultipleRegisters()
– maskWriteRegister()
– readWriteMultipleRegisters()
Modbus Slave
Modbus Slave can make 86Duino simulate a Modbus Slave node, receive commands on the channel and execute callback functions. <p>>
ModbusSlave Class
Use Serail/Ethernet for Modbus transmission.
– begin()
ModbusSlaveNode Class
Receive and parse the corresponding packet, and access the data register and call the callback function according to the command.
Callback function pointer array.
Direct access to the Slave register function, usually used in the callback function.
– readCoil()
– writeCoil()
– writeDiscreteInput()
– readHoldingRegister()
– writeHoldingRegister()
– writeInputRegister()
Modbus Gateway
Modbus Gateway can make 86Duino simulate as Modbus Gateway, which is a gateway that forwards Modbus Master communication data. <p>>
ModbusGateway Category
A gateway that forwards Modbus Master communication data.
– begin()
– connect()
– setTimeout()
– poll()
Show the film
Library Reference Home Page
Text in 86Duino Reference MaterialsModified from the Arduino Reference and licensed under the Creative Commons Attribution-Share Alike 3.0 License . Code examples in the reference have been released into the public domain.