ModbusSlave.begin()

[Modbus]

説明

Initialize the ModbusSlave object and specify the mode and channel.

Syntax

bus1.begin(mode, serial)
bus2.begin(mode)

Parameters

  • bus1/bus2: ModbusSlave object.
  • mode: Specify the communication mode of the ModbusSlave object with MODBUS_RTU, MODBUS_ASCII, or MODBUS_TCP pins.
  • serial: When mode is specified as MODBUS_RTU or MODBUS_ASCII, Serial class must be specified as the transmission channel.

Returns

bool: return true if successful, return false if not.

Example

#include <Ethernet.h>
#include <Modbus86.h>
 
ModbusSlave bus1;
ModbusSlave bus2;
 
void setup()
{
    Serial1.begin(115200);
    bus1.begin(MODBUS_RTU, Serial1);
    // bus1.begin(MODBUS_ASCII, Serial1);
     
    Ethernet.begin();
    bus2.begin(MODBUS_TCP);
}
 
void loop()
{
}

See Also


Libraries Reference Home

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

コメントする

上部へスクロール