BECKHOFF BX Controller: Programming

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 terminating resistor is not required for short cable lengths (< 5m) and low baud rates (<19200 baud)

ST example program for linking ModbusRTU master with the BX:

ST example program for linking ModbusRTU master version 2 with the BX:

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

Reaction Time

The reaction time is dependent of the Task Time, the number of slaves, the length from the Modbus telegram and the reaction time from the slave (answer). 
For the ascertainment of this table it would be use a Beckhoff BK7300 Modbus Slave. This is not portable to other slaves, but you can use this table as an approximate value.

Baud rate 38400 Baud (one Read Reg. und one Write Reg. Telegram per Slave)

Number of Slaves Task time on the BX Time for polling all nodes
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 in- and 2 words output
**) 20 Words in- and 20 words output