[Modbus]
The Modbus86 Gateway enables the 86Duino to emulate the Modbus Gateway, a gateway for forwarding Modbus Master communication data.
例
Use Modbus TCP as the communication method with Modbus Master and forward its communication data to the node on Modbus RTU.
#include <Arduino.h>
#include <Modbus86.h>
#include <Ethernet.h>
ModbusMaster bus;
ModbusMasterNode node1;
ModbusMasterNode node2;
ModbusGateway gateway;
byte mac[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
IPAddress localIp(192,168,1,102);
void setup()
{
Ethernet.begin(mac, localIp);
Serial485.begin(115200);
gateway.begin(MODBUS_TCP);
bus.begin(MODBUS_RTU, Serial485);
node1.attach(11, bus);
node2.attach(12, bus);
gateway.connect(node1);
gateway.connect(node2);
gateway.setTimeout(500);
}
void loop()
{
gateway.poll();
}
ライブラリリファレンスホーム
86Duinoリファレンスのテキストは、Arduinoリファレンスを改変したもので、Creative Commons Attribution-ShareAlike 3.0ライセンスに基づいてライセンスされています。リファレンス内のコードサンプルはパブリックドメインとして公開されています。