ModbusGateway.poll()

[Modbus]

説明

Receives and parses Modbus packets and sends them to the corresponding node according to the packet address.

Syntax

gateway.poll()

Parameters

gateway: ModbusGateway object.

Returns

int: The length of the received Modbus packets.

Example

#include <Modbus86.h>
#include <Ethernet.h>
 
ModbusMaster bus;
ModbusMasterNode node1;
ModbusMasterNode node2;
 
ModbusGateway gateway;
 
void setup()
{
    Ethernet.begin();
    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);
}
 
void loop()
{
    gateway.poll();
}

Libraries Reference Home

86Duino のリファレンスのテキストは Arduino レファレンス を編集したもので、 Creative Commons Attribution-ShareAlike 3.0 License下でライセンスされています。リファレンス内のコードサンプルはパブリックドメインとして公開されています。

コメントする

上部へスクロール