[Modbus]
説明
Initialize the ModbusMaster object and specify it as Serial class or IPAddress クラス.
構文
bus1.begin(mode, serial)
bus2.begin(mode, modbus_server_ip)
媒介変数
bus1/bus2: ModbusMaster object.mode: Specify the communication mode of the ModbusMaster object, which is coded MODBUS_RTU, MODBUS_ASCII, or MODBUS_TCP.serial: Specify the Serial class as the transmission channel.modbus_server_ip: Specify the IPAddress クラス as the transport channel.
戻り値
bool: return true if successful, return false if not.
例
#include <Ethernet.h>
#include <Modbus86.h>
ModbusMaster bus1;
ModbusMaster bus2;
IPAddress SlaveIP(192,168,3,59);
void setup()
{
Serial1.begin(115200);
bus1.begin(MODBUS_RTU, Serial1);
// bus1.begin(MODBUS_ASCII, Serial1);
Ethernet.begin();
bus2.begin(MODBUS_TCP, SlaveIP);
}
void loop() {}See Also
Language Reference Home
86Duinoリファレンスのテキストは、Arduinoリファレンスを改変したもので、Creative Commons Attribution-ShareAlike 3.0ライセンスに基づいてライセンスされています。リファレンス内のコードサンプルはパブリックドメインとして公開されています。