setTimeout()

Description

Set the timeout.

Syntax

gateway.setTimeout(timeout)

Parameters

gateway: ModbusGateway object.

timeout: Set the timeout in milliseconds. If the timeout occurs during the poll phase, the EXCEPTION_CODE will be returned to the Modbus Master.

Example

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

#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);

    gateway.setTimeout(500);

}

 

void loop()

{

    gateway.poll();

}

See Also

poll()


Library Reference

86Duino Reference Text Follows Library Reference Home Page href="http://creativecommons.org/licenses/by-sa/3.0/">Creative Commons Attribution-Share Alike 3.0 License. The code examples in the references have been released into the public domain.