Modbus86 Gateway

Modbus86 Gateway を使用すると、86Duino で Modbus マスター通信データを転送するゲートウェイである Modbus Gateway をシミュレートできます。

Modbusマスターとの通信方法としてModbus TCPを使用し、その通信データをModbus RTU上のノードに転送します。

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

#include <Arduino.h>

#include <Modbus86.h>

#include <Ethernet.h>

 

ModbusMaster bus;

ModbusMasterNode node1;

ModbusMasterNode node2;

 

ModbusGateway ゲートウェイ;

 

byte mac[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00};

IPアドレス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リファレンス資料のテキストは、クリエイティブ・コモンズ 表示-継承 3.0 ライセンスに準拠しています。リファレンス資料内のコード例はパブリックドメインとして公開されています。