BX COM port as ModbusRTU master

The serial interface of the BX can also be used as Modbus master.

Necessary components

1 x BX3100 
Bus Terminals for the K-Bus (any, since they are not used for the example)
1 x BK7300
2 x KL2xx4
2 x KL1xx4
1 x KL9010

RS 485 cable*

BX3100 COM 2 / RS 485

BK7300 / RS 485

1

3

6

8

*) active termination resistor required for short cable lengths (< 5 m) and low baud rates (<19200 baud)

BX COM port as ModbusRTU master 1: Download ST sample program for linking the ModbusRTU master and BX: ( sample file )

BX COM port as ModbusRTU master 2: Download ST sample program for linking the ModbusRTU master version 2 and BX: ( sample file )

The example requires the ModbusRTU, TcComPortBC, TcBaseBX libraries.
Baud rate 9600, n, 8.1 default BK7300,
BK7300 address 11

modbusmasterbx.prx
modbusmasterbx_v2.prx

Reaction times

The reaction times depend on the set task time, the number of slaves, the length of the Modbus telegrams and the response time of the slaves.
Beckhoff BK7300 Modbus slaves were used for determining the following table. Since this is not transferable to all slaves, the table should only be used for guidance.

Baud rate 38400 baud (one read reg. and one write reg. telegram per slave)

Number of slaves

Task time on the BX

Time for one cycle

1

5

100 ms* / 125 ms**

2

5

200 ms / 225 ms

1

10

180 ms / 220 ms

2

10

350 ms / 390 ms

1

20

350 ms / 350 ms

2

20

700 ms / 700 ms

*) 2 words inputs and 2 words outputs
*) 20 words inputs and 20 words outputs