ModbusGateway.begin()

[Modbus]

説明

Initialize the ModbusGateway object and specify the communication mode between this object and the Modbus Master.

Syntax

gateway1.begin(mode, serial)
gateway2.begin(mode)

Parameters

  • gateway1/gateway2: ModbusGateway object.
  • mode: Specify the communication mode between the ModbusGateway object and the Modbus Master with MODBUS_RTU, MODBUS_ASCII or MODBUS_TCP quotes.
  • serial: Specify the Serial class as the transmission channel.

Returns

bool: Returns true if successful, false if not

Example

#include <Modbus86.h>
#include <Ethernet.h>
 
ModbusGateway gateway1;
ModbusGateway gateway2;
 
void setup()
{
    Serial485.begin(115200);
    gateway1.begin(MODBUS_RTU, Serial485);
     
    Ethernet.begin();
    gateway2.begin(MODBUS_TCP);
}
 
void loop()
{
}

Libraries Reference Home

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

コメントする

上部へスクロール