0% found this document useful (0 votes)
21 views192 pages

Modbus RTU 9

The document provides detailed documentation for the Modbus_RTU_9 function block library designed for PC Worx 6, including installation and deinstallation hints, general information, change notes, supported PLCs, and descriptions of various function blocks. It outlines the parameters and diagnostics for each function block, as well as examples and security considerations. The library supports Modbus RTU protocol communication with specified baud rates and cycle times, ensuring compatibility with various modules and devices.

Uploaded by

jose.moura
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views192 pages

Modbus RTU 9

The document provides detailed documentation for the Modbus_RTU_9 function block library designed for PC Worx 6, including installation and deinstallation hints, general information, change notes, supported PLCs, and descriptions of various function blocks. It outlines the parameters and diagnostics for each function block, as well as examples and security considerations. The library supports Modbus RTU protocol communication with specified baud rates and cycle times, ensuring compatibility with various modules and devices.

Uploaded by

jose.moura
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 192

Modbus_RTU_9 1/192

Function block library

Modbus_RTU_9

for PC Worx 6
Documentation for
PHOENIX CONTACT function blocks
PHOENIX CONTACT GmbH Co. KG
Flachsmarktstrasse 8
D-32825 Blomberg, Germany
This documentation is available in English only.
Modbus_RTU_9 2/192

Table of Contents
1 Installation hint
2 Deinstallation hint
3 General information
4 Change notes
5 Supported PLCs
6 Function blocks
7 MB_RTU_FC1
7.1 Block call
7.2 Input parameters
7.3 Output parameters
7.4 Inout parameters
7.5 Diagnostic
8 MB_RTU_FC2
8.1 Block call
8.2 Input parameters
8.3 Output parameters
8.4 Inout parameters
8.5 Diagnostic
9 MB_RTU_FC3
9.1 Block call
9.2 Input parameters
9.3 Output parameters
9.4 Inout parameters
9.5 Diagnostic
10 MB_RTU_FC4
10.1 Block call
10.2 Input parameters
10.3 Output parameters
10.4 Inout parameters
10.5 Diagnostic
11 MB_RTU_FC5
11.1 Block call
11.2 Input parameters
11.3 Output parameters
11.4 Inout parameters
11.5 Diagnostic
12 MB_RTU_FC6
12.1 Block call
12.2 Input parameters
12.3 Output parameters
12.4 Inout parameters
12.5 Diagnostic
13 MB_RTU_FC15
Modbus_RTU_9 3/192

13.1 Block call


13.2 Input parameters
13.3 Output parameters
13.4 Inout parameters
13.5 Diagnostic
14 MB_RTU_FC16
14.1 Block call
14.2 Input parameters
14.3 Output parameters
14.4 Inout parameters
14.5 Diagnostic
15 MB_RTU_FC23
15.1 Block call
15.2 Input parameters
15.3 Output parameters
15.4 Inout parameters
15.5 Diagnostic
16 MB_RTU_DiagInfo_EN
16.1 Block call
16.2 Input parameters
16.3 Output parameters
16.4 Inout parameters
16.5 Diagnostic
17 MB_AXL_F_RSUNI_Master
17.1 Function block call
17.2 Input parameters
17.3 Output parameters
17.4 Inout parameters
17.5 Diagnosis
18 MB_AXL_F_RSUNI_Slave
18.1 Function block call
18.2 Input parameters
18.3 Output parameters
18.4 Inout parameters
18.5 Diagnosis
19 MB_AXL_SE_RS485_Master

19.1 Function block call


19.2 Input parameters
19.3 Output parameters
19.4 Inout parameters
19.5 Diagnosis
20 MB_AXL_SE_RS485_Slave
20.1 Function block call
20.2 Input parameters
20.3 Output parameters
Modbus_RTU_9 4/192

20.4 Inout parameters


20.5 Diagnosis
21 MB_AXL_SE_RS485_EF_MA
21.1 Function block call
21.2 Input parameters
21.3 Output parameters
21.4 Inout parameters
21.5 Diagnosis
22 MB_AXL_SE_RS485_EF_SL
22.1 Function block call
22.2 Input parameters
22.3 Output parameters
22.4 Inout parameters
22.5 Diagnosis
23 MB_AXL_SE_RS232_Master
23.1 Function block call
23.2 Input parameters
23.3 Output parameters
23.4 Inout parameters
23.5 Diagnosis
24 MB_AXL_SE_RS232_Slave
24.1 Function block call
24.2 Input parameters
24.3 Output parameters
24.4 Inout parameters
24.5 Diagnosis
25 MB_AXL_SE_RS232_EF_MA
25.1 Function block call
25.2 Input parameters
25.3 Output parameters
25.4 Inout parameters
25.5 Diagnosis
26 MB_AXL_SE_RS232_EF_SL
26.1 Function block call
26.2 Input parameters
26.3 Output parameters
26.4 Inout parameters
26.5 Diagnosis
27 MB_IL_232P_Master
27.1 Block call
27.2 Input parameters
27.3 Output parameters
27.4 Inout parameters
27.5 Diagnostic
28 MB_IL_232P_Slave
Modbus_RTU_9 5/192

28.1 Block call


28.2 Input parameters
28.3 Output parameters
28.4 Inout parameters
28.5 Diagnostic
29 MB_IL_232E_Master
29.1 Block call
29.2 Input parameters
29.3 Output parameters
29.4 Inout parameters
29.5 Diagnostic
30 MB_IL_232E_Slave
30.1 Block call
30.2 Input parameters
30.3 Output parameters
30.4 Inout parameters
30.5 Diagnostic
31 MB_IL_485E_Master
31.1 Block call
31.2 Input parameters
31.3 Output parameters
31.4 Inout parameters
31.5 Diagnostic
32 MB_IL_485E_Slave
32.1 Block call
32.2 Input parameters
32.3 Output parameters
32.4 Inout parameters
32.5 Diagnostic
33 MB_IL_485P_Master
33.1 Block call
33.2 Input parameters
33.3 Output parameters
33.4 Inout parameters
33.5 Diagnostic
34 MB_IL_485P_Slave
34.1 Block call
34.2 Input parameters
34.3 Output parameters
34.4 Inout parameters
34.5 Diagnostic
35 MB_IL_UNI07_Master
35.1 Block call
35.2 Input parameters
35.3 Output parameters
35.4 Inout parameters
Modbus_RTU_9 6/192

35.5 Diagnostic
36 MB_IL_UNI07_Slave
36.1 Block call
36.2 Input parameters
36.3 Output parameters
36.4 Inout parameters
36.5 Diagnostic
37 MB_IL_UNI15_Master
37.1 Block call
37.2 Input parameters
37.3 Output parameters
37.4 Inout parameters
37.5 Diagnostic
38 MB_IL_UNI15_Slave
38.1 Block call
38.2 Input parameters
38.3 Output parameters
38.4 Inout parameters
38.5 Diagnostic
39 MB_IL_UNI31_Master
39.1 Block call
39.2 Input parameters
39.3 Output parameters
39.4 Inout parameters
39.5 Diagnostic
40 MB_IL_UNI31_Slave
40.1 Block call
40.2 Input parameters
40.3 Output parameters
40.4 Inout parameters
40.5 Diagnostic
41 Startup examples
41.1 Example 1: MB_*_EXA_AXL_MA
41.2 Example 2: MB_*_EXA_AXL_SL
41.3 Example 3: MB_*_EXA_IL_MA
41.4 Example 4: MB_*_EXA_IL_SL
41.5 Example 5: MB_*_EXA_SE_RS232_MA
41.6 Example 6: MB_*_EXA_SE_RS232_SL
41.7 Example 7: MB_*_EXA_SE_RS485_MA
41.8 Example 8: MB_*_EXA_SE_RS485_SL
41.9 Example 9: MB_*_EXA_SE_RS485_EF_MA
41.10 Example 10: MB_*_EXA_SE_RS485_EF_SL
41.11 Example 11: MB_*_EXA_SE_RS232_EF_MA
41.12 Example 12: MB_*_EXA_SE_RS232_EF_SL
42 Security
42.1 Used third party components (TPC)
Modbus_RTU_9 7/192

42.2 Security context


43 Appendix
43.1 Modbus_RTU runtime
43.2 Data types
44 In case of problems
45 Support
Modbus_RTU_9 8/192

1 Installation hint
Please copy the library data to your PC Worx 6 working library directory.

2 Deinstallation hint
Please delete the library data from your PC Worx 6 working library directory.

3 General information
The Modbus_RTU library offers function blocks for communication with the controller via Modbus RTU protocol.
This library is released for:

Baudrate >= 1200 Baud and <= 38400


Cycle time <= 50ms
Bus cycle time <=32ms

Some of the modules allow a baud rate maximum value of 500k baud (see data sheet of the terminal). The modules
are tested and approved as indicated above. Flawless operation outside the specified parameters is without
warranty.
Modbus_RTU_9 9/192

4 Change notes
Library Library PC Worx Change notes
version build version
9 20241120 6.30.3146 New function blocks:

MB_AXL_SE_RS232_EF_MA and MB_AXL_SE_RS232_EF_SL for


AXL SE RS232 EF (1507979).
MB_AXL_SE_RS485_EF_MA and MB_AXL_SE_RS485_EF_SL for
AXL SE RS485 EF (1507978).

8 20230913 6.30.2972 Improved documentation with:


correction of module article number
8 20230126 6.30.2972 Improved documentation with:
Modbus_RTU runtime (see Appendix)
8 20220825 6.30.2972 MB_IL_485E_Slave, MB_IL_232E_Slave, MB_IL_485P_Slave,
MB_IL_232P_Slave & MB_IL_UNIxx_Slave:

New output uiNoOfFailedTransactions.


Internal improvement.

MB_AXL_F_RSUNI_Slave, MB_AXL_SE_RS232_Slave &


MB_AXL_SE_RS485_Slave:

New output uiNoOfFailedTransactions.


New input diBaudrate for internal timer calculation.
Internal improvement.

MB_AXL_F_RSUNI_Master:

Bugfix timeout Modbus_RTU mode

7 20211029 6.30.2972 Released for AXL SE RS232 (1181787) and AXL SE RS232EA (1281866)
6 20210901 6.30.2972 MB_*_Master:

Bug fix for “Reset of error state not possible under certain conditions”
Modbus_RTU_9 10/192

5 20200611 6.30.2907 MB_RTU_FC (all FCs):

Bugfix: The FC shows neither xError nor xDone when xReset of the
MB_xxx_Master block is set in the same cycle, where xError or
xDone should come.

MB_AXL_F_RSUNI_Master:

Bugfix: Modbus transmission error messages with the terminal


parameterization “Modbus_RTU” must be output at the FC and not at
the MB_AXL_F_RSUNI_Master.
Bugfix: xActive may only become TRUE if all internal blocks are
active.

MB_AXL_SE_RS485_Master:

Bugfix: xActive may only become TRUE if all internal blocks are
active.

MB_IL_485E_Master and Slave,


MB_IL_232E_Master and Slave,
MB_IL_UNIxx_Master and Slave:

Correction of the precision of the process data timeout timer.


Increased occurrence of Modbus timeouts with slow bus cycle time
between PLC and module and simultaneously fast PLC cycle time.
Modbus_RTU_9 11/192

4 20200430 6.30.2907 MB_RTU_Master:

Modified timeout handling.


Deactivation after PD-Timeout.

MB_RTU_FCx:

New timeout between FC and Modbus_Master.

New function blocks:

MB_AXL_F_RSUNI_Master
MB_AXL_F_RSUNI_Slave
MB_RTU_AXL_F_RSUNI_Master
MB_RTU_AXL_F_RSUNI_Slave

NOTE:
The function blocks:

MB_RTU_Master
MB_RTU_Slave
MB_AXL_RS_UNI_RCV
MB_AXL_RS_UNI_SND

were replaced by the compatible blocks:

MB_RTU_AXL_F_RSUNI_Master
MB_RTU_AXL_F_RSUNI_Slave
Modbus_RTU_9 12/192

3 20200128 6.30.2519 MB_RTU_Master:

Enable communication after error without FB restart.

MB_RTU_FC (all FCs) and MB_RTU_Master:

Resetting the FC by resetting the MB_RTU_Master.


At deactivation request of the master or FC during execution of a
Modbus request wait for response or timeout before deactivation.

MB_RTU_FC (all FCs)

Additional check of the Modbus response for validity (inside the FC).
Response is consistent with the request.

MB_AXL_RS_UNI_SND and MB_AXL_RS_UNI_RCV:

Modified timeout and Error handling.


Correction of problems when receiving more than 17 bytes and the
parameterization Modbus_RTU.

2 20190521 6.10.200 New functionalities:

New function blocks MB_IL_232E_Master and MB_IL_232E_Slave

MB_RTU_Master_5:

Improved handshakes between master and serial driver.


INLINE mode: Master block shows wrong diagnosis code 16#8100 in
case of parameterization error of the terminal.

MB_RTU_FC23:

Runtime error: "Error while accessing indirect variable address"

MB_RTU_FC (all FCs):

Operating FC stops when other FCs are deactivated

MB_AXL_RS_UNI_SND:

Bugfix: "Communication error after FB reset during send or receive


phase."
Bugfix: "Inter-character time bigger than Modbus specification allows.
Communication errors with slow CPU cycle-times or high bussystem
cycle-times."
Modbus_RTU_9 13/192

MB_IL_232P_Master:

xActive = TRUE, if Driver and Modbus Master are active.

MB_IL_232P_Slave:

xActive = TRUE, if Driver and Modbus Master are active.

MB_IL_485E_Master:

xActive = TRUE, if Driver and Modbus Master are active.


Bugfix: "Inter-character time bigger than Modbus specification allows.
Communication errors with slow CPU cycle-times or high bussystem
cycle-times."

MB_IL_485E_Slave:

xActive = TRUE, if Driver and Modbus Master are active.


Bugfix: "Inter-character time bigger than Modbus specification allows.
Communication errors with slow CPU cycle-times or high bussystem
cycle-times."

MB_IL_485P_Master:

xActive = TRUE, if Driver and Modbus Master are active.

MB_IL_485P_Slave:

xActive = TRUE, if Driver and Modbus Master are active.

MB_IL_UNIxx_Master:

xActive = TRUE, if Driver and Modbus Master are active.


Bugfix: "Inter-character time bigger than Modbus specification allows.
Communication errors with slow CPU cycle-times or high bussystem
cycle-times."

MB_IL_UNIxx_Slave:

xActive = TRUE, if Driver and Modbus Master are active.


Bugfix: "Inter-character time bigger than Modbus specification allows.
Communication errors with slow CPU cycle-times or high bussystem
cycle-times."
Modbus_RTU_9 14/192

1 20180412 6.10.200 Extracted from Modbus_3 library.

New functionalities:

New udtDiag output at all function blocks for better diagnostics.


Master and Slave function blocks with integrated driver are no longer
encrypted for better diagnostics.

MB_RTU_Master_4:

"Array out of index" error message with enabled xAuto_CRC input is


corrected.
"xNDR stays true after function block is deactivated during send
request" error is fixed.
"Execution error of following FCs, if previous FC is in error" error is
fixed.

MB_RTU_FC1,2,3,4,23:

New diagnostic for"broadcast on reading FBs not possible".

MB_RTU_FC2:

"Reading wrong count of bits" error is fixed.

MB_RTU_FC23:

"Reading one register less than requested" error is fixed

MB_RTU_FC (all FCs):

Correction in polltimer execution interval


"wDiagCode goes to 16#0000 after xDone" error is fixed
"Function code invalid" diag code is changed from 16#C110 to
16#C100
Modbus_RTU_9 15/192

5 Supported PLCs
AXC 1050 (2700988)
AXC 1050 XC (2701295)
AXC 3050 (2700989)
ILC 130 ETH (2988803)
ILC 131 ETH (2700973)
ILC 131 ETH/XC (2701034)
ILC 150 ETH (2985330)
ILC 151 ETH (2700974)
ILC 151 GSM/GPRS (2700977)
ILC 170 ETH 2TX (2916532)
ILC 171 ETH 2TX (2700975)
ILC 190 ETH 2TX (2700527)
ILC 191 ETH 2TX (2700976)
ILC 191 ME/AN (2700074)
ILC 191 ME/INC (2700075)
ILC 330 ETH (2737193)
ILC 330 PN (2988191)
ILC 350 ETH (2737203)
ILC 350 ETH/M (2985819)
ILC 350 PN (2876928)
ILC 370 ETH 2TX-IB (2876999)
ILC 370 PN 2TX-IB (2876915)
ILC 370 PN 2TX-IB/M (2985576)
ILC 390 PN 2TX-IB (2985314)
RFC 430 ETH-IB (2730190)
RFC 450 ETH-IB (2730200)
RFC 470S PN 3TX (2916794)
RFC 470 PN 3TX (2916600)
RFC 480S PN 4TX (2404577)
Modbus_RTU_9 16/192

6 Function blocks
Function block Description Version Supported License
articles
MB_RTU_FC1 This function block reads the status of 7 - none
discrete outputs from a Modbus slave.
MB_RTU_FC2 This function block reads discrete inputs 8 - none
from a Modbus slave.
MB_RTU_FC3 This function block reads holding 7 - none
registers from a Modbus slave.
MB_RTU_FC4 This function block reads input registers 7 - none
from a Modbus slave.
MB_RTU_FC5 This function block writes a single output 7 - none
bit of a Modbus slave.
MB_RTU_FC6 This function block writes a single holding 7 - none
register of a Modbus slave.
MB_RTU_FC15 This function block writes multiple output 7 - none
bits of a Modbus slave.
MB_RTU_FC16 This function block writes multiple holding 7 - none
registers of a Modbus slave.
MB_RTU_FC23 This function block writes or reads 7 - none
multiple holding registers of a Modbus
slave.
MB_RTU_DiagInfo_EN This optional function block displays 3 - none
diagnostic messages of the Modbus
master as clear text in English.
MB_AXL_SE_RS485_Master This block runs the sending operations via 4 AXL SE none
the AXL SE RS485 (1088128) module. RS485
(1088128)
MB_AXL_SE_RS485_Slave This block runs the sending operations via 2 AXL SE none
the AXL SE RS485 (1088128) module. RS485
(1088128)
MB_AXL_SE_RS485_EF_MA This block runs the sending operations via 1 AXL SE none
the AXL SE RS485 EF (1507978) module. RS485 EF
(1507978)
MB_AXL_SE_RS485_EF_SL This block runs the sending operations via 1 AXL SE none
the AXL SE RS485 EF (1507978) module. RS485 EF
(1507978)

MB_AXL_SE_RS232_Master This block runs the sending operations via 2 AXL SE none
the AXL SE RS232 (1181787) and AXL RS232
SE RS232EA (1281866) module. (1181787)
AXL SE
RS232EA
(1281866)
MB_AXL_SE_RS232_Slave This block runs the sending operations via 2 AXL SE none
the AXL SE RS232 (1181787) and AXL RS232
SE RS232EA (1281866) module. (1181787)
AXL SE
RS232EA
(1281866)
Modbus_RTU_9 17/192

MB_AXL_SE_RS232_EF_MA This block runs the sending operations via 1 AXL SE none
the AXL SE RS232 EF (1507979) module. RS232 EF
(1507979)
MB_AXL_SE_RS232_EF_SL This block runs the sending operations via 1 AXL SE none
the AXL SE RS232 EF (1507979) module. RS232 EF
(1507979)
MB_AXL_F_RSUNI_Master This block runs the sending operations via 4 AXL F RS none
the AXL F RS UNI 1H (2688666) module. UNI 1H
(2688666)
MB_AXL_F_RSUNI_Slave This block runs the sending operations via 3 AXL F RS none
the AXL F RS UNI 1H (2688666) module. UNI 1H
(2688666)
MB_IL_232P_Master This function block is used to implement 8 IB IL RS none
a Modbus Master for the specified module 232-PRO-
type. PAC
(2878722)
MB_IL_232P_Slave This function block is used to implement 5 IB IL RS none
a Modbus Slave for the specified module 232-PRO-
type. PAC
(2878722)
MB_IL_232E_Master This function block is used to implement 6 IB IL RS none
a Modbus Master for the specified module 232-ECO
type. (2702795)
MB_IL_232E_Slave This function block is used to implement 4 IB IL RS none
a Modbus Slave for the specified module 232-ECO
type. (2702795)
MB_IL_485P_Master This function block is used to implement 8 IB IL RS none
a Modbus Master for the specified module 485/422-
type. PRO-PAC
(2863627)
MB_IL_485P_Slave This function block is used to implement 5 IB IL RS none
a Modbus Slave for the specified module 485/422-
type. PRO-PAC
(2863627)
MB_IL_485E_Master This function block is used to implement 9 IB IL RS none
a Modbus Master for the specified module 485-ECO
type. (2702141)
MB_IL_485E_Slave This function block is used to implement 6 IB IL RS none
a Modbus Slave for the specified module 485-ECO
type. (2702141)
MB_IL_UNIxx_Master This function block is used to implement 9 IB IL RS none
a Modbus Master for the specified module UNI-PAC
type. (2700893)
MB_IL_UNIxx_Slave This function block is used to implement 6 IB IL RS none
a Modbus Slave for the specified module UNI-PAC
type. (2700893)
Modbus_RTU_9 18/192

7 MB_RTU_FC1
This function block reads the status of discrete outputs from a Modbus slave.

7.1 Block call

7.2 Input parameters


Name Type Description
xActivate BOOL Block activation (TRUE = Active).
xSendRequest BOOL A send request to the master block is activated with a rising edge. A falling edge
deletes current Modbus errors and resets the block outputs.
xEnablePoll BOOL Cyclical polling is started with a rising edge. A falling edge deactivates the polling.
Input xSendRequest triggers an additional request and should be deactivated during
poll mode.
Note that the outputs xDone and xError are only one cycle true.
tPollIntervall TIME If xEnablePoll is activated, then transmission is cyclical in the time interval of the
specified value.
uiSlaveAddress UINT The input specifies the address of the slave to be communicated with (1 to 255).
uiStartAddress UINT The input specifies the start address of the bit to be read on the slave.
iDataCount INT The input specifies the number of bits to be read on the slave (1 to 2000).
Modbus_RTU_9 19/192

7.3 Output parameters


Name Type Description
xActive BOOL TRUE: Function block is active. FALSE: Function block is not
active.
xBusy BOOL TRUE: The block is busy with the service execution.
xDone BOOL Request is sent and response from slave is successfully
received.
xError BOOL TRUE: An error has occurred. For details refer to wDiagCode
and wAddDiagCode.
wDiagCode WORD Diagnostic code. Refer to diagnostics table.
wAddDiagCode WORD Additional diagnostic code. Refer to diagnostics table.
udtDiag MB_UDT_RTU_xxx_DIAG Structure with internal variables for Diagnostic

7.4 Inout parameters


Name Type Description
arrReadData arrModbus2_X_1_2000 The parameter contains the requested Modbus data.
udtMBData udtModbus2_Data The block communicates via this structure with the FC blocks.
Modbus_RTU_9 20/192

7.5 Diagnostic
The diagnostics contains diagnostic codes on the FC blocks of the library. Modbus errors are indicated at the
respective FC block and need to be reset there. Thus the communication in a Modbus network is not disturbed by
an error in a request to a slave. An error at the FC block is deleted by a reset of the send input or by renewed
activation of the block.

Modbus exception codes are sent by the respective slave and contain messages specific for Modbus.

wDiagCode wAddDiagCode Description


16#0000 Block is not activated.
16#8000 Block is active and operating without errors.
16#8300 Block executes a service.
16#C100 Error during configuration (displayed on the FC block).
16#0001 Slave address is outside the valid range.
16#0002 Number of the requested data amount invalid (iDataCount).
16#0003 Function code invalid.
16#0004 Broadcast not possible. FC supports reading function.
16#C110 Modbus error.
16#0001 Modbus communication timeout.
16#0002 Modbus checksum (CRC) invalid.
16#C120 Modbus Exception Code (shown at the FC block).
16#0001 Exception Code 1 (Illegal Function).
16#0002 Exception Code 2 (Illegal Data Address).
16#0003 Exception Code 3 (Illegal Data Value).
16#0004 Exception Code 4 (Server Device Failure).
16#0005 Exception Code 5 (Acknowledge).
16#0006 Exception Code 6 (Server Device Busy).
16#0008 Exception Code 8 (Memory Parity Error).
16#000A Exception Code 10 (Gateway Path Unavailable).
16#000B Exception Code 11 (Gateway Target Device Failed To Respond).
16#C130 Invalid Response.
16#0001 Slave address of Response invalid.
16#0002 Function code of Response invalid.
16#0003 Length of Response invalid.
16#C416 Internal timeout.
16#0001 Timeout between FC and Modbus_Master.
These diagnostic codes, as well as xError, are reset by a falling edge of xActivate or xSendRequest on an FC
block.
The block displays the diagnosis of the master block and thus also the diagnosis of the serial blocks. These errors
must be reset by deactivating the affected blocks. For the diagcode description of 16#C010 - 16#C060 refer to the
serial master block diagnostic (MB_xx_xx_Master).
Modbus_RTU_9 21/192

8 MB_RTU_FC2
This function block reads discrete inputs from a Modbus slave.

8.1 Block call

8.2 Input parameters


Name Type Description
xActivate BOOL Block activation (TRUE = Active).
xSendRequest BOOL A send request to the master block is activated with a rising edge. A falling edge
deletes current Modbus errors and resets the block outputs.
xEnablePoll BOOL Cyclical polling is started with a rising edge. A falling edge deactivates the polling.
Input xSendRequest triggers an additional request and should be deactivated during
poll mode.
Note that the outputs xDone and xError are only one cycle true.
tPollIntervall TIME If xEnablePoll is activated, then transmission is cyclical in the time interval of the
specified value.
uiSlaveAddress UINT The input specifies the address of the slave to be communicated with (1 to 255).
uiStartAddress UINT The input specifies the start address of the bit to be read on the slave.
iDataCount INT The input specifies the number of bits to be read on the slave (1 to 2000).
Modbus_RTU_9 22/192

8.3 Output parameters


Name Type Description
xActive BOOL TRUE: Function block is active. FALSE: Function block is not
active.
xBusy BOOL TRUE: The block is busy with the service execution.
xDone BOOL Request is sent and response from slave is successfully
received.
xError BOOL TRUE: An error has occurred. For details refer to wDiagCode
and wAddDiagCode.
wDiagCode WORD Diagnostic code. Refer to diagnostics table.
wAddDiagCode WORD Additional diagnostic code. Refer to diagnostics table.
udtDiag MB_UDT_RTU_xxx_DIAG Structure with internal variables for Diagnostic

8.4 Inout parameters


Name Type Description
arrReadData arrModbus2_X_1_2000 The parameter contains the requested Modbus data.
udtMBData udtModbus2_Data The block communicates via this structure with the FC blocks.
Modbus_RTU_9 23/192

8.5 Diagnostic
The diagnostics contains diagnostic codes on the FC blocks of the library. Modbus errors are indicated at the
respective FC block and need to be reset there. Thus the communication in a Modbus network is not disturbed by
an error in a request to a slave. An error at the FC block is deleted by a reset of the send input or by renewed
activation of the block.

Modbus exception codes are sent by the respective slave and contain messages specific for Modbus.

wDiagCode wAddDiagCode Description


16#0000 Block is not activated.
16#8000 Block is active and operating without errors.
16#8300 Block executes a service.
16#C100 Error during configuration (displayed on the FC block).
16#0001 Slave address is outside the valid range.
16#0002 Number of the requested data amount invalid (iDataCount).
16#0003 Function code invalid.
16#0004 Broadcast not possible. FC supports reading function.
16#C110 Modbus error.
16#0001 Modbus communication timeout.
16#0002 Modbus checksum (CRC) invalid.
16#C120 Modbus Exception Code (shown at the FC block).
16#0001 Exception Code 1 (Illegal Function).
16#0002 Exception Code 2 (Illegal Data Address).
16#0003 Exception Code 3 (Illegal Data Value).
16#0004 Exception Code 4 (Server Device Failure).
16#0005 Exception Code 5 (Acknowledge).
16#0006 Exception Code 6 (Server Device Busy).
16#0008 Exception Code 8 (Memory Parity Error).
16#000A Exception Code 10 (Gateway Path Unavailable).
16#000B Exception Code 11 (Gateway Target Device Failed To Respond).
16#C130 Invalid Response.
16#0001 Slave address of Response invalid.
16#0002 Function code of Response invalid.
16#0003 Length of Response invalid.
16#C416 Internal timeout.
16#0001 Timeout between FC and Modbus_Master.
These diagnostic codes, as well as xError, are reset by a falling edge of xActivate or xSendRequest on an FC
block.
The block displays the diagnosis of the master block and thus also the diagnosis of the serial blocks. These errors
must be reset by deactivating the affected blocks. For the diagcode description of 16#C010 - 16#C060 refer to the
serial master block diagnostic (MB_xx_xx_Master).
Modbus_RTU_9 24/192

9 MB_RTU_FC3
This function block reads holding registers from a Modbus slave.

9.1 Block call

9.2 Input parameters


Name Type Description
xActivate BOOL Block activation (TRUE = Active).
xSendRequest BOOL A send request to the master block is activated with a rising edge. A falling edge
deletes current Modbus errors and resets the block outputs.
xEnablePoll BOOL Cyclical polling is started with a rising edge. A falling edge deactivates the polling.
Input xSendRequest triggers an additional request and should be deactivated during
poll mode.
Note that the outputs xDone and xError are only one cycle true.
tPollIntervall TIME If xEnablePoll is activated, then transmission is cyclical in the time interval of the
specified value.
uiSlaveAddress UINT The input specifies the address of the slave to be communicated with (1 to 255).
uiStartAddress UINT The input specifies the start address to be read on the slave.
iDataCount INT The input specifies the number of registers to be read on the slave (1 to 2000).
Modbus_RTU_9 25/192

9.3 Output parameters


Name Type Description
xActive BOOL TRUE: Function block is active. FALSE: Function block is not
active.
xBusy BOOL TRUE: The block is busy with the service execution.
xDone BOOL Request is sent and response from slave is successfully
received.
xError BOOL TRUE: An error has occurred. For details refer to wDiagCode
and wAddDiagCode.
wDiagCode WORD Diagnostic code. Refer to diagnostics table.
wAddDiagCode WORD Additional diagnostic code. Refer to diagnostics table.
udtDiag MB_UDT_RTU_xxx_DIAG Structure with internal variables for Diagnostic

9.4 Inout parameters


Name Type Description
arrReadData arrModbus2_W_1_125 The parameter contains the requested Modbus data.
udtMBData udtModbus2_Data The block communicates via this structure with the FC blocks.
Modbus_RTU_9 26/192

9.5 Diagnostic
The diagnostics contains diagnostic codes on the FC blocks of the library. Modbus errors are indicated at the
respective FC block and need to be reset there. Thus the communication in a Modbus network is not disturbed by
an error in a request to a slave. An error at the FC block is deleted by a reset of the send input or by renewed
activation of the block.

Modbus exception codes are sent by the respective slave and contain messages specific for Modbus.

wDiagCode wAddDiagCode Description


16#0000 Block is not activated.
16#8000 Block is active and operating without errors.
16#8300 Block executes a service.
16#C100 Error during configuration (displayed on the FC block).
16#0001 Slave address is outside the valid range.
16#0002 Number of the requested data amount invalid (iDataCount).
16#0003 Function code invalid.
16#0004 Broadcast not possible. FC supports reading function.
16#C110 Modbus error.
16#0001 Modbus communication timeout.
16#0002 Modbus checksum (CRC) invalid.
16#C120 Modbus Exception Code (shown at the FC block).
16#0001 Exception Code 1 (Illegal Function).
16#0002 Exception Code 2 (Illegal Data Address).
16#0003 Exception Code 3 (Illegal Data Value).
16#0004 Exception Code 4 (Server Device Failure).
16#0005 Exception Code 5 (Acknowledge).
16#0006 Exception Code 6 (Server Device Busy).
16#0008 Exception Code 8 (Memory Parity Error).
16#000A Exception Code 10 (Gateway Path Unavailable).
16#000B Exception Code 11 (Gateway Target Device Failed To Respond).
16#C130 Invalid Response.
16#0001 Slave address of Response invalid.
16#0002 Function code of Response invalid.
16#0003 Length of Response invalid.
16#C416 Internal timeout.
16#0001 Timeout between FC and Modbus_Master.
These diagnostic codes, as well as xError, are reset by a falling edge of xActivate or xSendRequest on an FC
block.
The block displays the diagnosis of the master block and thus also the diagnosis of the serial blocks. These errors
must be reset by deactivating the affected blocks. For the diagcode description of 16#C010 - 16#C060 refer to the
serial master block diagnostic (MB_xx_xx_Master).
Modbus_RTU_9 27/192

10 MB_RTU_FC4
This function block reads input registers from a Modbus slave.

10.1 Block call

10.2 Input parameters


Name Type Description
xActivate BOOL Block activation (TRUE = Active).
xSendRequest BOOL A send request to the master block is activated with a rising edge. A falling edge
deletes current Modbus errors and resets the block outputs.
xEnablePoll BOOL Cyclical polling is started with a rising edge. A falling edge deactivates the polling.
Input xSendRequest triggers an additional request and should be deactivated during
poll mode.
Note that the outputs xDone and xError are only one cycle true.
tPollIntervall TIME If xEnablePoll is activated, then transmission is cyclical in the time interval of the
specified value.
uiSlaveAddress UINT The input specifies the address of the slave to be communicated with (1 to 255).
uiStartAddress UINT The input specifies the start address to be read on the slave.
iDataCount INT The input specifies the number of registers to be read on the slave (1 to 2000).
Modbus_RTU_9 28/192

10.3 Output parameters


Name Type Description
xActive BOOL TRUE: Function block is active. FALSE: Function block is not
active.
xBusy BOOL TRUE: The block is busy with the service execution.
xDone BOOL Request is sent and response from slave is successfully
received.
xError BOOL TRUE: An error has occurred. For details refer to wDiagCode
and wAddDiagCode.
wDiagCode WORD Diagnostic code. Refer to diagnostics table.
wAddDiagCode WORD Additional diagnostic code. Refer to diagnostics table.
udtDiag MB_UDT_RTU_xxx_DIAG Structure with internal variables for Diagnostic

10.4 Inout parameters


Name Type Description
arrReadData arrModbus2_W_1_125 The parameter contains the requested Modbus data.
udtMBData udtModbus2_Data The block communicates via this structure with the FC blocks.
Modbus_RTU_9 29/192

10.5 Diagnostic
The diagnostics contains diagnostic codes on the FC blocks of the library. Modbus errors are indicated at the
respective FC block and need to be reset there. Thus the communication in a Modbus network is not disturbed by
an error in a request to a slave. An error at the FC block is deleted by a reset of the send input or by renewed
activation of the block.

Modbus exception codes are sent by the respective slave and contain messages specific for Modbus.

wDiagCode wAddDiagCode Description


16#0000 Block is not activated.
16#8000 Block is active and operating without errors.
16#8300 Block executes a service.
16#C100 Error during configuration (displayed on the FC block).
16#0001 Slave address is outside the valid range.
16#0002 Number of the requested data amount invalid (iDataCount).
16#0003 Function code invalid.
16#0004 Broadcast not possible. FC supports reading function.
16#C110 Modbus error.
16#0001 Modbus communication timeout.
16#0002 Modbus checksum (CRC) invalid.
16#C120 Modbus Exception Code (shown at the FC block).
16#0001 Exception Code 1 (Illegal Function).
16#0002 Exception Code 2 (Illegal Data Address).
16#0003 Exception Code 3 (Illegal Data Value).
16#0004 Exception Code 4 (Server Device Failure).
16#0005 Exception Code 5 (Acknowledge).
16#0006 Exception Code 6 (Server Device Busy).
16#0008 Exception Code 8 (Memory Parity Error).
16#000A Exception Code 10 (Gateway Path Unavailable).
16#000B Exception Code 11 (Gateway Target Device Failed To Respond).
16#C130 Invalid Response.
16#0001 Slave address of Response invalid.
16#0002 Function code of Response invalid.
16#0003 Length of Response invalid.
16#C416 Internal timeout.
16#0001 Timeout between FC and Modbus_Master.
These diagnostic codes, as well as xError, are reset by a falling edge of xActivate or xSendRequest on an FC
block.
The block displays the diagnosis of the master block and thus also the diagnosis of the serial blocks. These errors
must be reset by deactivating the affected blocks. For the diagcode description of 16#C010 - 16#C060 refer to the
serial master block diagnostic (MB_xx_xx_Master).
Modbus_RTU_9 30/192

11 MB_RTU_FC5
This function block writes a single output bit of a Modbus slave.

11.1 Block call

11.2 Input parameters


Name Type Description
xActivate BOOL Block activation (TRUE = Active).
xSendRequest BOOL A send request to the master block is activated with a rising edge. A falling
edge deletes current Modbus errors and resets the block outputs.
xEnablePoll BOOL Cyclical polling is started with a rising edge. A falling edge deactivates the
polling.
Input xSendRequest triggers an additional request and should be deactivated
during poll mode.
Note that the outputs xDone and xError are only one cycle true.
tPollIntervall TIME If xEnablePoll is activated, then transmission is cyclical in the time interval of
the specified value.
uiSlaveAddress UINT The input specifies the address of the slave to be communicated with (1 to
255).
uiStartAddressWrite UINT The input specifies the start address of the data to be written on the slave.
xValue BOOL The status of the input is written in the memory to be written.
Modbus_RTU_9 31/192

11.3 Output parameters


Name Type Description
xActive BOOL TRUE: Function block is active. FALSE: Function block is not
active.
xBusy BOOL TRUE: The block is busy with the service execution.
xDone BOOL Request is sent and response from slave is successfully
received.
xError BOOL TRUE: An error has occurred. For details refer to wDiagCode
and wAddDiagCode.
wDiagCode WORD Diagnostic code. Refer to diagnostics table.
wAddDiagCode WORD Additional diagnostic code. Refer to diagnostics table.
udtDiag MB_UDT_RTU_xxx_DIAG Structure with internal variables for Diagnostic

11.4 Inout parameters


Name Type Description
udtMBData udtModbus2_Data The block communicates via this structure with the FC blocks.
Modbus_RTU_9 32/192

11.5 Diagnostic
The diagnostics contains diagnostic codes on the FC blocks of the library. Modbus errors are indicated at the
respective FC block and need to be reset there. Thus the communication in a Modbus network is not disturbed by
an error in a request to a slave. An error at the FC block is deleted by a reset of the send input or by renewed
activation of the block.

Modbus exception codes are sent by the respective slave and contain messages specific for Modbus.

wDiagCode wAddDiagCode Description


16#0000 Block is not activated.
16#8000 Block is active and operating without errors.
16#8300 Block executes a service.
16#C100 Error during configuration (displayed on the FC block).
16#0001 Slave address is outside the valid range.
16#0002 Number of the requested data amount invalid (iDataCount).
16#0003 Function code invalid.
16#0004 Broadcast not possible. FC supports reading function.
16#C110 Modbus error.
16#0001 Modbus communication timeout.
16#0002 Modbus checksum (CRC) invalid.
16#C120 Modbus Exception Code (shown at the FC block).
16#0001 Exception Code 1 (Illegal Function).
16#0002 Exception Code 2 (Illegal Data Address).
16#0003 Exception Code 3 (Illegal Data Value).
16#0004 Exception Code 4 (Server Device Failure).
16#0005 Exception Code 5 (Acknowledge).
16#0006 Exception Code 6 (Server Device Busy).
16#0008 Exception Code 8 (Memory Parity Error).
16#000A Exception Code 10 (Gateway Path Unavailable).
16#000B Exception Code 11 (Gateway Target Device Failed To Respond).
16#C130 Invalid Response.
16#0001 Slave address of Response invalid.
16#0002 Function code of Response invalid.
16#0003 Length of Response invalid.
16#C416 Internal timeout.
16#0001 Timeout between FC and Modbus_Master.
These diagnostic codes, as well as xError, are reset by a falling edge of xActivate or xSendRequest on an FC
block.
The block displays the diagnosis of the master block and thus also the diagnosis of the serial blocks. These errors
must be reset by deactivating the affected blocks. For the diagcode description of 16#C010 - 16#C060 refer to the
serial master block diagnostic (MB_xx_xx_Master).
Modbus_RTU_9 33/192

12 MB_RTU_FC6
This function block writes a single holding register of a Modbus slave.

12.1 Block call

12.2 Input parameters


Name Type Description
xActivate BOOL Block activation (TRUE = Active).
xSendRequest BOOL A send request to the master block is activated with a rising edge. A falling
edge deletes current Modbus errors and resets the block outputs.
xEnablePoll BOOL Cyclical polling is started with a rising edge. A falling edge deactivates the
polling.
Input xSendRequest triggers an additional request and should be deactivated
during poll mode.
Note that the outputs xDone and xError are only one cycle true.
tPollIntervall TIME If xEnablePoll is activated, then transmission is cyclical in the time interval of
the specified value.
uiSlaveAddress UINT The input specifies the address of the slave to be communicated with (1 to
255).
uiStartAddressWrite UINT The input specifies the start address to be written on the slave.
wValue WORD The status of the input is written in the memory to be written.
Modbus_RTU_9 34/192

12.3 Output parameters


Name Type Description
xActive BOOL TRUE: Function block is active. FALSE: Function block is not
active.
xBusy BOOL TRUE: The block is busy with the service execution.
xDone BOOL Request is sent and response from slave is successfully
received.
xError BOOL TRUE: An error has occurred. For details refer to wDiagCode
and wAddDiagCode.
wDiagCode WORD Diagnostic code. Refer to diagnostics table.
wAddDiagCode WORD Additional diagnostic code. Refer to diagnostics table.
udtDiag MB_UDT_RTU_xxx_DIAG Structure with internal variables for Diagnostic

12.4 Inout parameters


Name Type Description
udtMBData udtModbus2_Data The block communicates via this structure with the FC blocks.
Modbus_RTU_9 35/192

12.5 Diagnostic
The diagnostics contains diagnostic codes on the FC blocks of the library. Modbus errors are indicated at the
respective FC block and need to be reset there. Thus the communication in a Modbus network is not disturbed by
an error in a request to a slave. An error at the FC block is deleted by a reset of the send input or by renewed
activation of the block.

Modbus exception codes are sent by the respective slave and contain messages specific for Modbus.

wDiagCode wAddDiagCode Description


16#0000 Block is not activated.
16#8000 Block is active and operating without errors.
16#8300 Block executes a service.
16#C100 Error during configuration (displayed on the FC block).
16#0001 Slave address is outside the valid range.
16#0002 Number of the requested data amount invalid (iDataCount).
16#0003 Function code invalid.
16#0004 Broadcast not possible. FC supports reading function.
16#C110 Modbus error.
16#0001 Modbus communication timeout.
16#0002 Modbus checksum (CRC) invalid.
16#C120 Modbus Exception Code (shown at the FC block).
16#0001 Exception Code 1 (Illegal Function).
16#0002 Exception Code 2 (Illegal Data Address).
16#0003 Exception Code 3 (Illegal Data Value).
16#0004 Exception Code 4 (Server Device Failure).
16#0005 Exception Code 5 (Acknowledge).
16#0006 Exception Code 6 (Server Device Busy).
16#0008 Exception Code 8 (Memory Parity Error).
16#000A Exception Code 10 (Gateway Path Unavailable).
16#000B Exception Code 11 (Gateway Target Device Failed To Respond).
16#C130 Invalid Response.
16#0001 Slave address of Response invalid.
16#0002 Function code of Response invalid.
16#0003 Length of Response invalid.
16#C416 Internal timeout.
16#0001 Timeout between FC and Modbus_Master.
These diagnostic codes, as well as xError, are reset by a falling edge of xActivate or xSendRequest on an FC
block.
The block displays the diagnosis of the master block and thus also the diagnosis of the serial blocks. These errors
must be reset by deactivating the affected blocks. For the diagcode description of 16#C010 - 16#C060 refer to the
serial master block diagnostic (MB_xx_xx_Master).
Modbus_RTU_9 36/192

13 MB_RTU_FC15
This function block writes multiple output bits of a Modbus slave.

13.1 Block call

13.2 Input parameters


Name Type Description
xActivate BOOL Block activation (TRUE = Active).
xSendRequest BOOL A send request to the master block is activated with a rising edge. A falling
edge deletes current Modbus errors and resets the block outputs.
xEnablePoll BOOL Cyclical polling is started with a rising edge. A falling edge deactivates the
polling.
Input xSendRequest triggers an additional request and should be deactivated
during poll mode.
Note that the outputs xDone and xError are only one cycle true.
tPollIntervall TIME If xEnablePoll is activated, then transmission is cyclical in the time interval of
the specified value.
uiSlaveAddress UINT The input specifies the address of the slave to be communicated with (1 to
255).
uiStartAddressWrite UINT The input specifies the start address of the data to be written on the slave.
iDataCount INT The input specifies the number of bits to be written on the slave (1 to 1968).
Modbus_RTU_9 37/192

13.3 Output parameters


Name Type Description
xActive BOOL TRUE: Function block is active. FALSE: Function block is not
active.
xBusy BOOL TRUE: The block is busy with the service execution.
xDone BOOL Request is sent and response from slave is successfully
received.
xError BOOL TRUE: An error has occurred. For details refer to wDiagCode
and wAddDiagCode.
wDiagCode WORD Diagnostic code. Refer to diagnostics table.
wAddDiagCode WORD Additional diagnostic code. Refer to diagnostics table.
udtDiag MB_UDT_RTU_xxx_DIAG Structure with internal variables for Diagnostic

13.4 Inout parameters


Name Type Description
arrBitValues arrModbus2_X_1_1968 The array of 1968 bits contains the desired values of the addressed
bits.
udtMBData udtModbus2_Data The block communicates via this structure with the FC blocks.
Modbus_RTU_9 38/192

13.5 Diagnostic
The diagnostics contains diagnostic codes on the FC blocks of the library. Modbus errors are indicated at the
respective FC block and need to be reset there. Thus the communication in a Modbus network is not disturbed by
an error in a request to a slave. An error at the FC block is deleted by a reset of the send input or by renewed
activation of the block.

Modbus exception codes are sent by the respective slave and contain messages specific for Modbus.

wDiagCode wAddDiagCode Description


16#0000 Block is not activated.
16#8000 Block is active and operating without errors.
16#8300 Block executes a service.
16#C100 Error during configuration (displayed on the FC block).
16#0001 Slave address is outside the valid range.
16#0002 Number of the requested data amount invalid (iDataCount).
16#0003 Function code invalid.
16#0004 Broadcast not possible. FC supports reading function.
16#C110 Modbus error.
16#0001 Modbus communication timeout.
16#0002 Modbus checksum (CRC) invalid.
16#C120 Modbus Exception Code (shown at the FC block).
16#0001 Exception Code 1 (Illegal Function).
16#0002 Exception Code 2 (Illegal Data Address).
16#0003 Exception Code 3 (Illegal Data Value).
16#0004 Exception Code 4 (Server Device Failure).
16#0005 Exception Code 5 (Acknowledge).
16#0006 Exception Code 6 (Server Device Busy).
16#0008 Exception Code 8 (Memory Parity Error).
16#000A Exception Code 10 (Gateway Path Unavailable).
16#000B Exception Code 11 (Gateway Target Device Failed To Respond).
16#C130 Invalid Response.
16#0001 Slave address of Response invalid.
16#0002 Function code of Response invalid.
16#0003 Length of Response invalid.
16#C416 Internal timeout.
16#0001 Timeout between FC and Modbus_Master.
These diagnostic codes, as well as xError, are reset by a falling edge of xActivate or xSendRequest on an FC
block.
The block displays the diagnosis of the master block and thus also the diagnosis of the serial blocks. These errors
must be reset by deactivating the affected blocks. For the diagcode description of 16#C010 - 16#C060 refer to the
serial master block diagnostic (MB_xx_xx_Master).
Modbus_RTU_9 39/192

14 MB_RTU_FC16
This function block writes multiple holding registers of a Modbus slave.

14.1 Block call

14.2 Input parameters


Name Type Description
xActivate BOOL Block activation (TRUE = Active).
xSendRequest BOOL A send request to the master block is activated with a rising edge. A falling
edge deletes current Modbus errors and resets the block outputs.
xEnablePoll BOOL Cyclical polling is started with a rising edge. A falling edge deactivates the
polling.
Input xSendRequest triggers an additional request and should be deactivated
during poll mode.
Note that the outputs xDone and xError are only one cycle true.
tPollIntervall TIME If xEnablePoll is activated, then transmission is cyclical in the time interval of
the specified value.
uiSlaveAddress UINT The input specifies the address of the slave to be communicated with (1 to
255).
uiStartAddressWrite UINT The input specifies the start address of the data to be written on the slave.
iDataCount INT The input specifies the number of registers to be written on the slave (1 to 123).
Modbus_RTU_9 40/192

14.3 Output parameters


Name Type Description
xActive BOOL TRUE: Function block is active. FALSE: Function block is not
active.
xBusy BOOL TRUE: The block is busy with the service execution.
xDone BOOL Request is sent and response from slave is successfully
received.
xError BOOL TRUE: An error has occurred. For details refer to wDiagCode
and wAddDiagCode.
wDiagCode WORD Diagnostic code. Refer to diagnostics table.
wAddDiagCode WORD Additional diagnostic code. Refer to diagnostics table.
udtDiag MB_UDT_RTU_xxx_DIAG Structure with internal variables for Diagnostic

14.4 Inout parameters


Name Type Description
arrRegisterValues arrModbus2_W_1_123 The array of 123 words contains the desired values of the
addressed register.
udtMBData udtModbus2_Data The block communicates via this structure with the FC blocks.
Modbus_RTU_9 41/192

14.5 Diagnostic
The diagnostics contains diagnostic codes on the FC blocks of the library. Modbus errors are indicated at the
respective FC block and need to be reset there. Thus the communication in a Modbus network is not disturbed by
an error in a request to a slave. An error at the FC block is deleted by a reset of the send input or by renewed
activation of the block.

Modbus exception codes are sent by the respective slave and contain messages specific for Modbus.

wDiagCode wAddDiagCode Description


16#0000 Block is not activated.
16#8000 Block is active and operating without errors.
16#8300 Block executes a service.
16#C100 Error during configuration (displayed on the FC block).
16#0001 Slave address is outside the valid range.
16#0002 Number of the requested data amount invalid (iDataCount).
16#0003 Function code invalid.
16#0004 Broadcast not possible. FC supports reading function.
16#C110 Modbus error.
16#0001 Modbus communication timeout.
16#0002 Modbus checksum (CRC) invalid.
16#C120 Modbus Exception Code (shown at the FC block).
16#0001 Exception Code 1 (Illegal Function).
16#0002 Exception Code 2 (Illegal Data Address).
16#0003 Exception Code 3 (Illegal Data Value).
16#0004 Exception Code 4 (Server Device Failure).
16#0005 Exception Code 5 (Acknowledge).
16#0006 Exception Code 6 (Server Device Busy).
16#0008 Exception Code 8 (Memory Parity Error).
16#000A Exception Code 10 (Gateway Path Unavailable).
16#000B Exception Code 11 (Gateway Target Device Failed To Respond).
16#C130 Invalid Response.
16#0001 Slave address of Response invalid.
16#0002 Function code of Response invalid.
16#0003 Length of Response invalid.
16#C416 Internal timeout.
16#0001 Timeout between FC and Modbus_Master.
These diagnostic codes, as well as xError, are reset by a falling edge of xActivate or xSendRequest on an FC
block.
The block displays the diagnosis of the master block and thus also the diagnosis of the serial blocks. These errors
must be reset by deactivating the affected blocks. For the diagcode description of 16#C010 - 16#C060 refer to the
serial master block diagnostic (MB_xx_xx_Master).
Modbus_RTU_9 42/192

15 MB_RTU_FC23
This function block writes or reads multiple holding registers of a Modbus slave.

15.1 Block call

15.2 Input parameters


Name Type Description
xActivate BOOL Block activation (TRUE = Active).
xSendRequest BOOL A send request to the master block is activated with a rising edge. A falling
edge deletes current Modbus errors and resets the block outputs.
xEnablePoll BOOL Cyclical polling is started with a rising edge. A falling edge deactivates the
polling.
Input xSendRequest triggers an additional request and should be deactivated
during poll mode.
Note that the outputs xDone and xError are only one cycle true.
tPollIntervall TIME If xEnablePoll is activated, then transmission is cyclical in the time interval of
the specified value.
uiSlaveAddress UINT The input specifies the address of the slave to be communicated with (1 to
255).
uiStartAddressRead UINT The input specifies the start address of the data to be read on the slave.
iDataCountRead INT The input specifies the amount of data to be read on the slave (1..125).
uiStartAddressWrite UINT The input specifies the start address of the data to be written on the slave.
iDataCountWrite INT The input specifies the amount of the data to be written on the slave (1..121).
Modbus_RTU_9 43/192

15.3 Output parameters


Name Type Description
xActive BOOL TRUE: Function block is active. FALSE: Function block is not
active.
xBusy BOOL TRUE: The block is busy with the service execution.
xDone BOOL Request is sent and response from slave is successfully
received.
xError BOOL TRUE: An error has occurred. For details refer to wDiagCode
and wAddDiagCode.
wDiagCode WORD Diagnostic code. Refer to diagnostics table.
wAddDiagCode WORD Additional diagnostic code. Refer to diagnostics table.
udtDiag MB_UDT_RTU_xxx_DIAG Structure with internal variables for Diagnostic

15.4 Inout parameters


Name Type Description
arrRegisterValues arrModbus2_W_1_123 The array of 123 words contains the desired values of the
addressed register.
arrReadData arrModbus2_W_1_125 The parameter contains the requested Modbus data.
udtMBData udtModbus2_Data The block communicates via this structure with the FC blocks.
Modbus_RTU_9 44/192

15.5 Diagnostic
The diagnostics contains diagnostic codes on the FC blocks of the library. Modbus errors are indicated at the
respective FC block and need to be reset there. Thus the communication in a Modbus network is not disturbed by
an error in a request to a slave. An error at the FC block is deleted by a reset of the send input or by renewed
activation of the block.

Modbus exception codes are sent by the respective slave and contain messages specific for Modbus.

wDiagCode wAddDiagCode Description


16#0000 Block is not activated.
16#8000 Block is active and operating without errors.
16#8300 Block executes a service.
16#C100 Error during configuration (displayed on the FC block).
16#0001 Slave address is outside the valid range.
16#0002 Number of the requested data amount invalid (iDataCount).
16#0003 Function code invalid.
16#0004 Broadcast not possible. FC supports reading function.
16#C110 Modbus error.
16#0001 Modbus communication timeout.
16#0002 Modbus checksum (CRC) invalid.
16#C120 Modbus Exception Code (shown at the FC block).
16#0001 Exception Code 1 (Illegal Function).
16#0002 Exception Code 2 (Illegal Data Address).
16#0003 Exception Code 3 (Illegal Data Value).
16#0004 Exception Code 4 (Server Device Failure).
16#0005 Exception Code 5 (Acknowledge).
16#0006 Exception Code 6 (Server Device Busy).
16#0008 Exception Code 8 (Memory Parity Error).
16#000A Exception Code 10 (Gateway Path Unavailable).
16#000B Exception Code 11 (Gateway Target Device Failed To Respond).
16#C130 Invalid Response.
16#0001 Slave address of Response invalid.
16#0002 Function code of Response invalid.
16#0003 Length of Response invalid.
16#C416 Internal timeout.
16#0001 Timeout between FC and Modbus_Master.
These diagnostic codes, as well as xError, are reset by a falling edge of xActivate or xSendRequest on an FC
block.
The block displays the diagnosis of the master block and thus also the diagnosis of the serial blocks. These errors
must be reset by deactivating the affected blocks. For the diagcode description of 16#C010 - 16#C060 refer to the
serial master block diagnostic (MB_xx_xx_Master).
Modbus_RTU_9 45/192

16 MB_RTU_DiagInfo_EN
If there is an error, this block shows the diagnostics of the master block as a text in English. The source code of
the block can be read and modified. To show the diagnostic messages in other languages, copy the block and
translate the diagnostic text into the desired language. The text output (strDiagInfo) is limited to 80 characters.

16.1 Block call

16.2 Input parameters


None

16.3 Output parameters


Name Type Description
strDiagInfo STRING If there is an error, the variable shows the description for the current wDiagCode and
wAddDiagCode in English.

16.4 Inout parameters


Name Type Description
udtMbData udtModbus2_Data The block communicates via this structure with the FC blocks.

16.5 Diagnostic
None
Modbus_RTU_9 46/192

17 MB_AXL_F_RSUNI_Master
This function block is used to implement a Modbus Master for the specified module type. Accordingly the function
blocks are connected inside. The required parameters have to be parameterized on this function block. The
associated parameter description refers to the description of the included function blocks.
Transparent:
Hint: Compliance with the Modbus specification with regard to InterFrameDelay(T3.5) and Inter-character time-
out(T1.5) cannot be guaranteed for technological reasons. Internal timers try to emulate this as much as possible.
Especially with slow PLC cycle times and slow bus update rates in connection with fast recurring Modbus
requests to several slaves of this library (transparent mode) timeouts may occur (uiRequestsCounter <>
uiResponsesCounter).

17.1 Function block call


Modbus_RTU_9 47/192

17.2 Input parameters


Name Type Description
xActivate BOOL Block activation (TRUE = Active).
xMode BOOL TRUE: AXL F RS UNI Module parameterized in Modbus RTU mode. FALSE: AXL
F RS UNI Module parameterized in Transparent mode.
tModbus_Timeout TIME Defines the maximum time until the Modbus response from the slave must arrive.
The default value: TIME#5s (if input is 0s). The input is copied by xActivate or
xReset if there is a rising edge.
tPD_Timeout TIME Timeout for process data communication between PLC and module. The input is
copied by xActivate or xReset if there is a rising edge. Default: TIME#2s
xReset BOOL The input resets the block. All connected FC blocks are reset as well.

17.3 Output parameters


Name Type Description
xActive BOOL TRUE: Function block is active. FALSE:
Function block is not active.
xError BOOL TRUE: An error has occurred. For details
refer to udtDiag strucure “wDiagCode” and
“wAddDiagCode”.
xBusy BOOL TRUE: The block is busy with the service
execution.
uiRequestsCounter UINT Shows the number of requests transmitted.
uiResponsesCounter UINT Shows the number of responses received.
udtDiag MB_UDT_AXL_RSUNI_DIAG_MASTER Structure with internal structures for
Diagnostic

17.4 Inout parameters


Name Type Description
udtMBData udtModbus2_Data The block communicates via this structure with the FC
blocks.
arrInputPD MB2_AXL_RSUNI2_ARR_B_0_19 IN process data.
arrOutputPD MB2_AXL_RSUNI2_ARR_B_0_19 OUT process data.
Modbus_RTU_9 48/192

17.5 Diagnosis
17.5.1 MB_RTU_Master

wDiagCode wAddDiagCode Description


16#0000 Block is not activated.
16#8000 Block is active and operating without errors.
16#8100 HW Reset phase to delete serial driver error

17.5.2 MB_AXL_RS_UNI_REC

wDiagCode wAddDiagCode Description


16#0000 16#0000 Block is not activated.
16#8000 16#0000 Block is active and operating without errors.
16#C030 Error when receiving.
16#0010 Process data timeout during the receive process between PLC and module.
16#0030 uiRcvLength is larger than the memory available in the receive buffer.
16#0040 uiRcvLength <> 0 for end-to-end protocol.
16#0060 Communication error when receiving.
16#0070 Error could not acknowledged.
16#C040 Error in intermediate storage.
16#0010 Timeout in intermediate storage.
16#C050 16#0000 Error from module:

Failure of the peripheral voltage


Invalid parameter for specified command
Modbus_RTU_9 49/192

17.5.3 MB_AXL_RS_UNI_SND

wDiagCode wAddDiagCode Description


16#0000 16#0000 Block is not activated.
16#8000 16#0000 Block is active and operating without errors.
16#C020 Error when sending.
16#0010 Process data timeout during the send process between PLC and module.
16#0020 Maximum size exceeded when sending.
16#0060 Data send error in module.
16#0070 Error could not acknowledged.
16#C030 Error when receiving.
16#0060 Communication error when receiving.
16#C040 Error in intermediate storage.
16#0010 Timeout in intermediate storage.
16#C050 16#0000 Error from module:

Failure of the peripheral voltage


Invalid parameter for specified command
Modbus_RTU_9 50/192

18 MB_AXL_F_RSUNI_Slave
This function block is used to implement a Modbus Slave for the specified module type. Accordingly the function
blocks are connected inside. The required parameters have to be parameterized on this function block. The
associated parameter description refers to the description of the included function blocks.
Hint: Compliance with the Modbus specification regarding InterFrameDelay (T3.5) and Inter-Character time-out
(T1.5) cannot be guaranteed for technological reasons. Internal timers try to replicate this as much as possible.
Especially for slow PLC cycle times and slow bus update rates in combination with fast recurring Modbus requests
to several slaves may result in packet drop (see uiNoOfFailedTransactions).

18.1 Function block call


Modbus_RTU_9 51/192

18.2 Input parameters


Name Type Description
xActivate BOOL Block activation (TRUE = Active).
xReset BOOL Rising edge: Resets the function block.
uiSlaveAddress UINT The input specifies the address of the slave to be communicated with (1 to 255).
diBaudrate DINT Current Baudrate - has to be the same like the Startup parameter. Does not override
the Startup parameter.
Baud rate in the range from 1200 baud to 500 kbaud.
uiOffset UINT The start address is increased by this value. If the input uiOffset has the value 2000,
then the register with address 3 in the request will be addressed with the address
2003 (2000 + 3).
tPD_Timeout TIME Timeout for process data communication between PLC and module. The input is
copied by xActivate or xReset if there is a rising edge. Default: TIME#2s
xReset BOOL The input resets the block. All connected FC blocks are reset as well.

18.3 Output parameters


Name Type Description
xActive BOOL TRUE: Function block is active. FALSE:
Function block is not active.
xError BOOL TRUE: An error has occurred. For details
refer to udtDiag strucure “wDiagCode” and
“wAddDiagCode”.
xBusy BOOL TRUE: The block is busy with the service
execution.
uiNoOfTransactions UINT Number of processed requests
uiNoOfFailedTransactions UINT Number of failed requests
Count up:

CRC error
Send error
Paket too long or too short

Remedial action

Increase the waiting time between 2


Modbus requests
Faster PLC cycle time
Faster bus updaterate

udtDiag MB_UDT_AXL_RSUNI_DIAG_SLAVE Structure with internal structures for


Diagnostic
Modbus_RTU_9 52/192

18.4 Inout parameters


Name Type Description
udtHoldingRegisters arrModbus2_w_0_1999 Array with 2000 words representing the holding
registers. The address range is 0-1999.
Function codes: 3,6 and 16
udtInputRegisters arrModbus2_w_2000_2999 Array with 1000 words representing the input
registers. The address range is 2000-2999.
Function code: 4
udtOutputBits arrModbus2_x_3000_3999 Array of 1000 bits representing the digital outputs.
The address range is 3000-3999.
Function codes: 1,5 and 15
udtInputBits arrModbus2_x_4000_4999 Array of 1000 bits representing digital inputs. The
address range is 4000-4999.
Function code: 2
arrInputData MB2_AXL_RSUNI2_ARR_B_0_19 IN process data.
arrOutputData MB2_AXL_RSUNI2_ARR_B_0_19 OUT process data.
Modbus_RTU_9 53/192

18.5 Diagnosis
18.5.1 MB_RTU_Slave

wDiagCode wAddDiagCode Description


16#0000 16#0000 Block is not activated.
16#8000 16#0000 Block is active and operating without errors.
16#C110 Invalid input.
16#0001 Invalid input uiSlaveAddress.
16#0002 Invalid input uiOffset.
16#0003 Invalid input diBaudrate.
16#C520 Error of an internal used FB.
16#0001 Error MB_AXL_RS_UNI_SND.
16#0002 Error MB_AXL_RS_UNI_REC.
16#0003 Error MB_RTU_AXL_Slave.

18.5.2 MB_AXL_RS_UNI_REC

wDiagCode wAddDiagCode Description


16#0000 16#0000 Block is not activated.
16#8000 16#0000 Block is active and operating without errors.
16#C030 Error when receiving.
16#0010 Process data timeout during the receive process between PLC and module.
16#0030 uiRcvLength is larger than the memory available in the receive buffer.
16#0040 uiRcvLength <> 0 for end-to-end protocol.
16#0060 Communication error when receiving.
16#0070 Error could not acknowledged.
16#C040 Error in intermediate storage.
16#0010 Timeout in intermediate storage.
16#C050 16#0000 Error from module:

Failure of the peripheral voltage


Invalid parameter for specified command
Modbus_RTU_9 54/192

18.5.3 MB_AXL_RS_UNI_SND

wDiagCode wAddDiagCode Description


16#0000 16#0000 Block is not activated.
16#8000 16#0000 Block is active and operating without errors.
16#C020 Error when sending.
16#0010 Process data timeout during the send process between PLC and module.
16#0020 Maximum size exceeded when sending.
16#0060 Data send error in module.
16#0070 Error could not acknowledged.
16#C030 Error when receiving.
16#0060 Communication error when receiving.
16#C040 Error in intermediate storage.
16#0010 Timeout in intermediate storage.
16#C050 16#0000 Error from module:

Failure of the peripheral voltage


Invalid parameter for specified command
Modbus_RTU_9 55/192

19 MB_AXL_SE_RS485_Master
This function block is used to implement a Modbus Master for the specified module type. Accordingly the function
blocks are connected inside. The required parameters have to be parameterized on this function block. The
associated parameter description refers to the description of the included function blocks.
Hint: Compliance with the Modbus specification with regard to InterFrameDelay(T3.5) and Inter-character time-
out(T1.5) cannot be guaranteed for technological reasons. Internal timers try to emulate this as much as possible.
Especially with slow PLC cycle times and slow bus update rates in connection with fast recurring Modbus
requests to several slaves of this library (transparent mode) timeouts may occur (uiRequestsCounter <>
uiResponsesCounter).

19.1 Function block call


Modbus_RTU_9 56/192

19.2 Input parameters


Name Type Description
xActivate BOOL Block activation (TRUE = Active).
tModbus_Timeout TIME Defines the maximum time until the Modbus response from the slave must arrive.
The default value: TIME#5s (if input is 0s). The input is copied by xActivate or
xReset if there is a rising edge.
tPD_Timeout TIME Timeout for process data communication between PLC and module. The input is
copied by xActivate or xReset if there is a rising edge. Default: TIME#2s
xReset BOOL The input resets the block. All connected FC blocks are reset as well.

19.3 Output parameters


Name Type Description
xActive BOOL TRUE: Function block is active. FALSE:
Function block is not active.
xError BOOL TRUE: An error has occurred. For details
refer to udtDiag strucure “wDiagCode”
and “wAddDiagCode”.
xBusy BOOL TRUE: The block is busy with the service
execution.
uiRequestsCounter UINT Shows the number of requests
transmitted.
uiResponsesCounter UINT Shows the number of responses
received.
udtDiag MB_UDT_AXL_SE_RS485_DIAG_MASTER Structure with internal structures for
Diagnostic

19.4 Inout parameters


Name Type Description
udtMBData udtModbus2_Data The block communicates via this structure with the FC
blocks.
arrInputPD MB2_AXL_RSUNI2_ARR_B_0_19 IN process data.
arrOutputPD MB2_AXL_RSUNI2_ARR_B_0_19 OUT process data.
Modbus_RTU_9 57/192

19.5 Diagnosis
19.5.1 MB_RTU_Master

wDiagCode wAddDiagCode Description


16#0000 Block is not activated.
16#8000 Block is active and operating without errors.
16#8100 HW Reset phase to delete serial driver error

19.5.2 MB_AXL_RS_UNI_REC

wDiagCode wAddDiagCode Description


16#0000 16#0000 Block is not activated.
16#8000 16#0000 Block is active and operating without errors.
16#C030 Error when receiving.
16#0010 Process data timeout during the receive process between PLC and module.
16#0030 uiRcvLength is larger than the memory available in the receive buffer.
16#0040 uiRcvLength <> 0 for end-to-end protocol.
16#0060 Communication error when receiving.
16#0070 Error could not acknowledged.
16#C040 Error in intermediate storage.
16#0010 Timeout in intermediate storage.
16#C050 16#0000 Error from module:

Failure of the peripheral voltage


Invalid parameter for specified command
Modbus_RTU_9 58/192

19.5.3 MB_AXL_RS_UNI_SND

wDiagCode wAddDiagCode Description


16#0000 16#0000 Block is not activated.
16#8000 16#0000 Block is active and operating without errors.
16#C020 Error when sending.
16#0010 Process data timeout during the send process between PLC and module.
16#0020 Maximum size exceeded when sending.
16#0060 Data send error in module.
16#0070 Error could not acknowledged.
16#C030 Error when receiving.
16#0060 Communication error when receiving.
16#C040 Error in intermediate storage.
16#0010 Timeout in intermediate storage.
16#C050 16#0000 Error from module:

Failure of the peripheral voltage


Invalid parameter for specified command
Modbus_RTU_9 59/192

20 MB_AXL_SE_RS485_Slave
This function block is used to implement a Modbus Slave for the specified module type. Accordingly the function
blocks are connected inside. The required parameters have to be parameterized on this function block. The
associated parameter description refers to the description of the included function blocks.
Hint: Compliance with the Modbus specification regarding InterFrameDelay (T3.5) and Inter-Character time-out
(T1.5) cannot be guaranteed for technological reasons. Internal timers try to replicate this as much as possible.
Especially for slow PLC cycle times and slow bus update rates in combination with fast recurring Modbus requests
to several slaves may result in packet drop (see uiNoOfFailedTransactions).

20.1 Function block call


Modbus_RTU_9 60/192

20.2 Input parameters


Name Type Description
xActivate BOOL Block activation (TRUE = Active).
xReset BOOL Rising edge: Resets the function block.
uiSlaveAddress UINT The input specifies the address of the slave to be communicated with (1 to 255).
diBaudrate DINT Current Baudrate - has to be the same like the Startup parameter. Does not override
the Startup parameter.
Baud rate in the range from 1200 baud to 500 kbaud.
uiOffset UINT The start address is increased by this value. If the input uiOffset has the value 2000,
then the register with address 3 in the request will be addressed with the address
2003 (2000 + 3).
tPD_Timeout TIME Timeout for process data communication between PLC and module. The input is
copied by xActivate or xReset if there is a rising edge. Default: TIME#2s
xReset BOOL The input resets the block. All connected FC blocks are reset as well.

20.3 Output parameters


Name Type Description
xActive BOOL TRUE: Function block is active.
FALSE: Function block is not active.
xError BOOL TRUE: An error has occurred. For
details refer to udtDiag strucure
“wDiagCode” and “wAddDiagCode”.
xBusy BOOL TRUE: The block is busy with the
service execution.
uiNoOfTransactions UINT Number of processed requests
uiNoOfFailedTransactions UINT Number of failed requests
Count up:

CRC error
Send error
Paket too long or too short

Remedial action

Increase the waiting time


between 2 Modbus requests
Faster PLC cycle time
Faster bus updaterate

udtDiag MB_UDT_AXL_SE_RS485_DIAG_SLAVE Structure with internal structures for


Diagnostic
Modbus_RTU_9 61/192

20.4 Inout parameters


Name Type Description
udtHoldingRegisters arrModbus2_w_0_1999 Array with 2000 words representing the holding
registers. The address range is 0-1999.
Function codes: 3,6 and 16
udtInputRegisters arrModbus2_w_2000_2999 Array with 1000 words representing the input
registers. The address range is 2000-2999.
Function code: 4
udtOutputBits arrModbus2_x_3000_3999 Array of 1000 bits representing the digital outputs.
The address range is 3000-3999.
Function codes: 1,5 and 15
udtInputBits arrModbus2_x_4000_4999 Array of 1000 bits representing digital inputs. The
address range is 4000-4999.
Function code: 2
arrInputData MB2_AXL_RSUNI2_ARR_B_0_19 IN process data.
arrOutputData MB2_AXL_RSUNI2_ARR_B_0_19 OUT process data.
Modbus_RTU_9 62/192

20.5 Diagnosis
20.5.1 MB_RTU_Slave

wDiagCode wAddDiagCode Description


16#0000 16#0000 Block is not activated.
16#8000 16#0000 Block is active and operating without errors.
16#C110 Invalid input.
16#0001 Invalid input uiSlaveAddress.
16#0002 Invalid input uiOffset.
16#0003 Invalid input diBaudrate.
16#C520 Error of an internal used FB.
16#0001 Error MB_AXL_RS_UNI_SND.
16#0002 Error MB_AXL_RS_UNI_REC.
16#0003 Error MB_RTU_AXL_Slave.

20.5.2 MB_AXL_RS_UNI_REC

wDiagCode wAddDiagCode Description


16#0000 16#0000 Block is not activated.
16#8000 16#0000 Block is active and operating without errors.
16#C030 Error when receiving.
16#0010 Process data timeout during the receive process between PLC and module.
16#0030 uiRcvLength is larger than the memory available in the receive buffer.
16#0040 uiRcvLength <> 0 for end-to-end protocol.
16#0060 Communication error when receiving.
16#0070 Error could not acknowledged.
16#C040 Error in intermediate storage.
16#0010 Timeout in intermediate storage.
16#C050 16#0000 Error from module:

Failure of the peripheral voltage


Invalid parameter for specified command

20.5.3 MB_AXL_RS_UNI_SND

wDiagCode wAddDiagCode Description


16#0000 16#0000 Block is not activated.
16#8000 16#0000 Block is active and operating without errors.
16#C020 Error when sending.
16#0010 Process data timeout during the send process between PLC and module.
16#0020 Maximum size exceeded when sending.
16#0060 Data send error in module.
Modbus_RTU_9 63/192

16#0070 Error could not acknowledged.


16#C030 Error when receiving.
16#0060 Communication error when receiving.
16#C040 Error in intermediate storage.
16#0010 Timeout in intermediate storage.
16#C050 16#0000 Error from module:

Failure of the peripheral voltage


Invalid parameter for specified command
Modbus_RTU_9 64/192

21 MB_AXL_SE_RS485_EF_MA
This function block is used to implement a Modbus Master for the specified module type. Accordingly the function
blocks are connected inside. The required parameters have to be parameterized on this function block. The
associated parameter description refers to the description of the included function blocks.
Hint: Compliance with the Modbus specification with regard to InterFrameDelay(T3.5) and Inter-character time-
out(T1.5) cannot be guaranteed for technological reasons. Internal timers try to emulate this as much as possible.
Especially with slow PLC cycle times and slow bus update rates in connection with fast recurring Modbus
requests to several slaves of this library (transparent mode) timeouts may occur (uiRequestsCounter <>
uiResponsesCounter).

21.1 Function block call


Modbus_RTU_9 65/192

21.2 Input parameters


Name Type Description
xActivate BOOL Block activation (TRUE = Active).
xModbus_RTU BOOL TRUE: AXL SE RS485 EF (1507978) Module parameterized in Modbus RTU
mode. FALSE: AXL SE RS485 EF (1507978) Module parameterized in
Transparent mode.
tModbus_Timeout TIME Defines the maximum time until the Modbus response from the slave must arrive.
The default value: TIME#5s (if input is 0s). The input is copied by xActivate or
xReset if there is a rising edge.
tPD_Timeout TIME Timeout for process data communication between PLC and module. The input is
copied by xActivate or xReset if there is a rising edge. Default: TIME#2s
xReset BOOL The input resets the block. All connected FC blocks are reset as well.

21.3 Output parameters


Name Type Description
xActive BOOL TRUE: Function block is active.
FALSE: Function block is not active.
xError BOOL TRUE: An error has occurred. For
details refer to udtDiag strucure
“wDiagCode” and “wAddDiagCode”.
xBusy BOOL TRUE: The block is busy with the
service execution.
uiRequestsCounter UINT Shows the number of requests
transmitted.
uiResponsesCounter UINT Shows the number of responses
received.
udtDiag MB_UDT_AXL_SE_RS485_EF_DIAG_MASTER Structure with internal structures for
Diagnostic

21.4 Inout parameters


Name Type Description
udtMBData udtModbus2_Data The block communicates via this structure with the FC blocks.
arrInputPD MB_ARR_B_0_63 IN process data.
arrOutputPD MB_ARR_B_0_63 OUT process data.
Modbus_RTU_9 66/192

21.5 Diagnosis
21.5.1 MB_RTU_Master

wDiagCode wAddDiagCode Description


16#0000 Block is not activated.
16#8000 Block is active and operating without errors.
16#8100 HW Reset phase to delete serial driver error

21.5.2 MB_AXL_RS_UNI_REC

wDiagCode wAddDiagCode Description


16#0000 16#0000 Block is not activated.
16#8000 16#0000 Block is active and operating without errors.
16#C030 Error when receiving.
16#0010 Process data timeout during the receive process between PLC and module.
16#0030 uiRcvLength is larger than the memory available in the receive buffer.
16#0040 uiRcvLength <> 0 for end-to-end protocol.
16#0060 Communication error when receiving.
16#0070 Error could not acknowledged.
16#C040 Error in intermediate storage.
16#0010 Timeout in intermediate storage.
16#C050 16#0000 Error from module:

Failure of the peripheral voltage


Invalid parameter for specified command
Modbus_RTU_9 67/192

21.5.3 MB_AXL_RS_UNI_SND

wDiagCode wAddDiagCode Description


16#0000 16#0000 Block is not activated.
16#8000 16#0000 Block is active and operating without errors.
16#C020 Error when sending.
16#0010 Process data timeout during the send process between PLC and module.
16#0020 Maximum size exceeded when sending.
16#0060 Data send error in module.
16#0070 Error could not acknowledged.
16#C030 Error when receiving.
16#0060 Communication error when receiving.
16#C040 Error in intermediate storage.
16#0010 Timeout in intermediate storage.
16#C050 16#0000 Error from module:

Failure of the peripheral voltage


Invalid parameter for specified command
Modbus_RTU_9 68/192

22 MB_AXL_SE_RS485_EF_SL
This function block is used to implement a Modbus Slave for the specified module type. Accordingly the function
blocks are connected inside. The required parameters have to be parameterized on this function block. The
associated parameter description refers to the description of the included function blocks.
Hint: Compliance with the Modbus specification regarding InterFrameDelay (T3.5) and Inter-Character time-out
(T1.5) cannot be guaranteed for technological reasons. Internal timers try to replicate this as much as possible.
Especially for slow PLC cycle times and slow bus update rates in combination with fast recurring Modbus requests
to several slaves may result in packet drop (see uiNoOfFailedTransactions).

22.1 Function block call


Modbus_RTU_9 69/192

22.2 Input parameters


Name Type Description
xActivate BOOL Block activation (TRUE = Active).
xModbus_RTU BOOL TRUE: AXL SE RS485 EF (1507978) Module parameterized in Modbus RTU mode.
FALSE: AXL SE RS485 EF (1507978) Module parameterized in Transparent mode.
xReset BOOL Rising edge: Resets the function block.
uiSlaveAddress UINT The input specifies the address of the slave to be communicated with (1 to 255).
diBaudrate DINT Current Baudrate - has to be the same like the Startup parameter. Does not override
the Startup parameter.
Baud rate in the range from 1200 baud to 500 kbaud.
uiOffset UINT The start address is increased by this value. If the input uiOffset has the value 2000,
then the register with address 3 in the request will be addressed with the address
2003 (2000 + 3).
tPD_Timeout TIME Timeout for process data communication between PLC and module. The input is
copied by xActivate or xReset if there is a rising edge. Default: TIME#2s
xReset BOOL The input resets the block. All connected FC blocks are reset as well.

22.3 Output parameters


Name Type Description
xActive BOOL TRUE: Function block is active. FALSE:
Function block is not active.
xError BOOL TRUE: An error has occurred. For details
refer to udtDiag strucure “wDiagCode” and
“wAddDiagCode”.
xBusy BOOL TRUE: The block is busy with the service
execution.
udtTransactions MB_RTU_UDT_TRANSACTIONS Structure with number of processed and
failed requests.
udtDiag MB_UDT_AXL_SE_RS485_EF_DIAG_SLAVE Structure with internal structures for
Diagnostic

22.3.1 udtTransactions

Name Type Description


uiOK UINT Number of succesfull requests
uiErrorParity UINT Number of requests with parity error
uiErrorT1_5 UINT Number of requests with T1.5 error
uiErrorCrc UINT Number of requests with CRC error
uiErrorRcvBufOverwrite UINT Number of requests with Buffer overwrite error
Modbus_RTU_9 70/192

22.4 Inout parameters


Name Type Description
udtHoldingRegisters arrModbus2_w_0_1999 Array with 2000 words representing the holding registers.
The address range is 0-1999.
Function codes: 3,6 and 16
udtInputRegisters arrModbus2_w_2000_2999 Array with 1000 words representing the input registers. The
address range is 2000-2999.
Function code: 4
udtOutputBits arrModbus2_x_3000_3999 Array of 1000 bits representing the digital outputs. The
address range is 3000-3999.
Function codes: 1,5 and 15
udtInputBits arrModbus2_x_4000_4999 Array of 1000 bits representing digital inputs. The address
range is 4000-4999.
Function code: 2
arrInputData MB_ARR_B_0_63 IN process data.
arrOutputData MB_ARR_B_0_63 OUT process data.
Modbus_RTU_9 71/192

22.5 Diagnosis
22.5.1 MB_RTU_Slave

wDiagCode wAddDiagCode Description


16#0000 16#0000 Block is not activated.
16#8000 16#0000 Block is active and operating without errors.
16#C110 Invalid input.
16#0001 Invalid input uiSlaveAddress.
16#0002 Invalid input uiOffset.
16#0003 Invalid input diBaudrate.
16#C520 Error of an internal used FB.
16#0001 Error MB_AXL_RS_UNI_SND.
16#0002 Error MB_AXL_RS_UNI_REC.
16#0003 Error MB_RTU_AXL_Slave.

22.5.2 MB_AXL_RS_UNI_REC

wDiagCode wAddDiagCode Description


16#0000 16#0000 Block is not activated.
16#8000 16#0000 Block is active and operating without errors.
16#C030 Error when receiving.
16#0010 Process data timeout during the receive process between PLC and module.
16#0030 uiRcvLength is larger than the memory available in the receive buffer.
16#0040 uiRcvLength <> 0 for end-to-end protocol.
16#0060 Communication error when receiving.
16#0070 Error could not acknowledged.
16#C040 Error in intermediate storage.
16#0010 Timeout in intermediate storage.
16#C050 16#0000 Error from module:

Failure of the peripheral voltage


Invalid parameter for specified command

22.5.3 MB_AXL_RS_UNI_SND

wDiagCode wAddDiagCode Description


16#0000 16#0000 Block is not activated.
16#8000 16#0000 Block is active and operating without errors.
16#C020 Error when sending.
16#0010 Process data timeout during the send process between PLC and module.
16#0020 Maximum size exceeded when sending.
16#0060 Data send error in module.
Modbus_RTU_9 72/192

16#0070 Error could not acknowledged.


16#C030 Error when receiving.
16#0060 Communication error when receiving.
16#C040 Error in intermediate storage.
16#0010 Timeout in intermediate storage.
16#C050 16#0000 Error from module:

Failure of the peripheral voltage


Invalid parameter for specified command
Modbus_RTU_9 73/192

23 MB_AXL_SE_RS232_Master
This function block is used to implement a Modbus Master for the specified module type. Accordingly the function
blocks are connected inside. The required parameters have to be parameterized on this function block. The
associated parameter description refers to the description of the included function blocks.
Hint: Compliance with the Modbus specification with regard to InterFrameDelay(T3.5) and Inter-character time-
out(T1.5) cannot be guaranteed for technological reasons. Internal timers try to emulate this as much as possible.
Especially with slow PLC cycle times and slow bus update rates in connection with fast recurring Modbus
requests to several slaves of this library (transparent mode) timeouts may occur (uiRequestsCounter <>
uiResponsesCounter).

23.1 Function block call


Modbus_RTU_9 74/192

23.2 Input parameters


Name Type Description
xActivate BOOL Block activation (TRUE = Active).
tModbus_Timeout TIME Defines the maximum time until the Modbus response from the slave must arrive.
The default value: TIME#5s (if input is 0s). The input is copied by xActivate or
xReset if there is a rising edge.
tPD_Timeout TIME Timeout for process data communication between PLC and module. The input is
copied by xActivate or xReset if there is a rising edge. Default: TIME#2s
xReset BOOL The input resets the block. All connected FC blocks are reset as well.

23.3 Output parameters


Name Type Description
xActive BOOL TRUE: Function block is active. FALSE:
Function block is not active.
xError BOOL TRUE: An error has occurred. For details
refer to udtDiag strucure “wDiagCode”
and “wAddDiagCode”.
xBusy BOOL TRUE: The block is busy with the service
execution.
uiRequestsCounter UINT Shows the number of requests
transmitted.
uiResponsesCounter UINT Shows the number of responses
received.
udtDiag MB_UDT_AXL_SE_RS232_DIAG_MASTER Structure with internal structures for
Diagnostic

23.4 Inout parameters


Name Type Description
udtMBData udtModbus2_Data The block communicates via this structure with the FC
blocks.
arrInputPD MB2_AXL_RSUNI2_ARR_B_0_19 IN process data.
arrOutputPD MB2_AXL_RSUNI2_ARR_B_0_19 OUT process data.
Modbus_RTU_9 75/192

23.5 Diagnosis
23.5.1 MB_RTU_Master

wDiagCode wAddDiagCode Description


16#0000 Block is not activated.
16#8000 Block is active and operating without errors.
16#8100 HW Reset phase to delete serial driver error

23.5.2 MB_AXL_RS_UNI_REC

wDiagCode wAddDiagCode Description


16#0000 16#0000 Block is not activated.
16#8000 16#0000 Block is active and operating without errors.
16#C030 Error when receiving.
16#0010 Process data timeout during the receive process between PLC and module.
16#0030 uiRcvLength is larger than the memory available in the receive buffer.
16#0040 uiRcvLength <> 0 for end-to-end protocol.
16#0060 Communication error when receiving.
16#0070 Error could not acknowledged.
16#C040 Error in intermediate storage.
16#0010 Timeout in intermediate storage.
16#C050 16#0000 Error from module:

Failure of the peripheral voltage


Invalid parameter for specified command
Modbus_RTU_9 76/192

23.5.3 MB_AXL_RS_UNI_SND

wDiagCode wAddDiagCode Description


16#0000 16#0000 Block is not activated.
16#8000 16#0000 Block is active and operating without errors.
16#C020 Error when sending.
16#0010 Process data timeout during the send process between PLC and module.
16#0020 Maximum size exceeded when sending.
16#0060 Data send error in module.
16#0070 Error could not acknowledged.
16#C030 Error when receiving.
16#0060 Communication error when receiving.
16#C040 Error in intermediate storage.
16#0010 Timeout in intermediate storage.
16#C050 16#0000 Error from module:

Failure of the peripheral voltage


Invalid parameter for specified command
Modbus_RTU_9 77/192

24 MB_AXL_SE_RS232_Slave
This function block is used to implement a Modbus Slave for the specified module type. Accordingly the function
blocks are connected inside. The required parameters have to be parameterized on this function block. The
associated parameter description refers to the description of the included function blocks.
Hint: Compliance with the Modbus specification regarding InterFrameDelay (T3.5) and Inter-Character time-out
(T1.5) cannot be guaranteed for technological reasons. Internal timers try to replicate this as much as possible.
Especially for slow PLC cycle times and slow bus update rates in combination with fast recurring Modbus requests
to several slaves may result in packet drop (see uiNoOfFailedTransactions).

24.1 Function block call


Modbus_RTU_9 78/192

24.2 Input parameters


Name Type Description
xActivate BOOL Block activation (TRUE = Active).
xReset BOOL Rising edge: Resets the function block.
uiSlaveAddress UINT The input specifies the address of the slave to be communicated with (1 to 255).
diBaudrate DINT Current Baudrate - has to be the same like the Startup parameter. Does not override
the Startup parameter.
Baud rate in the range from 1200 baud to 500 kbaud.
uiOffset UINT The start address is increased by this value. If the input uiOffset has the value 2000,
then the register with address 3 in the request will be addressed with the address
2003 (2000 + 3).
tPD_Timeout TIME Timeout for process data communication between PLC and module. The input is
copied by xActivate or xReset if there is a rising edge. Default: TIME#2s
xReset BOOL The input resets the block. All connected FC blocks are reset as well.

24.3 Output parameters


Name Type Description
xActive BOOL TRUE: Function block is active.
FALSE: Function block is not active.
xError BOOL TRUE: An error has occurred. For
details refer to udtDiag strucure
“wDiagCode” and “wAddDiagCode”.
xBusy BOOL TRUE: The block is busy with the
service execution.
uiNoOfTransactions UINT Number of processed requests
uiNoOfFailedTransactions UINT Number of failed requests
Count up:

CRC error
Send error
Paket too long or too short

Remedial action

Increase the waiting time


between 2 Modbus requests
Faster PLC cycle time
Faster bus updaterate

udtDiag MB_UDT_AXL_SE_RS232_DIAG_SLAVE Structure with internal structures for


Diagnostic
Modbus_RTU_9 79/192

24.4 Inout parameters


Name Type Description
udtHoldingRegisters arrModbus2_w_0_1999 Array with 2000 words representing the holding
registers. The address range is 0-1999.
Function codes: 3,6 and 16
udtInputRegisters arrModbus2_w_2000_2999 Array with 1000 words representing the input
registers. The address range is 2000-2999.
Function code: 4
udtOutputBits arrModbus2_x_3000_3999 Array of 1000 bits representing the digital outputs.
The address range is 3000-3999.
Function codes: 1,5 and 15
udtInputBits arrModbus2_x_4000_4999 Array of 1000 bits representing digital inputs. The
address range is 4000-4999.
Function code: 2
arrInputData MB2_AXL_RSUNI2_ARR_B_0_19 IN process data.
arrOutputData MB2_AXL_RSUNI2_ARR_B_0_19 OUT process data.
Modbus_RTU_9 80/192

24.5 Diagnosis
24.5.1 MB_RTU_Slave

wDiagCode wAddDiagCode Description


16#0000 16#0000 Block is not activated.
16#8000 16#0000 Block is active and operating without errors.
16#C110 Invalid input.
16#0001 Invalid input uiSlaveAddress.
16#0002 Invalid input uiOffset.
16#0003 Invalid input diBaudrate.
16#C520 Error of an internal used FB.
16#0001 Error MB_AXL_RS_UNI_SND.
16#0002 Error MB_AXL_RS_UNI_REC.
16#0003 Error MB_RTU_AXL_Slave.

24.5.2 MB_AXL_RS_UNI_REC

wDiagCode wAddDiagCode Description


16#0000 16#0000 Block is not activated.
16#8000 16#0000 Block is active and operating without errors.
16#C030 Error when receiving.
16#0010 Process data timeout during the receive process between PLC and module.
16#0030 uiRcvLength is larger than the memory available in the receive buffer.
16#0040 uiRcvLength <> 0 for end-to-end protocol.
16#0060 Communication error when receiving.
16#0070 Error could not acknowledged.
16#C040 Error in intermediate storage.
16#0010 Timeout in intermediate storage.
16#C050 16#0000 Error from module:

Failure of the peripheral voltage


Invalid parameter for specified command

24.5.3 MB_AXL_RS_UNI_SND

wDiagCode wAddDiagCode Description


16#0000 16#0000 Block is not activated.
16#8000 16#0000 Block is active and operating without errors.
16#C020 Error when sending.
16#0010 Process data timeout during the send process between PLC and module.
16#0020 Maximum size exceeded when sending.
16#0060 Data send error in module.
Modbus_RTU_9 81/192

16#0070 Error could not acknowledged.


16#C030 Error when receiving.
16#0060 Communication error when receiving.
16#C040 Error in intermediate storage.
16#0010 Timeout in intermediate storage.
16#C050 16#0000 Error from module:

Failure of the peripheral voltage


Invalid parameter for specified command
Modbus_RTU_9 82/192

25 MB_AXL_SE_RS232_EF_MA
This function block is used to implement a Modbus Master for the specified module type. Accordingly the function
blocks are connected inside. The required parameters have to be parameterized on this function block. The
associated parameter description refers to the description of the included function blocks.
Hint: Compliance with the Modbus specification with regard to InterFrameDelay(T3.5) and Inter-character time-
out(T1.5) cannot be guaranteed for technological reasons. Internal timers try to emulate this as much as possible.
Especially with slow PLC cycle times and slow bus update rates in connection with fast recurring Modbus
requests to several slaves of this library (transparent mode) timeouts may occur (uiRequestsCounter <>
uiResponsesCounter).

25.1 Function block call


Modbus_RTU_9 83/192

25.2 Input parameters


Name Type Description
xActivate BOOL Block activation (TRUE = Active).
xModbus_RTU BOOL TRUE: AXL SE RS232 EF (1507979) Module parameterized in Modbus RTU
mode. FALSE: AXL SE RS232 EF (1507979) Module parameterized in
Transparent mode.
tModbus_Timeout TIME Defines the maximum time until the Modbus response from the slave must arrive.
The default value: TIME#5s (if input is 0s). The input is copied by xActivate or
xReset if there is a rising edge.
tPD_Timeout TIME Timeout for process data communication between PLC and module. The input is
copied by xActivate or xReset if there is a rising edge. Default: TIME#2s
xReset BOOL The input resets the block. All connected FC blocks are reset as well.

25.3 Output parameters


Name Type Description
xActive BOOL TRUE: Function block is active.
FALSE: Function block is not active.
xError BOOL TRUE: An error has occurred. For
details refer to udtDiag strucure
“wDiagCode” and “wAddDiagCode”.
xBusy BOOL TRUE: The block is busy with the
service execution.
uiRequestsCounter UINT Shows the number of requests
transmitted.
uiResponsesCounter UINT Shows the number of responses
received.
udtDiag MB_UDT_AXL_SE_RS232_EF_DIAG_MASTER Structure with internal structures for
Diagnostic

25.4 Inout parameters


Name Type Description
udtMBData udtModbus2_Data The block communicates via this structure with the FC blocks.
arrInputPD MB_ARR_B_0_63 IN process data.
arrOutputPD MB_ARR_B_0_63 OUT process data.
Modbus_RTU_9 84/192

25.5 Diagnosis
25.5.1 MB_RTU_Master

wDiagCode wAddDiagCode Description


16#0000 Block is not activated.
16#8000 Block is active and operating without errors.
16#8100 HW Reset phase to delete serial driver error

25.5.2 MB_AXL_RS_UNI_REC

wDiagCode wAddDiagCode Description


16#0000 16#0000 Block is not activated.
16#8000 16#0000 Block is active and operating without errors.
16#C030 Error when receiving.
16#0010 Process data timeout during the receive process between PLC and module.
16#0030 uiRcvLength is larger than the memory available in the receive buffer.
16#0040 uiRcvLength <> 0 for end-to-end protocol.
16#0060 Communication error when receiving.
16#0070 Error could not acknowledged.
16#C040 Error in intermediate storage.
16#0010 Timeout in intermediate storage.
16#C050 16#0000 Error from module:

Failure of the peripheral voltage


Invalid parameter for specified command
Modbus_RTU_9 85/192

25.5.3 MB_AXL_RS_UNI_SND

wDiagCode wAddDiagCode Description


16#0000 16#0000 Block is not activated.
16#8000 16#0000 Block is active and operating without errors.
16#C020 Error when sending.
16#0010 Process data timeout during the send process between PLC and module.
16#0020 Maximum size exceeded when sending.
16#0060 Data send error in module.
16#0070 Error could not acknowledged.
16#C030 Error when receiving.
16#0060 Communication error when receiving.
16#C040 Error in intermediate storage.
16#0010 Timeout in intermediate storage.
16#C050 16#0000 Error from module:

Failure of the peripheral voltage


Invalid parameter for specified command
Modbus_RTU_9 86/192

26 MB_AXL_SE_RS232_EF_SL
This function block is used to implement a Modbus Slave for the specified module type. Accordingly the function
blocks are connected inside. The required parameters have to be parameterized on this function block. The
associated parameter description refers to the description of the included function blocks.
Hint Transparent-Mode: Compliance with the Modbus specification regarding InterFrameDelay (T3.5) and Inter-
Character time-out (T1.5) cannot be guaranteed for technological reasons. Internal timers try to replicate this as
much as possible. Especially for slow PLC cycle times and slow bus update rates in combination with fast
recurring Modbus requests to several slaves may result in packet drop (see uiNoOfFailedTransactions).

26.1 Function block call


Modbus_RTU_9 87/192

26.2 Input parameters


Name Type Description
xActivate BOOL Block activation (TRUE = Active).
xModbus_RTU BOOL TRUE: AXL SE RS232 EF (1507979) Module parameterized in Modbus RTU mode.
FALSE: AXL SE RS232 EF (1507979) Module parameterized in Transparent mode.
xReset BOOL Rising edge: Resets the function block.
uiSlaveAddress UINT The input specifies the address of the slave to be communicated with (1 to 255).
diBaudrate DINT Current Baudrate - has to be the same like the Startup parameter. Does not override
the Startup parameter.
Baud rate in the range from 1200 baud to 500 kbaud.
uiOffset UINT The start address is increased by this value. If the input uiOffset has the value 2000,
then the register with address 3 in the request will be addressed with the address
2003 (2000 + 3).
tPD_Timeout TIME Timeout for process data communication between PLC and module. The input is
copied by xActivate or xReset if there is a rising edge. Default: TIME#2s
xReset BOOL The input resets the block. All connected FC blocks are reset as well.

26.3 Output parameters


Name Type Description
xActive BOOL TRUE: Function block is active. FALSE:
Function block is not active.
xError BOOL TRUE: An error has occurred. For details
refer to udtDiag strucure “wDiagCode” and
“wAddDiagCode”.
xBusy BOOL TRUE: The block is busy with the service
execution.
udtTransactions MB_RTU_UDT_TRANSACTIONS Structure with number of processed and
failed requests.
udtDiag MB_UDT_AXL_SE_RS232_EF_DIAG_SLAVE Structure with internal structures for
Diagnostic

26.3.1 udtTransactions

Name Type Description


uiOK UINT Number of succesfull requests
uiErrorParity UINT Number of requests with parity error
uiErrorT1_5 UINT Number of requests with T1.5 error
uiErrorCrc UINT Number of requests with CRC error
uiErrorRcvBufOverwrite UINT Number of requests with Buffer overwrite error
Modbus_RTU_9 88/192

26.4 Inout parameters


Name Type Description
udtHoldingRegisters arrModbus2_w_0_1999 Array with 2000 words representing the holding registers.
The address range is 0-1999.
Function codes: 3,6 and 16
udtInputRegisters arrModbus2_w_2000_2999 Array with 1000 words representing the input registers. The
address range is 2000-2999.
Function code: 4
udtOutputBits arrModbus2_x_3000_3999 Array of 1000 bits representing the digital outputs. The
address range is 3000-3999.
Function codes: 1,5 and 15
udtInputBits arrModbus2_x_4000_4999 Array of 1000 bits representing digital inputs. The address
range is 4000-4999.
Function code: 2
arrInputData MB_ARR_B_0_63 IN process data.
arrOutputData MB_ARR_B_0_63 OUT process data.
Modbus_RTU_9 89/192

26.5 Diagnosis
26.5.1 MB_RTU_Slave

wDiagCode wAddDiagCode Description


16#0000 16#0000 Block is not activated.
16#8000 16#0000 Block is active and operating without errors.
16#C110 Invalid input.
16#0001 Invalid input uiSlaveAddress.
16#0002 Invalid input uiOffset.
16#0003 Invalid input diBaudrate.
16#C520 Error of an internal used FB.
16#0001 Error MB_AXL_RS_UNI_SND.
16#0002 Error MB_AXL_RS_UNI_REC.
16#0003 Error MB_RTU_AXL_Slave.

26.5.2 MB_AXL_RS_UNI_REC

wDiagCode wAddDiagCode Description


16#0000 16#0000 Block is not activated.
16#8000 16#0000 Block is active and operating without errors.
16#C030 Error when receiving.
16#0010 Process data timeout during the receive process between PLC and module.
16#0030 uiRcvLength is larger than the memory available in the receive buffer.
16#0040 uiRcvLength <> 0 for end-to-end protocol.
16#0060 Communication error when receiving.
16#0070 Error could not acknowledged.
16#C040 Error in intermediate storage.
16#0010 Timeout in intermediate storage.
16#C050 16#0000 Error from module:

Failure of the peripheral voltage


Invalid parameter for specified command

26.5.3 MB_AXL_RS_UNI_SND

wDiagCode wAddDiagCode Description


16#0000 16#0000 Block is not activated.
16#8000 16#0000 Block is active and operating without errors.
16#C020 Error when sending.
16#0010 Process data timeout during the send process between PLC and module.
16#0020 Maximum size exceeded when sending.
16#0060 Data send error in module.
Modbus_RTU_9 90/192

16#0070 Error could not acknowledged.


16#C030 Error when receiving.
16#0060 Communication error when receiving.
16#C040 Error in intermediate storage.
16#0010 Timeout in intermediate storage.
16#C050 16#0000 Error from module:

Failure of the peripheral voltage


Invalid parameter for specified command
Modbus_RTU_9 91/192

27 MB_IL_232P_Master
This function block is used to implement a Modbus Master for the specified module type. Accordingly the function
blocks are connected inside. The required parameters have to be parameterized on this function block. The
associated parameter description refers to the description of the included function blocks.
Hint: Compliance with the Modbus specification with regard to InterFrameDelay(T3.5) and Inter-character time-
out(T1.5) cannot be guaranteed for technological reasons. Internal timers try to emulate this as much as possible.
Especially with slow PLC cycle times and slow bus update rates in connection with fast recurring Modbus
requests to several slaves of this library (transparent mode) timeouts may occur (uiRequestsCounter <>
uiResponsesCounter).

27.1 Block call


Modbus_RTU_9 92/192

27.2 Input parameters


Name Type Description
xActivate BOOL Block activation (TRUE = Active).
diBaudrate DINT Baud rate in the range from 1200 baud to 500 kbaud. Default: 19200.
bDataWidth BYTE
0 hex = 7 data bits, even, 1 stop bit
1 hex = 7 data bits, odd, 1 stop bit
2 hex = 8 data bits, even, 1 stop bit
3 hex = 8 data bits, odd, 1 stop bit
4 hex = 8 data bits, none, 1 stop bit
5 hex = 7 data bits, none, 1 stop bit
6 hex = 7 data bits, even, 2 stop bits
7 hex = 7 data bits, odd, 2 stop bits
8 hex = 8 data bits, even, 2 stop bits
9 hex = 8 data bits, odd, 2 stop bits
A hex = 8 data bits, none, 2 stop bits
B hex = 7 data bits, none, 2 stop bits
xDTR_Control BOOL
FALSE: The DTR signal is controlled automatically.
TRUE: The DTR signal is controlled by the user.
xDTR BOOL The DTR signal is controlled. Only active if the corresponding mode is activated
(implemented via the parameterization blocks).
xCTS_Output BOOL
FALSE: CTS signal is not output.
TRUE: CTS signal is output.
tTimeout TIME Defines the maximum time until the Modbus response from the slave must arrive. The
default value: TIME#5s (if input is 0s). The input is copied by xActivate or xReset if
there is a rising edge.
tPD_Timeout TIME Timeout for process data communication between PLC and module. The input is
copied by xActivate or xReset if there is a rising edge. Default: TIME#2s
xReset BOOL The input resets the block. All connected FC blocks are reset as well.
Modbus_RTU_9 93/192

27.3 Output parameters


Name Type Description
xActive BOOL TRUE: Function block is active. FALSE:
Function block is not active.
xBusy BOOL TRUE: The block is busy with the service
execution.
xReady BOOL The block is ready to execute services. When
executing services, this parameter is FALSE.
uiRequestsCounter UINT Shows the number of requests transmitted.
uiResponsesCounter UINT Shows the number of responses received.
udtAddData MB2_COM_UDT_R232P_DATA_V1 Structure with additional status variables.
xError BOOL TRUE: An error has occurred. For details refer to
wDiagCode and wAddDiagCode.
wDiagCode WORD Diagnostic code. Refer to diagnostics table.
wAddDiagCode WORD Additional diagnostic code. Refer to diagnostics
table.
udtDiag MB_UDT_RTU_xxx_DIAG Structure with internal variables for Diagnostic

27.4 Inout parameters


Name Type Description
udtMBData udtModbus2_Data The block communicates via this structure with the FC blocks.
arrInputAddress MB2_COM_ARR_B_1_12 IN process data.
arrOutputAddress MB2_COM_ARR_B_1_12 OUT process data.
Modbus_RTU_9 94/192

27.5 Diagnostic
wDiagCode wAddDiagCode Description
16#0000 Block is not activated.
16#8000 Block is active and operating without errors.
16#8100 HW Reset phase to delete serial driver error
16#C010 Incorrect terminal type connected.
16#00XX Read terminal type.
16#FFFF Terminal is not responding.
16#C020 Incorrect parameter.
16#0010 Baud rate.
16#0020 Data width.
16#0030 Protocol.
16#0040 Terminal configuration error.
16#0100 xReceive and xSend inputs are set at the same time.
16#0110 xReceive input is set during send procedure.
16#0120 xSend input is set during receive procedure.
16#0130 Process data timeout during the parameter send process.
16#C030 Error when sending.
16#0010 Process data timeout during the send process between PLC and module.
16#0020 Maximum size when sending exceeded.
16#0030 uiSendLength too large.
16#C040 Error when receiving.
16#0010 Process data timeout during the receive process between PLC and module.
16#0020 Maximum size when receiving exceeded.
16#0030 uiRcvLength too large.
16#0040 uiRcvLength <> 0 for the end-to-end, 3964R, and dual buffer protocols.
16#C050 3964R protocol error.
16#0010 Error when sending a 3964R telegram.
16#0020 Error when receiving a 3964R telegram.
Modbus_RTU_9 95/192

28 MB_IL_232P_Slave
This function block is used to implement a Modbus Slave for the specified module type. Accordingly the function
blocks are connected inside. The required parameters have to be parameterized on this function block. The
associated parameter description refers to the description of the included function blocks.
Hint: Compliance with the Modbus specification regarding InterFrameDelay (T3.5) and Inter-Character time-out
(T1.5) cannot be guaranteed for technological reasons. Internal timers try to replicate this as much as possible.
Especially for slow PLC cycle times and slow bus update rates in combination with fast recurring Modbus requests
to several slaves may result in packet drop (see uiNoOfFailedTransactions).

28.1 Block call


Modbus_RTU_9 96/192

28.2 Input parameters


Name Type Description
xActivate BOOL Block activation (TRUE = Active).
xReset BOOL Rising edge: Resets the function block.
diBaudrate DINT Baud rate in the range from 1200 baud to 500 kbaud. Default: 19200.
bDataWidth BYTE
0 hex = 7 data bits, even, 1 stop bit
1 hex = 7 data bits, odd, 1 stop bit
2 hex = 8 data bits, even, 1 stop bit
3 hex = 8 data bits, odd, 1 stop bit
4 hex = 8 data bits, none, 1 stop bit
5 hex = 7 data bits, none, 1 stop bit
6 hex = 7 data bits, even, 2 stop bits
7 hex = 7 data bits, odd, 2 stop bits
8 hex = 8 data bits, even, 2 stop bits
9 hex = 8 data bits, odd, 2 stop bits
A hex = 8 data bits, none, 2 stop bits
B hex = 7 data bits, none, 2 stop bits
xDTR BOOL The DTR signal is controlled. Only active if the corresponding mode is activated
(implemented via the parameterization blocks).
xDTR_Control BOOL
FALSE: The DTR signal is controlled automatically.
TRUE: The DTR signal is controlled by the user.
xCTS_Output BOOL
FALSE: CTS signal is not output.
TRUE: CTS signal is output.
uiSlaveAddress UINT The input specifies the address of the slave to be communicated with (1 to 255).
uiOffset UINT The start address is increased by this value. If the input uiOffset has the value 2000,
then the register with address 3 in the request will be addressed with the address
2003 (2000 + 3).
tPD_Timeout TIME Timeout for process data communication between PLC and module. The input is
copied by xActivate or xReset if there is a rising edge. Default: TIME#2s
xReset BOOL The input resets the block. All connected FC blocks are reset as well.
Modbus_RTU_9 97/192

28.3 Output parameters


Name Type Description
xActive BOOL TRUE: Function block is active. FALSE:
Function block is not active.
xBusy BOOL TRUE: The block is busy with the service
execution.
xReady BOOL The block is ready to execute services.
When executing services, this parameter is
FALSE.
uiNoOfTransactions UINT Number of processed requests
uiNoOfFailedTransactions UINT Number of failed requests
Count up:

CRC error
Send error
Paket too long or too short

Remedial action

Increase the waiting time between 2


Modbus requests
Faster PLC cycle time
Faster bus updaterate

udtAddData MB2_COM_UDT_R232P_DATA_V1 Structure with additional status variables.


xError BOOL TRUE: An error has occurred. For details
refer to wDiagCode and wAddDiagCode.
wDiagCode WORD Diagnostic code. Refer to diagnostics table.
wAddDiagCode WORD Additional diagnostic code. Refer to
diagnostics table.
udtDiag MB_UDT_RTU_xxx_DIAG Structure with internal variables for
Diagnostic
Modbus_RTU_9 98/192

28.4 Inout parameters


Name Type Description
udtHoldingRegisters arrModbus2_w_0_1999 Array with 2000 words representing the holding registers.
The address range is 0-1999.
Function codes: 3,6 and 16
udtInputRegisters arrModbus2_w_2000_2999 Array with 1000 words representing the input registers. The
address range is 2000-2999.
Function code: 4
udtOutputBits arrModbus2_x_3000_3999 Array of 1000 bits representing the digital outputs. The
address range is 3000-3999.
Function codes: 1,5 and 15
udtInputBits arrModbus2_x_4000_4999 Array of 1000 bits representing digital inputs. The address
range is 4000-4999.
Function code: 2
arrInputAddress MB2_COM_ARR_B_1_12 IN process data.
arrOutputAddress MB2_COM_ARR_B_1_12 OUT process data.
Modbus_RTU_9 99/192

28.5 Diagnostic
wDiagCode wAddDiagCode Description
16#0000 Block is not activated.
16#8000 Block is active and operating without errors.
16#C010 Incorrect terminal type connected.
16#00XX Read terminal type.
16#FFFF Terminal is not responding.
16#C020 Incorrect parameter.
16#0010 Baud rate.
16#0020 Data width.
16#0030 Protocol.
16#0040 Terminal configuration error.
16#0100 xReceive and xSend inputs are set at the same time.
16#0110 xReceive input is set during send procedure.
16#0120 xSend input is set during receive procedure.
16#0130 Process data timeout during the parameter send process.
16#C030 Error when sending.
16#0010 Process data timeout during the send process between PLC and module.
16#0020 Maximum size when sending exceeded.
16#0030 uiSendLength too large.
16#C040 Error when receiving.
16#0010 Process data timeout during the receive process between PLC and module.
16#0020 Maximum size when receiving exceeded.
16#0030 uiRcvLength too large.
16#0040 uiRcvLength <> 0 for the end-to-end, 3964R, and dual buffer protocols.
16#C050 3964R protocol error.
16#0010 Error when sending a 3964R telegram.
16#0020 Error when receiving a 3964R telegram.
16#C110 Invalid input.
16#0001 Invalid input uiSlaveAddress.
16#0002 Invalid input uiOffset.
16#0003 Invalid input diBaudrate.
16#C520 Error of an internal used FB.
16#0001 Error of Driver 232P.
16#0002 Error of MB_RTU_IL_SLAVE.
Modbus_RTU_9 100/192

29 MB_IL_232E_Master
This function block is used to implement a Modbus Master for the specified module type. Accordingly the function
blocks are connected inside. The required parameters have to be parameterized on this function block. The
associated parameter description refers to the description of the included function blocks.
Hint: Compliance with the Modbus specification with regard to InterFrameDelay(T3.5) and Inter-character time-
out(T1.5) cannot be guaranteed for technological reasons. Internal timers try to emulate this as much as possible.
Especially with slow PLC cycle times and slow bus update rates in connection with fast recurring Modbus
requests to several slaves of this library (transparent mode) timeouts may occur (uiRequestsCounter <>
uiResponsesCounter).

29.1 Block call


Modbus_RTU_9 101/192

29.2 Input parameters


Name Type Description
xActivate BOOL Block activation (TRUE = Active).
bBaudrate BYTE
0 hex = Baudrate 110
1 hex = Baudrate 300
2 hex = Baudrate 600
3 hex = Baudrate 1200
4 hex = Baudrate 1800
5 hex = Baudrate 2400
6 hex = Baudrate 4800
7 hex = Baudrate 9600
8 hex = Baudrate 15625
9 hex = Baudrate 19200
A hex = Baudrate 38400
B-F hex = reserved
Modbus_RTU_9 102/192

bDataWidth BYTE
0 hex = 7 data bits, even, 1 stop bit
1 hex = 7 data bits, odd, 1 stop bit
2 hex = 8 data bits, even, 1 stop bit
3 hex = 8 data bits, odd, 1 stop bit
4 hex = 8 data bits, none, 1 stop bit
5 hex = 7 data bits, none, 1 stop bit
6 hex = 7 data bits, even, 2 stop bits
7 hex = 7 data bits, odd, 2 stop bits
8 hex = 8 data bits, even, 2 stop bits
9 hex = 8 data bits, odd, 2 stop bits
A hex = 8 data bits, none, 2 stop bits
B hex = 7 data bits, none, 2 stop bits
C hex = 8 data bits, constant at 0, 1 stop bits
D hex = 8 data bits, constant at 1, 1 stop bits
E hex = 6 data bits, none, 1 stop bits
F hex = Reserved

tTimeout TIME Defines the maximum time until the Modbus response from the slave must arrive. The
default value: TIME#5s (if input is 0s). The input is copied by xActivate or xReset if
there is a rising edge.
tPD_Timeout TIME Timeout for process data communication between PLC and module. The input is
copied by xActivate or xReset if there is a rising edge. Default: TIME#2s
xReset BOOL The input resets the block. All connected FC blocks are reset as well.
Modbus_RTU_9 103/192

29.3 Output parameters


Name Type Description
xActive BOOL TRUE: Function block is active. FALSE: Function block
is not active.
xBusy BOOL TRUE: The block is busy with the service execution.
xReady BOOL The block is ready to execute services. When
executing services, this parameter is FALSE.
uiRequestsCounter UINT Shows the number of requests transmitted.
uiResponsesCounter UINT Shows the number of responses received.
udtAddData MB2_RSUNI_UDT_DATA_V1 Structure with variables for diagnostics
xError BOOL TRUE: An error has occurred. For details refer to
wDiagCode and wAddDiagCode.
wDiagCode WORD Diagnostic code. Refer to diagnostics table.
wAddDiagCode WORD Additional diagnostic code. Refer to diagnostics table.
udtDiag MB_UDT_RTU_xxx_DIAG Structure with internal variables for Diagnostic

29.4 Inout parameters


Name Type Description
udtMBData udtModbus2_Data The block communicates via this structure with the FC
blocks.
arrInputAddress MB2_RSUNI_ARR_B_1_xx IN process data.
arrOutputAddress MB2_RSUNI_ARR_B_1_xx OUT process data.
Modbus_RTU_9 104/192

29.5 Diagnostic
wDiagCode wAddDiagCode Description
16#0000 Block is not activated.
16#8000 Block is active and operating without errors.
16#8100 HW Reset phase to delete serial driver error
16#C010 Incorrect parameters.
16#0010 Baud rate.
16#0020 Data width.
16#0050 Terminal configuration error.
16#0060 Communication error.
16#0080 xReceive and xSend inputs are set at the same time.
16#0090 xReceive input is set during send procedure.
16#0100 xSend input is set during receive procedure.
16#C020 Error when sending.
16#0020 Maximum size exceeded.
16#0060 Process data timeout during the send process between PLC and module.
16#C030 Error when receiving.
16#0030 uiRcvLength is larger than the memory available in the receive buffer.
16#0060 Process data timeout during the receive process between PLC and module.
Modbus_RTU_9 105/192

30 MB_IL_232E_Slave
This function block is used to implement a Modbus Slave for the specified module type. Accordingly the function
blocks are connected inside. The required parameters have to be parameterized on this function block. The
associated parameter description refers to the description of the included function blocks.
Hint: Compliance with the Modbus specification regarding InterFrameDelay (T3.5) and Inter-Character time-out
(T1.5) cannot be guaranteed for technological reasons. Internal timers try to replicate this as much as possible.
Especially for slow PLC cycle times and slow bus update rates in combination with fast recurring Modbus requests
to several slaves may result in packet drop (see uiNoOfFailedTransactions).

30.1 Block call


Modbus_RTU_9 106/192

30.2 Input parameters


Name Type Description
xActivate BOOL Block activation (TRUE = Active).
xReset BOOL Rising edge: Resets the function block.
bBaudrate BYTE
0 hex = Baudrate 110
1 hex = Baudrate 300
2 hex = Baudrate 600
3 hex = Baudrate 1200
4 hex = Baudrate 1800
5 hex = Baudrate 2400
6 hex = Baudrate 4800
7 hex = Baudrate 9600
8 hex = Baudrate 15625
9 hex = Baudrate 19200
A hex = Baudrate 38400
B-F hex = reserved
Modbus_RTU_9 107/192

bDataWidth BYTE
0 hex = 7 data bits, even, 1 stop bit
1 hex = 7 data bits, odd, 1 stop bit
2 hex = 8 data bits, even, 1 stop bit
3 hex = 8 data bits, odd, 1 stop bit
4 hex = 8 data bits, none, 1 stop bit
5 hex = 7 data bits, none, 1 stop bit
6 hex = 7 data bits, even, 2 stop bits
7 hex = 7 data bits, odd, 2 stop bits
8 hex = 8 data bits, even, 2 stop bits
9 hex = 8 data bits, odd, 2 stop bits
A hex = 8 data bits, none, 2 stop bits
B hex = 7 data bits, none, 2 stop bits
C hex = 8 data bits, constant at 0, 1 stop bits
D hex = 8 data bits, constant at 1, 1 stop bits
E hex = 6 data bits, none, 1 stop bits
F hex = Reserved
uiSlaveAddress UINT The input specifies the address of the slave to be communicated with (1 to 255).
uiOffset UINT The start address is increased by this value. If the input uiOffset has the value 2000,
then the register with address 3 in the request will be addressed with the address
2003 (2000 + 3).
tPD_Timeout TIME Timeout for process data communication between PLC and module. The input is
copied by xActivate or xReset if there is a rising edge. Default: TIME#2s
xReset BOOL The input resets the block. All connected FC blocks are reset as well.
Modbus_RTU_9 108/192

30.3 Output parameters


Name Type Description
xActive BOOL TRUE: Function block is active. FALSE: Function
block is not active.
xBusy BOOL TRUE: The block is busy with the service
execution.
xReady BOOL The block is ready to execute services. When
executing services, this parameter is FALSE.
uiNoOfTransactions UINT Number of processed requests
uiNoOfFailedTransactions UINT Number of failed requests
Count up:

CRC error
Send error
Paket too long or too short

Remedial action

Increase the waiting time between 2 Modbus


requests
Faster PLC cycle time
Faster bus updaterate

udtAddData MB2_RSUNI_UDT_DATA_V1 Structure with variables for diagnostics


xError BOOL TRUE: An error has occurred. For details refer to
wDiagCode and wAddDiagCode.
wDiagCode WORD Diagnostic code. Refer to diagnostics table.
wAddDiagCode WORD Additional diagnostic code. Refer to diagnostics
table.
udtDiag MB_UDT_RTU_xxx_DIAG Structure with internal variables for Diagnostic
Modbus_RTU_9 109/192

30.4 Inout parameters


Name Type Description
udtHoldingRegisters arrModbus2_w_0_1999 Array with 2000 words representing the holding registers.
The address range is 0-1999.
Function codes: 3,6 and 16
udtInputRegisters arrModbus2_w_2000_2999 Array with 1000 words representing the input registers.
The address range is 2000-2999.
Function code: 4
udtOutputBits arrModbus2_x_3000_3999 Array of 1000 bits representing the digital outputs. The
address range is 3000-3999.
Function codes: 1,5 and 15
udtInputBits arrModbus2_x_4000_4999 Array of 1000 bits representing digital inputs. The address
range is 4000-4999.
Function code: 2
arrInputAddress MB2_RSUNI_ARR_B_1_xx IN process data.
arrOutputAddress MB2_RSUNI_ARR_B_1_xx OUT process data.
Modbus_RTU_9 110/192

30.5 Diagnostic
wDiagCode wAddDiagCode Description
16#0000 Block is not activated.
16#8000 Block is active and operating without errors.
16#C010 Incorrect parameters.
16#0010 Baud rate.
16#0020 Data width.
16#0050 Terminal configuration error.
16#0060 Communication error.
16#0080 xReceive and xSend inputs are set at the same time.
16#0090 xReceive input is set during send procedure.
16#0100 xSend input is set during receive procedure.
16#C020 Error when sending.
16#0020 Maximum size exceeded.
16#0060 Process data timeout during the send process between PLC and module.
16#C030 Error when receiving.
16#0030 uiRcvLength is larger than the memory available in the receive buffer.
16#0060 Process data timeout during the receive process between PLC and module.
16#C110 Invalid input.
16#0001 Invalid input uiSlaveAddress.
16#0002 Invalid input uiOffset.
16#0003 Invalid input bBaudrate.
16#C520 Error of an internal used FB.
16#0001 Error of Driver 232ECO.
16#0002 Error of MB_RTU_IL_SLAVE.
Modbus_RTU_9 111/192

31 MB_IL_485E_Master
This function block is used to implement a Modbus Master for the specified module type. Accordingly the function
blocks are connected inside. The required parameters have to be parameterized on this function block. The
associated parameter description refers to the description of the included function blocks.
Hint: Compliance with the Modbus specification with regard to InterFrameDelay(T3.5) and Inter-character time-
out(T1.5) cannot be guaranteed for technological reasons. Internal timers try to emulate this as much as possible.
Especially with slow PLC cycle times and slow bus update rates in connection with fast recurring Modbus
requests to several slaves of this library (transparent mode) timeouts may occur (uiRequestsCounter <>
uiResponsesCounter).

31.1 Block call


Modbus_RTU_9 112/192

31.2 Input parameters


Name Type Description
xActivate BOOL Block activation (TRUE = Active).
bBaudrate BYTE
0 hex = Baudrate 110
1 hex = Baudrate 300
2 hex = Baudrate 600
3 hex = Baudrate 1200
4 hex = Baudrate 1800
5 hex = Baudrate 2400
6 hex = Baudrate 4800
7 hex = Baudrate 9600
8 hex = Baudrate 15625
9 hex = Baudrate 19200
A hex = Baudrate 38400
B-F hex = reserved
Modbus_RTU_9 113/192

bDataWidth BYTE
0 hex = 7 data bits, even, 1 stop bit
1 hex = 7 data bits, odd, 1 stop bit
2 hex = 8 data bits, even, 1 stop bit
3 hex = 8 data bits, odd, 1 stop bit
4 hex = 8 data bits, none, 1 stop bit
5 hex = 7 data bits, none, 1 stop bit
6 hex = 7 data bits, even, 2 stop bits
7 hex = 7 data bits, odd, 2 stop bits
8 hex = 8 data bits, even, 2 stop bits
9 hex = 8 data bits, odd, 2 stop bits
A hex = 8 data bits, none, 2 stop bits
B hex = 7 data bits, none, 2 stop bits
C hex = 8 data bits, constant at 0, 1 stop bits
D hex = 8 data bits, constant at 1, 1 stop bits
E hex = 6 data bits, none, 1 stop bits
F hex = Reserved

xReset BOOL The input resets the block. All connected FC blocks are reset as well.
tTimeout TIME Defines the maximum time until the Modbus response from the slave must arrive. The
default value: TIME#5s (if input is 0s). The input is copied by xActivate or xReset if
there is a rising edge.
tPD_Timeout TIME Timeout for process data communication between PLC and module. The input is
copied by xActivate or xReset if there is a rising edge. Default: TIME#2s
xReset BOOL The input resets the block. All connected FC blocks are reset as well.
Modbus_RTU_9 114/192

31.3 Output parameters


Name Type Description
xActive BOOL TRUE: Function block is active. FALSE: Function block
is not active.
xBusy BOOL TRUE: The block is busy with the service execution.
xReady BOOL The block is ready to execute services. When
executing services, this parameter is FALSE.
uiRequestsCounter UINT Shows the number of requests transmitted.
uiResponsesCounter UINT Shows the number of responses received.
udtAddData MB2_RSUNI_UDT_DATA_V1 Structure with variables for diagnostics
xError BOOL TRUE: An error has occurred. For details refer to
wDiagCode and wAddDiagCode.
wDiagCode WORD Diagnostic code. Refer to diagnostics table.
wAddDiagCode WORD Additional diagnostic code. Refer to diagnostics table.
udtDiag MB_UDT_RTU_xxx_DIAG Structure with internal variables for Diagnostic

31.4 Inout parameters


Name Type Description
udtMBData udtModbus2_Data The block communicates via this structure with the FC
blocks.
arrInputAddress MB2_RSUNI_ARR_B_1_xx IN process data.
arrOutputAddress MB2_RSUNI_ARR_B_1_xx OUT process data.
Modbus_RTU_9 115/192

31.5 Diagnostic
wDiagCode wAddDiagCode Description
16#0000 Block is not activated.
16#8000 Block is active and operating without errors.
16#8100 HW Reset phase to delete serial driver error
16#C010 Incorrect parameters.
16#0010 Baud rate.
16#0020 Data width.
16#0050 Terminal configuration error.
16#0060 Communication error.
16#0080 xReceive and xSend inputs are set at the same time.
16#0090 xReceive input is set during send procedure.
16#0100 xSend input is set during receive procedure.
16#C020 Error when sending.
16#0020 Maximum size exceeded.
16#0060 Process data timeout during the send process between PLC and module.
16#C030 Error when receiving.
16#0030 uiRcvLength is larger than the memory available in the receive buffer.
16#0060 Process data timeout during the receive process between PLC and module.
Modbus_RTU_9 116/192

32 MB_IL_485E_Slave
This function block is used to implement a Modbus Slave for the specified module type. Accordingly the function
blocks are connected inside. The required parameters have to be parameterized on this function block. The
associated parameter description refers to the description of the included function blocks.
Hint: Compliance with the Modbus specification regarding InterFrameDelay (T3.5) and Inter-Character time-out
(T1.5) cannot be guaranteed for technological reasons. Internal timers try to replicate this as much as possible.
Especially for slow PLC cycle times and slow bus update rates in combination with fast recurring Modbus requests
to several slaves may result in packet drop (see uiNoOfFailedTransactions).

32.1 Block call


Modbus_RTU_9 117/192

32.2 Input parameters


Name Type Description
xActivate BOOL Block activation (TRUE = Active).
xReset BOOL Rising edge: Resets the function block.
bBaudrate BYTE
0 hex = Baudrate 110
1 hex = Baudrate 300
2 hex = Baudrate 600
3 hex = Baudrate 1200
4 hex = Baudrate 1800
5 hex = Baudrate 2400
6 hex = Baudrate 4800
7 hex = Baudrate 9600
8 hex = Baudrate 15625
9 hex = Baudrate 19200
A hex = Baudrate 38400
B-F hex = reserved
Modbus_RTU_9 118/192

bDataWidth BYTE
0 hex = 7 data bits, even, 1 stop bit
1 hex = 7 data bits, odd, 1 stop bit
2 hex = 8 data bits, even, 1 stop bit
3 hex = 8 data bits, odd, 1 stop bit
4 hex = 8 data bits, none, 1 stop bit
5 hex = 7 data bits, none, 1 stop bit
6 hex = 7 data bits, even, 2 stop bits
7 hex = 7 data bits, odd, 2 stop bits
8 hex = 8 data bits, even, 2 stop bits
9 hex = 8 data bits, odd, 2 stop bits
A hex = 8 data bits, none, 2 stop bits
B hex = 7 data bits, none, 2 stop bits
C hex = 8 data bits, constant at 0, 1 stop bits
D hex = 8 data bits, constant at 1, 1 stop bits
E hex = 6 data bits, none, 1 stop bits
F hex = Reserved
uiSlaveAddress UINT The input specifies the address of the slave to be communicated with (1 to 255).
uiOffset UINT The start address is increased by this value. If the input uiOffset has the value 2000,
then the register with address 3 in the request will be addressed with the address
2003 (2000 + 3).
tPD_Timeout TIME Timeout for process data communication between PLC and module. The input is
copied by xActivate or xReset if there is a rising edge. Default: TIME#2s
xReset BOOL The input resets the block. All connected FC blocks are reset as well.
Modbus_RTU_9 119/192

32.3 Output parameters


Name Type Description
xActive BOOL TRUE: Function block is active. FALSE: Function
block is not active.
xBusy BOOL TRUE: The block is busy with the service
execution.
xReady BOOL The block is ready to execute services. When
executing services, this parameter is FALSE.
uiNoOfTransactions UINT Number of processed requests
uiNoOfFailedTransactions UINT Number of failed requests
Count up:

CRC error
Send error
Paket too long or too short

Remedial action

Increase the waiting time between 2 Modbus


requests
Faster PLC cycle time
Faster bus updaterate

udtAddData MB2_RSUNI_UDT_DATA_V1 Structure with variables for diagnostics


xError BOOL TRUE: An error has occurred. For details refer to
wDiagCode and wAddDiagCode.
wDiagCode WORD Diagnostic code. Refer to diagnostics table.
wAddDiagCode WORD Additional diagnostic code. Refer to diagnostics
table.
udtDiag MB_UDT_RTU_xxx_DIAG Structure with internal variables for Diagnostic
Modbus_RTU_9 120/192

32.4 Inout parameters


Name Type Description
udtHoldingRegisters arrModbus2_w_0_1999 Array with 2000 words representing the holding registers.
The address range is 0-1999.
Function codes: 3,6 and 16
udtInputRegisters arrModbus2_w_2000_2999 Array with 1000 words representing the input registers.
The address range is 2000-2999.
Function code: 4
udtOutputBits arrModbus2_x_3000_3999 Array of 1000 bits representing the digital outputs. The
address range is 3000-3999.
Function codes: 1,5 and 15
udtInputBits arrModbus2_x_4000_4999 Array of 1000 bits representing digital inputs. The address
range is 4000-4999.
Function code: 2
arrInputAddress MB2_RSUNI_ARR_B_1_xx IN process data.
arrOutputAddress MB2_RSUNI_ARR_B_1_xx OUT process data.
Modbus_RTU_9 121/192

32.5 Diagnostic
wDiagCode wAddDiagCode Description
16#0000 Block is not activated.
16#8000 Block is active and operating without errors.
16#C010 Incorrect parameters.
16#0010 Baud rate.
16#0020 Data width.
16#0050 Terminal configuration error.
16#0060 Communication error.
16#0080 xReceive and xSend inputs are set at the same time.
16#0090 xReceive input is set during send procedure.
16#0100 xSend input is set during receive procedure.
16#C020 Error when sending.
16#0020 Maximum size exceeded.
16#0060 Process data timeout during the send process between PLC and module.
16#C030 Error when receiving.
16#0030 uiRcvLength is larger than the memory available in the receive buffer.
16#0060 Process data timeout during the receive process between PLC and module.
16#C110 Invalid input.
16#0001 Invalid input uiSlaveAddress.
16#0002 Invalid input uiOffset.
16#0003 Invalid input bBaudrate.
16#C520 Error of an internal used FB.
16#0001 Error of Driver 485ECO.
16#0002 Error of MB_RTU_IL_SLAVE.
Modbus_RTU_9 122/192

33 MB_IL_485P_Master
This function block is used to implement a Modbus Master for the specified module type. Accordingly the function
blocks are connected inside. The required parameters have to be parameterized on this function block. The
associated parameter description refers to the description of the included function blocks.
Hint: Compliance with the Modbus specification with regard to InterFrameDelay(T3.5) and Inter-character time-
out(T1.5) cannot be guaranteed for technological reasons. Internal timers try to emulate this as much as possible.
Especially with slow PLC cycle times and slow bus update rates in connection with fast recurring Modbus
requests to several slaves of this library (transparent mode) timeouts may occur (uiRequestsCounter <>
uiResponsesCounter).

33.1 Block call


Modbus_RTU_9 123/192

33.2 Input parameters


Name Type Description
xActivate BOOL Block activation (TRUE = Active).
diBaudrate DINT Here, the baud rate can be specified freely up to 500 000. Standard values are 110,
300, 600, 1200, 1800, 2400, 4800, 9600, 19200, 38400 Default: 19200.
bDataWidth BYTE
0 hex = 7 data bits, even, 1 stop bit
1 hex = 7 data bits, odd, 1 stop bit
2 hex = 8 data bits, even, 1 stop bit
3 hex = 8 data bits, odd, 1 stop bit
4 hex = 8 data bits, none, 1 stop bit
5 hex = 7 data bits, none, 1 stop bit
6 hex = 7 data bits, even, 2 stop bits
7 hex = 7 data bits, odd, 2 stop bits
8 hex = 8 data bits, even, 2 stop bits
9 hex = 8 data bits, odd, 2 stop bits
A hex = 8 data bits, none, 2 stop bits
B hex = 7 data bits, none, 2 stop bits
xRS422 BOOL FALSE: RS485
TRUE: RS422
tTimeout TIME Defines the maximum time until the Modbus response from the slave must arrive. The
default value: TIME#5s (if input is 0s). The input is copied by xActivate or xReset if
there is a rising edge.
tPD_Timeout TIME Timeout for process data communication between PLC and module. The input is
copied by xActivate or xReset if there is a rising edge. Default: TIME#2s
xReset BOOL The input resets the block. All connected FC blocks are reset as well.
Modbus_RTU_9 124/192

33.3 Output parameters


Name Type Description
xActive BOOL TRUE: Function block is active. FALSE:
Function block is not active.
xBusy BOOL TRUE: The block is busy with the service
execution.
xReady BOOL The block is ready to execute services. When
executing services, this parameter is FALSE.
uiRequestsCounter UINT Shows the number of requests transmitted.
uiResponsesCounter UINT Shows the number of responses received.
udtAddData MB2_COM_UDT_R485P_DATA_V1 Structure with additional status variables.
xError BOOL TRUE: An error has occurred. For details refer to
wDiagCode and wAddDiagCode.
wDiagCode WORD Diagnostic code. Refer to diagnostics table.
wAddDiagCode WORD Additional diagnostic code. Refer to diagnostics
table.
udtDiag MB_UDT_RTU_xxx_DIAG Structure with internal variables for Diagnostic

33.4 Inout parameters


Name Type Description
udtMBData udtModbus2_Data The block communicates via this structure with the FC blocks.
arrInputAddress MB2_COM_ARR_B_1_12 IN process data.
arrOutputAddress MB2_COM_ARR_B_1_12 OUT process data.
Modbus_RTU_9 125/192

33.5 Diagnostic
wDiagCode wAddDiagCode Description
16#0000 Block is not activated.
16#8000 Block is active and operating without errors.
16#8100 HW Reset phase to delete serial driver error
16#C010 Incorrect terminal type connected.
16#00XX Read terminal type.
16#FFFF Terminal is not responding.
16#C020 Incorrect parameter.
16#0010 Baud rate exceeded.
16#0020 Data width.
16#0030 Protocol.
16#0040 Terminal error.
16#0050 Baudrate <= 0.
16#0070 Terminal configuration error.
16#0100 xReceive and xSend inputs are set at the same time.
16#0110 xReceive input is set during send procedure.
16#0120 xSend input is set during receive procedure.
16#C030 Error when sending.
16#0010 Process data timeout during the send process between PLC and module.
16#0020 Maximum size when sending exceeded.
16#0030 uiSendLength exceeded.
16#0040 uiSendLength > 255 with 3964R-Protocol.
16#C040 Error when receiving.
16#0010 Process data timeout during the receive process between PLC and module.
16#0020 Maximum size when receiving exceeded.
16#0030 uiRcvLength exceeded.
16#0040 uiRcvLength <> 0 for the end-to-end, 3964R, and dual buffer protocols.
16#C050 3964R protocol error.
16#0010 Error when sending a 3964R telegram.
16#0020 Error when receiving a 3964R telegram.
Modbus_RTU_9 126/192

34 MB_IL_485P_Slave
This function block is used to implement a Modbus Slave for the specified module type. Accordingly the function
blocks are connected inside. The required parameters have to be parameterized on this function block. The
associated parameter description refers to the description of the included function blocks.
Hint: Compliance with the Modbus specification regarding InterFrameDelay (T3.5) and Inter-Character time-out
(T1.5) cannot be guaranteed for technological reasons. Internal timers try to replicate this as much as possible.
Especially for slow PLC cycle times and slow bus update rates in combination with fast recurring Modbus requests
to several slaves may result in packet drop (see uiNoOfFailedTransactions).

34.1 Block call


Modbus_RTU_9 127/192

34.2 Input parameters


Name Type Description
xActivate BOOL Block activation (TRUE = Active).
xReset BOOL Rising edge: Resets the function block.
diBaudrate DINT Here, the baud rate can be specified freely up to 500 000. Standard values are 110,
300, 600, 1200, 1800, 2400, 4800, 9600, 19200, 38400 Default: 19200.
bDataWidth BYTE
0 hex = 7 data bits, even, 1 stop bit
1 hex = 7 data bits, odd, 1 stop bit
2 hex = 8 data bits, even, 1 stop bit
3 hex = 8 data bits, odd, 1 stop bit
4 hex = 8 data bits, none, 1 stop bit
5 hex = 7 data bits, none, 1 stop bit
6 hex = 7 data bits, even, 2 stop bits
7 hex = 7 data bits, odd, 2 stop bits
8 hex = 8 data bits, even, 2 stop bits
9 hex = 8 data bits, odd, 2 stop bits
A hex = 8 data bits, none, 2 stop bits
B hex = 7 data bits, none, 2 stop bits
xRS422 BOOL FALSE: RS485
TRUE: RS422
uiSlaveAddress UINT The input specifies the address of the slave to be communicated with (1 to 255).
uiOffset UINT The start address is increased by this value. If the input uiOffset has the value 2000,
then the register with address 3 in the request will be addressed with the address
2003 (2000 + 3).
tPD_Timeout TIME Timeout for process data communication between PLC and module. The input is
copied by xActivate or xReset if there is a rising edge. Default: TIME#2s
xReset BOOL The input resets the block. All connected FC blocks are reset as well.
Modbus_RTU_9 128/192

34.3 Output parameters


Name Type Description
xActive BOOL TRUE: Function block is active. FALSE:
Function block is not active.
xBusy BOOL TRUE: The block is busy with the service
execution.
xReady BOOL The block is ready to execute services.
When executing services, this parameter is
FALSE.
uiNoOfTransactions UINT Number of processed requests
uiNoOfFailedTransactions UINT Number of failed requests
Count up:

CRC error
Send error
Paket too long or too short

Remedial action

Increase the waiting time between 2


Modbus requests
Faster PLC cycle time
Faster bus updaterate

udtAddData MB2_COM_UDT_R485P_DATA_V1 Structure with additional status variables.


xError BOOL TRUE: An error has occurred. For details
refer to wDiagCode and wAddDiagCode.
wDiagCode WORD Diagnostic code. Refer to diagnostics table.
wAddDiagCode WORD Additional diagnostic code. Refer to
diagnostics table.
udtDiag MB_UDT_RTU_xxx_DIAG Structure with internal variables for
Diagnostic
Modbus_RTU_9 129/192

34.4 Inout parameters


Name Type Description
udtHoldingRegisters arrModbus2_w_0_1999 Array with 2000 words representing the holding registers.
The address range is 0-1999.
Function codes: 3,6 and 16
udtInputRegisters arrModbus2_w_2000_2999 Array with 1000 words representing the input registers. The
address range is 2000-2999.
Function code: 4
udtOutputBits arrModbus2_x_3000_3999 Array of 1000 bits representing the digital outputs. The
address range is 3000-3999.
Function codes: 1,5 and 15
udtInputBits arrModbus2_x_4000_4999 Array of 1000 bits representing digital inputs. The address
range is 4000-4999.
Function code: 2
arrInputAddress MB2_COM_ARR_B_1_12 IN process data.
arrOutputAddress MB2_COM_ARR_B_1_12 OUT process data.
Modbus_RTU_9 130/192

34.5 Diagnostic
wDiagCode wAddDiagCode Description
16#0000 Block is not activated.
16#8000 Block is active and operating without errors.
16#C010 Incorrect terminal type connected.
16#00XX Read terminal type.
16#FFFF Terminal is not responding.
16#C020 Incorrect parameter.
16#0010 Baud rate exceeded.
16#0020 Data width.
16#0030 Protocol.
16#0040 Terminal error.
16#0050 Baudrate <= 0.
16#0070 Terminal configuration error.
16#0100 xReceive and xSend inputs are set at the same time.
16#0110 xReceive input is set during send procedure.
16#0120 xSend input is set during receive procedure.
16#C030 Error when sending.
16#0010 Process data timeout during the send process between PLC and module.
16#0020 Maximum size when sending exceeded.
16#0030 uiSendLength exceeded.
16#0040 uiSendLength > 255 with 3964R-Protocol.
16#C040 Error when receiving.
16#0010 Process data timeout during the receive process between PLC and module.
16#0020 Maximum size when receiving exceeded.
16#0030 uiRcvLength exceeded.
16#0040 uiRcvLength <> 0 for the end-to-end, 3964R, and dual buffer protocols.
16#C050 3964R protocol error.
16#0010 Error when sending a 3964R telegram.
16#0020 Error when receiving a 3964R telegram.
16#C110 Invalid input.
16#0001 Invalid input uiSlaveAddress.
16#0002 Invalid input uiOffset.
16#0003 Invalid input diBaudrate.
16#C520 Error of an internal used FB.
16#0001 Error of Driver 485P.
16#0002 Error of MB_RTU_IL_SLAVE.
Modbus_RTU_9 131/192

35 MB_IL_UNI07_Master
This function block is used to implement a Modbus Master for the specified module type. Accordingly the function
blocks are connected inside. The required parameters have to be parameterized on this function block. The
associated parameter description refers to the description of the included function blocks.
Hint: Compliance with the Modbus specification with regard to InterFrameDelay(T3.5) and Inter-character time-
out(T1.5) cannot be guaranteed for technological reasons. Internal timers try to emulate this as much as possible.
Especially with slow PLC cycle times and slow bus update rates in connection with fast recurring Modbus
requests to several slaves of this library (transparent mode) timeouts may occur (uiRequestsCounter <>
uiResponsesCounter).

35.1 Block call


Modbus_RTU_9 132/192

35.2 Input parameters


Name Type Description
xActivate BOOL Block activation (TRUE = Active).
bSelectMode BYTE
0 hex = RS-232
1 hex = RS-485
2 hex = RS-422
diBaudrate DINT Here, the baud rate can be specified freely from 110 baud to 262143 baud. Standard
values are 110, 300, 600, 1200, 1800, 2400, 4800, 9600, 19200, 38400, 57600,
115200, 230400, 250000. Default: 19200.
wDataWidth WORD Write the code for the data width combination to the low byte. If you wish to use a
data width different from the standard combination, then write value 0xF to the low
byte and your desired value to the high byte. The combinations can be found in the
data sheet.
Direct specification: Bit15 to Bit8
Code: Bit7 to Bit0
0 hex = 7 data bits, even, 1 stop bit
1 hex = 7 data bits, odd, 1 stop bit
2 hex = 8 data bits, even, 1 stop bit
3 hex = 8 data bits, odd, 1 stop bit
4 hex = 8 data bits, none, 1 stop bit
5 hex = 7 data bits, none, 1 stop bit
6 hex = 7 data bits, even, 2 stop bits
7 hex = 7 data bits, odd, 2 stop bits
8 hex = 8 data bits, even, 2 stop bits
9 hex = 8 data bits, odd, 2 stop bits
A hex = 8 data bits, none, 2 stop bits
B hex = 7 data bits, none, 2 stop bits
C hex = 8 data bits, constant at 0, 1 stop bits
D hex = 8 data bits, constant at 1, 1 stop bits
E hex = 6 data bits, none, 1 stop bits
F hex = Reserved
xDTR_Control BOOL
FALSE: The DTR signal is controlled automatically.
TRUE: The DTR signal is controlled by the user.
Modbus_RTU_9 133/192

xDTR BOOL The DTR signal is controlled. Only active if the corresponding mode is activated
(implemented via the parameterization blocks).
xReset BOOL The input resets the block. All connected FC blocks are reset as well.
tTimeout TIME Defines the maximum time until the Modbus response from the slave must arrive.
The default value: TIME#5s (if input is 0s). The input is copied by xActivate or xReset
if there is a rising edge.
tPD_Timeout TIME Timeout for process data communication between PLC and module. The input is
copied by xActivate or xReset if there is a rising edge. Default: TIME#2s
xReset BOOL The input resets the block. All connected FC blocks are reset as well.

35.3 Output parameters


Name Type Description
xActive BOOL TRUE: Function block is active. FALSE: Function block
is not active.
xBusy BOOL TRUE: The block is busy with the service execution.
xReady BOOL The block is ready to execute services. When
executing services, this parameter is FALSE.
uiRequestsCounter UINT Shows the number of requests transmitted.
uiResponsesCounter UINT Shows the number of responses received.
udtAddData MB2_RSUNI_UDT_DATA_V1 Structure with variables for diagnostics
xError BOOL TRUE: An error has occurred. For details refer to
wDiagCode and wAddDiagCode.
wDiagCode WORD Diagnostic code. Refer to diagnostics table.
wAddDiagCode WORD Additional diagnostic code. Refer to diagnostics table.
udtDiag MB_UDT_RTU_xxx_DIAG Structure with internal variables for Diagnostic

35.4 Inout parameters


Name Type Description
udtMBData udtModbus2_Data The block communicates via this structure with the FC
blocks.
arrInputAddress MB2_RSUNI_ARR_B_1_xx IN process data.
arrOutputAddress MB2_RSUNI_ARR_B_1_xx OUT process data.
Modbus_RTU_9 134/192

35.5 Diagnostic
wDiagCode wAddDiagCode Description
16#0000 Block is not activated.
16#8000 Block is active and operating without errors.
16#8100 HW Reset phase to delete serial driver error
16#C010 Incorrect parameters.
16#0010 Baud rate.
16#0020 Data width.
16#0030 Protocol.
16#0040 Interface.
16#0050 Terminal configuration error.
16#0060 Communication error.
16#0070 Communication error during reset of module.
16#0080 xReceive and xSend inputs are set at the same time.
16#0090 xReceive input is set during send procedure.
16#0100 xSend input is set during receive procedure.
16#C020 Error when sending.
16#0020 Maximum size exceeded.
16#0060 Process data timeout during the send process between PLC and module.
16#C030 Error when receiving.
16#0030 uiRcvLength is longer than the memory available in the receive buffer.
16#0040 uiRcvLength <> 0 for end-to-end protocol.
16#0060 Process data timeout during the receive process between PLC and module.
Modbus_RTU_9 135/192

36 MB_IL_UNI07_Slave
This function block is used to implement a Modbus Slave for the specified module type. Accordingly the function
blocks are connected inside. The required parameters have to be parameterized on this function block. The
associated parameter description refers to the description of the included function blocks.
Hint: Compliance with the Modbus specification regarding InterFrameDelay (T3.5) and Inter-Character time-out
(T1.5) cannot be guaranteed for technological reasons. Internal timers try to replicate this as much as possible.
Especially for slow PLC cycle times and slow bus update rates in combination with fast recurring Modbus requests
to several slaves may result in packet drop (see uiNoOfFailedTransactions).

36.1 Block call


Modbus_RTU_9 136/192

36.2 Input parameters


Name Type Description
xActivate BOOL Block activation (TRUE = Active).
xReset BOOL Rising edge: Resets the function block.
bSelectMode BYTE
0 hex = RS-232
1 hex = RS-485
2 hex = RS-422
diBaudrate DINT Here, the baud rate can be specified freely from 110 baud to 262143 baud.
Standard values are 110, 300, 600, 1200, 1800, 2400, 4800, 9600, 19200, 38400,
57600, 115200, 230400, 250000. Default: 19200.
wDataWidth WORD Write the code for the data width combination to the low byte. If you wish to use a
data width different from the standard combination, then write value 0xF to the low
byte and your desired value to the high byte. The combinations can be found in the
data sheet.
Direct specification: Bit15 to Bit8
Code: Bit7 to Bit0
0 hex = 7 data bits, even, 1 stop bit
1 hex = 7 data bits, odd, 1 stop bit
2 hex = 8 data bits, even, 1 stop bit
3 hex = 8 data bits, odd, 1 stop bit
4 hex = 8 data bits, none, 1 stop bit
5 hex = 7 data bits, none, 1 stop bit
6 hex = 7 data bits, even, 2 stop bits
7 hex = 7 data bits, odd, 2 stop bits
8 hex = 8 data bits, even, 2 stop bits
9 hex = 8 data bits, odd, 2 stop bits
A hex = 8 data bits, none, 2 stop bits
B hex = 7 data bits, none, 2 stop bits
C hex = 8 data bits, constant at 0, 1 stop bits
D hex = 8 data bits, constant at 1, 1 stop bits
E hex = 6 data bits, none, 1 stop bits
F hex = Reserved
Modbus_RTU_9 137/192

xDTR_Control BOOL
FALSE: The DTR signal is controlled automatically.
TRUE: The DTR signal is controlled by the user.
xDTR BOOL The DTR signal is controlled. Only active if the corresponding mode is activated
(implemented via the parameterization blocks).
uiSlaveAddress UINT The input specifies the address of the slave to be communicated with (1 to 255).
uiOffset UINT The start address is increased by this value. If the input uiOffset has the value
2000, then the register with address 3 in the request will be addressed with the
address 2003 (2000 + 3).
tPD_Timeout TIME Timeout for process data communication between PLC and module. The input is
copied by xActivate or xReset if there is a rising edge. Default: TIME#2s
xReset BOOL The input resets the block. All connected FC blocks are reset as well.

36.3 Output parameters


Name Type Description
xActive BOOL TRUE: Function block is active. FALSE: Function
block is not active.
xBusy BOOL TRUE: The block is busy with the service
execution.
xReady BOOL The block is ready to execute services. When
executing services, this parameter is FALSE.
uiNoOfTransactions UINT Number of processed requests
uiNoOfFailedTransactions UINT Number of failed requests
Count up:

CRC error
Send error
Paket too long or too short

Remedial action

Increase the waiting time between 2 Modbus


requests
Faster PLC cycle time
Faster bus updaterate

udtAddData MB2_RSUNI_UDT_DATA_V1 Structure with variables for diagnostics


xError BOOL TRUE: An error has occurred. For details refer to
wDiagCode and wAddDiagCode.
wDiagCode WORD Diagnostic code. Refer to diagnostics table.
wAddDiagCode WORD Additional diagnostic code. Refer to diagnostics
table.
udtDiag MB_UDT_RTU_xxx_DIAG Structure with internal variables for Diagnostic
Modbus_RTU_9 138/192

36.4 Inout parameters


Name Type Description
udtHoldingRegisters arrModbus2_w_0_1999 Array with 2000 words representing the holding registers.
The address range is 0-1999.
Function codes: 3,6 and 16
udtInputRegisters arrModbus2_w_2000_2999 Array with 1000 words representing the input registers.
The address range is 2000-2999.
Function code: 4
udtOutputBits arrModbus2_x_3000_3999 Array of 1000 bits representing the digital outputs. The
address range is 3000-3999.
Function codes: 1,5 and 15
udtInputBits arrModbus2_x_4000_4999 Array of 1000 bits representing digital inputs. The address
range is 4000-4999.
Function code: 2
arrInputAddress MB2_RSUNI_ARR_B_1_xx IN process data.
arrOutputAddress MB2_RSUNI_ARR_B_1_xx OUT process data.
Modbus_RTU_9 139/192

36.5 Diagnostic
wDiagCode wAddDiagCode Description
16#0000 Block is not activated.
16#8000 Block is active and operating without errors.
16#C010 Incorrect parameters.
16#0010 Baud rate.
16#0020 Data width.
16#0030 Protocol.
16#0040 Interface.
16#0050 Terminal configuration error.
16#0060 Communication error.
16#0070 Communication error during reset of module.
16#0080 xReceive and xSend inputs are set at the same time.
16#0090 xReceive input is set during send procedure.
16#0100 xSend input is set during receive procedure.
16#C020 Error when sending.
16#0020 Maximum size exceeded.
16#0060 Process data timeout during the send process between PLC and module.
16#C030 Error when receiving.
16#0030 uiRcvLength is longer than the memory available in the receive buffer.
16#0040 uiRcvLength <> 0 for end-to-end protocol.
16#0060 Process data timeout during the receive process between PLC and module.
16#C110 Invalid input.
16#0001 Invalid input uiSlaveAddress.
16#0002 Invalid input uiOffset.
16#0003 Invalid input diBaudrate.
16#C520 Error of an internal used FB.
16#0001 Error of Driver ILRSUNI.
16#0002 Error of MB_RTU_IL_SLAVE.
Modbus_RTU_9 140/192

37 MB_IL_UNI15_Master
This function block is used to implement a Modbus Master for the specified module type. Accordingly the function
blocks are connected inside. The required parameters have to be parameterized on this function block. The
associated parameter description refers to the description of the included function blocks.
Hint: Compliance with the Modbus specification with regard to InterFrameDelay(T3.5) and Inter-character time-
out(T1.5) cannot be guaranteed for technological reasons. Internal timers try to emulate this as much as possible.
Especially with slow PLC cycle times and slow bus update rates in connection with fast recurring Modbus
requests to several slaves of this library (transparent mode) timeouts may occur (uiRequestsCounter <>
uiResponsesCounter).

37.1 Block call


Modbus_RTU_9 141/192

37.2 Input parameters


Name Type Description
xActivate BOOL Block activation (TRUE = Active).
bSelectMode BYTE
0 hex = RS-232
1 hex = RS-485
2 hex = RS-422
diBaudrate DINT Here, the baud rate can be specified freely from 110 baud to 262143 baud. Standard
values are 110, 300, 600, 1200, 1800, 2400, 4800, 9600, 19200, 38400, 57600,
115200, 230400, 250000. Default: 19200.
wDataWidth WORD Write the code for the data width combination to the low byte. If you wish to use a
data width different from the standard combination, then write value 0xF to the low
byte and your desired value to the high byte. The combinations can be found in the
data sheet.
Direct specification: Bit15 to Bit8
Code: Bit7 to Bit0
0 hex = 7 data bits, even, 1 stop bit
1 hex = 7 data bits, odd, 1 stop bit
2 hex = 8 data bits, even, 1 stop bit
3 hex = 8 data bits, odd, 1 stop bit
4 hex = 8 data bits, none, 1 stop bit
5 hex = 7 data bits, none, 1 stop bit
6 hex = 7 data bits, even, 2 stop bits
7 hex = 7 data bits, odd, 2 stop bits
8 hex = 8 data bits, even, 2 stop bits
9 hex = 8 data bits, odd, 2 stop bits
A hex = 8 data bits, none, 2 stop bits
B hex = 7 data bits, none, 2 stop bits
C hex = 8 data bits, constant at 0, 1 stop bits
D hex = 8 data bits, constant at 1, 1 stop bits
E hex = 6 data bits, none, 1 stop bits
F hex = Reserved
xDTR_Control BOOL
FALSE: The DTR signal is controlled automatically.
TRUE: The DTR signal is controlled by the user.
Modbus_RTU_9 142/192

xDTR BOOL The DTR signal is controlled. Only active if the corresponding mode is activated
(implemented via the parameterization blocks).
tTimeout TIME Defines the maximum time until the Modbus response from the slave must arrive.
The default value: TIME#5s (if input is 0s). The input is copied by xActivate or xReset
if there is a rising edge.
tPD_Timeout TIME Timeout for process data communication between PLC and module. The input is
copied by xActivate or xReset if there is a rising edge. Default: TIME#2s
xReset BOOL The input resets the block. All connected FC blocks are reset as well.

37.3 Output parameters


Name Type Description
xActive BOOL TRUE: Function block is active. FALSE: Function block
is not active.
xBusy BOOL TRUE: The block is busy with the service execution.
xReady BOOL The block is ready to execute services. When
executing services, this parameter is FALSE.
uiRequestsCounter UINT Shows the number of requests transmitted.
uiResponsesCounter UINT Shows the number of responses received.
udtAddData MB2_RSUNI_UDT_DATA_V1 Structure with variables for diagnostics
xError BOOL TRUE: An error has occurred. For details refer to
wDiagCode and wAddDiagCode.
wDiagCode WORD Diagnostic code. Refer to diagnostics table.
wAddDiagCode WORD Additional diagnostic code. Refer to diagnostics table.
udtDiag MB_UDT_RTU_xxx_DIAG Structure with internal variables for Diagnostic

37.4 Inout parameters


Name Type Description
udtMBData udtModbus2_Data The block communicates via this structure with the FC
blocks.
arrInputAddress MB2_RSUNI_ARR_B_1_xx IN process data.
arrOutputAddress MB2_RSUNI_ARR_B_1_xx OUT process data.
Modbus_RTU_9 143/192

37.5 Diagnostic
wDiagCode wAddDiagCode Description
16#0000 Block is not activated.
16#8000 Block is active and operating without errors.
16#8100 HW Reset phase to delete serial driver error
16#C010 Incorrect parameters.
16#0010 Baud rate.
16#0020 Data width.
16#0030 Protocol.
16#0040 Interface.
16#0050 Terminal configuration error.
16#0060 Communication error.
16#0070 Communication error during reset of module.
16#0080 xReceive and xSend inputs are set at the same time.
16#0090 xReceive input is set during send procedure.
16#0100 xSend input is set during receive procedure.
16#C020 Error when sending.
16#0020 Maximum size exceeded.
16#0060 Process data timeout during the send process between PLC and module.
16#C030 Error when receiving.
16#0030 uiRcvLength is longer than the memory available in the receive buffer.
16#0040 uiRcvLength <> 0 for end-to-end protocol.
16#0060 Process data timeout during the receive process between PLC and module.
Modbus_RTU_9 144/192

38 MB_IL_UNI15_Slave
This function block is used to implement a Modbus Slave for the specified module type. Accordingly the function
blocks are connected inside. The required parameters have to be parameterized on this function block. The
associated parameter description refers to the description of the included function blocks.
Hint: Compliance with the Modbus specification regarding InterFrameDelay (T3.5) and Inter-Character time-out
(T1.5) cannot be guaranteed for technological reasons. Internal timers try to replicate this as much as possible.
Especially for slow PLC cycle times and slow bus update rates in combination with fast recurring Modbus requests
to several slaves may result in packet drop (see uiNoOfFailedTransactions).

38.1 Block call


Modbus_RTU_9 145/192

38.2 Input parameters


Name Type Description
xActivate BOOL Block activation (TRUE = Active).
xReset BOOL Rising edge: Resets the function block.
bSelectMode BYTE
0 hex = RS-232
1 hex = RS-485
2 hex = RS-422
diBaudrate DINT Here, the baud rate can be specified freely from 110 baud to 262143 baud.
Standard values are 110, 300, 600, 1200, 1800, 2400, 4800, 9600, 19200, 38400,
57600, 115200, 230400, 250000. Default: 19200.
wDataWidth WORD Write the code for the data width combination to the low byte. If you wish to use a
data width different from the standard combination, then write value 0xF to the low
byte and your desired value to the high byte. The combinations can be found in the
data sheet.
Direct specification: Bit15 to Bit8
Code: Bit7 to Bit0
0 hex = 7 data bits, even, 1 stop bit
1 hex = 7 data bits, odd, 1 stop bit
2 hex = 8 data bits, even, 1 stop bit
3 hex = 8 data bits, odd, 1 stop bit
4 hex = 8 data bits, none, 1 stop bit
5 hex = 7 data bits, none, 1 stop bit
6 hex = 7 data bits, even, 2 stop bits
7 hex = 7 data bits, odd, 2 stop bits
8 hex = 8 data bits, even, 2 stop bits
9 hex = 8 data bits, odd, 2 stop bits
A hex = 8 data bits, none, 2 stop bits
B hex = 7 data bits, none, 2 stop bits
C hex = 8 data bits, constant at 0, 1 stop bits
D hex = 8 data bits, constant at 1, 1 stop bits
E hex = 6 data bits, none, 1 stop bits
F hex = Reserved
Modbus_RTU_9 146/192

xDTR_Control BOOL
FALSE: The DTR signal is controlled automatically.
TRUE: The DTR signal is controlled by the user.
xDTR BOOL The DTR signal is controlled. Only active if the corresponding mode is activated
(implemented via the parameterization blocks).
uiSlaveAddress UINT The input specifies the address of the slave to be communicated with (1 to 255).
uiOffset UINT The start address is increased by this value. If the input uiOffset has the value
2000, then the register with address 3 in the request will be addressed with the
address 2003 (2000 + 3).
tPD_Timeout TIME Timeout for process data communication between PLC and module. The input is
copied by xActivate or xReset if there is a rising edge. Default: TIME#2s
xReset BOOL The input resets the block. All connected FC blocks are reset as well.

38.3 Output parameters


Name Type Description
xActive BOOL TRUE: Function block is active. FALSE: Function
block is not active.
xBusy BOOL TRUE: The block is busy with the service
execution.
xReady BOOL The block is ready to execute services. When
executing services, this parameter is FALSE.
uiNoOfTransactions UINT Number of processed requests
uiNoOfFailedTransactions UINT Number of failed requests
Count up:

CRC error
Send error
Paket too long or too short

Remedial action

Increase the waiting time between 2 Modbus


requests
Faster PLC cycle time
Faster bus updaterate

udtAddData MB2_RSUNI_UDT_DATA_V1 Structure with variables for diagnostics


xError BOOL TRUE: An error has occurred. For details refer to
wDiagCode and wAddDiagCode.
wDiagCode WORD Diagnostic code. Refer to diagnostics table.
wAddDiagCode WORD Additional diagnostic code. Refer to diagnostics
table.
udtDiag MB_UDT_RTU_xxx_DIAG Structure with internal variables for Diagnostic
Modbus_RTU_9 147/192

38.4 Inout parameters


Name Type Description
udtHoldingRegisters arrModbus2_w_0_1999 Array with 2000 words representing the holding registers.
The address range is 0-1999.
Function codes: 3,6 and 16
udtInputRegisters arrModbus2_w_2000_2999 Array with 1000 words representing the input registers.
The address range is 2000-2999.
Function code: 4
udtOutputBits arrModbus2_x_3000_3999 Array of 1000 bits representing the digital outputs. The
address range is 3000-3999.
Function codes: 1,5 and 15
udtInputBits arrModbus2_x_4000_4999 Array of 1000 bits representing digital inputs. The address
range is 4000-4999.
Function code: 2
arrInputAddress MB2_RSUNI_ARR_B_1_xx IN process data.
arrOutputAddress MB2_RSUNI_ARR_B_1_xx OUT process data.
Modbus_RTU_9 148/192

38.5 Diagnostic
wDiagCode wAddDiagCode Description
16#0000 Block is not activated.
16#8000 Block is active and operating without errors.
16#C010 Incorrect parameters.
16#0010 Baud rate.
16#0020 Data width.
16#0030 Protocol.
16#0040 Interface.
16#0050 Terminal configuration error.
16#0060 Communication error.
16#0070 Communication error during reset of module.
16#0080 xReceive and xSend inputs are set at the same time.
16#0090 xReceive input is set during send procedure.
16#0100 xSend input is set during receive procedure.
16#C020 Error when sending.
16#0020 Maximum size exceeded.
16#0060 Process data timeout during the send process between PLC and module.
16#C030 Error when receiving.
16#0030 uiRcvLength is longer than the memory available in the receive buffer.
16#0040 uiRcvLength <> 0 for end-to-end protocol.
16#0060 Process data timeout during the receive process between PLC and module.
16#C110 Invalid input.
16#0001 Invalid input uiSlaveAddress.
16#0002 Invalid input uiOffset.
16#0003 Invalid input diBaudrate.
16#C520 Error of an internal used FB.
16#0001 Error of Driver ILRSUNI.
16#0002 Error of MB_RTU_IL_SLAVE.
Modbus_RTU_9 149/192

39 MB_IL_UNI31_Master
This function block is used to implement a Modbus Master for the specified module type. Accordingly the function
blocks are connected inside. The required parameters have to be parameterized on this function block. The
associated parameter description refers to the description of the included function blocks.
Hint: Compliance with the Modbus specification with regard to InterFrameDelay(T3.5) and Inter-character time-
out(T1.5) cannot be guaranteed for technological reasons. Internal timers try to emulate this as much as possible.
Especially with slow PLC cycle times and slow bus update rates in connection with fast recurring Modbus
requests to several slaves of this library (transparent mode) timeouts may occur (uiRequestsCounter <>
uiResponsesCounter).

39.1 Block call


Modbus_RTU_9 150/192

39.2 Input parameters


Name Type Description
xActivate BOOL Block activation (TRUE = Active).
bSelectMode BYTE
0 hex = RS-232
1 hex = RS-485
2 hex = RS-422
diBaudrate DINT Here, the baud rate can be specified freely from 110 baud to 262143 baud. Standard
values are 110, 300, 600, 1200, 1800, 2400, 4800, 9600, 19200, 38400, 57600,
115200, 230400, 250000. Default: 19200.
wDataWidth WORD Write the code for the data width combination to the low byte. If you wish to use a
data width different from the standard combination, then write value 0xF to the low
byte and your desired value to the high byte. The combinations can be found in the
data sheet.
Direct specification: Bit15 to Bit8
Code: Bit7 to Bit0
0 hex = 7 data bits, even, 1 stop bit
1 hex = 7 data bits, odd, 1 stop bit
2 hex = 8 data bits, even, 1 stop bit
3 hex = 8 data bits, odd, 1 stop bit
4 hex = 8 data bits, none, 1 stop bit
5 hex = 7 data bits, none, 1 stop bit
6 hex = 7 data bits, even, 2 stop bits
7 hex = 7 data bits, odd, 2 stop bits
8 hex = 8 data bits, even, 2 stop bits
9 hex = 8 data bits, odd, 2 stop bits
A hex = 8 data bits, none, 2 stop bits
B hex = 7 data bits, none, 2 stop bits
C hex = 8 data bits, constant at 0, 1 stop bits
D hex = 8 data bits, constant at 1, 1 stop bits
E hex = 6 data bits, none, 1 stop bits
F hex = Reserved
xDTR_Control BOOL
FALSE: The DTR signal is controlled automatically.
TRUE: The DTR signal is controlled by the user.
Modbus_RTU_9 151/192

xDTR BOOL The DTR signal is controlled. Only active if the corresponding mode is activated
(implemented via the parameterization blocks).
tTimeout TIME Defines the maximum time until the Modbus response from the slave must arrive.
The default value: TIME#5s (if input is 0s). The input is copied by xActivate or xReset
if there is a rising edge.
tPD_Timeout TIME Timeout for process data communication between PLC and module. The input is
copied by xActivate or xReset if there is a rising edge. Default: TIME#2s
xReset BOOL The input resets the block. All connected FC blocks are reset as well.

39.3 Output parameters


Name Type Description
xActive BOOL TRUE: Function block is active. FALSE: Function block
is not active.
xBusy BOOL TRUE: The block is busy with the service execution.
xReady BOOL The block is ready to execute services. When
executing services, this parameter is FALSE.
uiRequestsCounter UINT Shows the number of requests transmitted.
uiResponsesCounter UINT Shows the number of responses received.
udtAddData MB2_RSUNI_UDT_DATA_V1 Structure with variables for diagnostics
xError BOOL TRUE: An error has occurred. For details refer to
wDiagCode and wAddDiagCode.
wDiagCode WORD Diagnostic code. Refer to diagnostics table.
wAddDiagCode WORD Additional diagnostic code. Refer to diagnostics table.
udtDiag MB_UDT_RTU_xxx_DIAG Structure with internal variables for Diagnostic

39.4 Inout parameters


Name Type Description
udtMBData udtModbus2_Data The block communicates via this structure with the FC
blocks.
arrInputAddress MB2_RSUNI_ARR_B_1_xx IN process data.
arrOutputAddress MB2_RSUNI_ARR_B_1_xx OUT process data.
Modbus_RTU_9 152/192

39.5 Diagnostic
wDiagCode wAddDiagCode Description
16#0000 Block is not activated.
16#8000 Block is active and operating without errors.
16#8100 HW Reset phase to delete serial driver error
16#C010 Incorrect parameters.
16#0010 Baud rate.
16#0020 Data width.
16#0030 Protocol.
16#0040 Interface.
16#0050 Terminal configuration error.
16#0060 Communication error.
16#0070 Communication error during reset of module.
16#0080 xReceive and xSend inputs are set at the same time.
16#0090 xReceive input is set during send procedure.
16#0100 xSend input is set during receive procedure.
16#C020 Error when sending.
16#0020 Maximum size exceeded.
16#0060 Process data timeout during the send process between PLC and module.
16#C030 Error when receiving.
16#0030 uiRcvLength is longer than the memory available in the receive buffer.
16#0040 uiRcvLength <> 0 for end-to-end protocol.
16#0060 Process data timeout during the receive process between PLC and module.
Modbus_RTU_9 153/192

40 MB_IL_UNI31_Slave
This function block is used to implement a Modbus Slave for the specified module type. Accordingly the function
blocks are connected inside. The required parameters have to be parameterized on this function block. The
associated parameter description refers to the description of the included function blocks.
Hint: Compliance with the Modbus specification regarding InterFrameDelay (T3.5) and Inter-Character time-out
(T1.5) cannot be guaranteed for technological reasons. Internal timers try to replicate this as much as possible.
Especially for slow PLC cycle times and slow bus update rates in combination with fast recurring Modbus requests
to several slaves may result in packet drop (see uiNoOfFailedTransactions).

40.1 Block call


Modbus_RTU_9 154/192

40.2 Input parameters


Name Type Description
xActivate BOOL Block activation (TRUE = Active).
xReset BOOL Rising edge: Resets the function block.
bSelectMode BYTE
0 hex = RS-232
1 hex = RS-485
2 hex = RS-422
diBaudrate DINT Here, the baud rate can be specified freely from 110 baud to 262143 baud.
Standard values are 110, 300, 600, 1200, 1800, 2400, 4800, 9600, 19200, 38400,
57600, 115200, 230400, 250000. Default: 19200.
wDataWidth WORD Write the code for the data width combination to the low byte. If you wish to use a
data width different from the standard combination, then write value 0xF to the low
byte and your desired value to the high byte. The combinations can be found in the
data sheet.
Direct specification: Bit15 to Bit8
Code: Bit7 to Bit0
0 hex = 7 data bits, even, 1 stop bit
1 hex = 7 data bits, odd, 1 stop bit
2 hex = 8 data bits, even, 1 stop bit
3 hex = 8 data bits, odd, 1 stop bit
4 hex = 8 data bits, none, 1 stop bit
5 hex = 7 data bits, none, 1 stop bit
6 hex = 7 data bits, even, 2 stop bits
7 hex = 7 data bits, odd, 2 stop bits
8 hex = 8 data bits, even, 2 stop bits
9 hex = 8 data bits, odd, 2 stop bits
A hex = 8 data bits, none, 2 stop bits
B hex = 7 data bits, none, 2 stop bits
C hex = 8 data bits, constant at 0, 1 stop bits
D hex = 8 data bits, constant at 1, 1 stop bits
E hex = 6 data bits, none, 1 stop bits
F hex = Reserved
Modbus_RTU_9 155/192

xDTR_Control BOOL
FALSE: The DTR signal is controlled automatically.
TRUE: The DTR signal is controlled by the user.
xDTR BOOL The DTR signal is controlled. Only active if the corresponding mode is activated
(implemented via the parameterization blocks).
uiSlaveAddress UINT The input specifies the address of the slave to be communicated with (1 to 255).
uiOffset UINT The start address is increased by this value. If the input uiOffset has the value
2000, then the register with address 3 in the request will be addressed with the
address 2003 (2000 + 3).
tPD_Timeout TIME Timeout for process data communication between PLC and module. The input is
copied by xActivate or xReset if there is a rising edge. Default: TIME#2s
xReset BOOL The input resets the block. All connected FC blocks are reset as well.

40.3 Output parameters


Name Type Description
xActive BOOL TRUE: Function block is active. FALSE: Function
block is not active.
xBusy BOOL TRUE: The block is busy with the service
execution.
xReady BOOL The block is ready to execute services. When
executing services, this parameter is FALSE.
uiNoOfTransactions UINT Number of processed requests
uiNoOfFailedTransactions UINT Number of failed requests
Count up:

CRC error
Send error
Paket too long or too short

Remedial action

Increase the waiting time between 2 Modbus


requests
Faster PLC cycle time
Faster bus updaterate

udtAddData MB2_RSUNI_UDT_DATA_V1 Structure with variables for diagnostics


xError BOOL TRUE: An error has occurred. For details refer to
wDiagCode and wAddDiagCode.
wDiagCode WORD Diagnostic code. Refer to diagnostics table.
wAddDiagCode WORD Additional diagnostic code. Refer to diagnostics
table.
udtDiag MB_UDT_RTU_xxx_DIAG Structure with internal variables for Diagnostic
Modbus_RTU_9 156/192

40.4 Inout parameters


Name Type Description
udtHoldingRegisters arrModbus2_w_0_1999 Array with 2000 words representing the holding registers.
The address range is 0-1999.
Function codes: 3,6 and 16
udtInputRegisters arrModbus2_w_2000_2999 Array with 1000 words representing the input registers.
The address range is 2000-2999.
Function code: 4
udtOutputBits arrModbus2_x_3000_3999 Array of 1000 bits representing the digital outputs. The
address range is 3000-3999.
Function codes: 1,5 and 15
udtInputBits arrModbus2_x_4000_4999 Array of 1000 bits representing digital inputs. The address
range is 4000-4999.
Function code: 2
arrInputAddress MB2_RSUNI_ARR_B_1_xx IN process data.
arrOutputAddress MB2_RSUNI_ARR_B_1_xx OUT process data.
Modbus_RTU_9 157/192

40.5 Diagnostic
wDiagCode wAddDiagCode Description
16#0000 Block is not activated.
16#8000 Block is active and operating without errors.
16#C010 Incorrect parameters.
16#0010 Baud rate.
16#0020 Data width.
16#0030 Protocol.
16#0040 Interface.
16#0050 Terminal configuration error.
16#0060 Communication error.
16#0070 Communication error during reset of module.
16#0080 xReceive and xSend inputs are set at the same time.
16#0090 xReceive input is set during send procedure.
16#0100 xSend input is set during receive procedure.
16#C020 Error when sending.
16#0020 Maximum size exceeded.
16#0060 Process data timeout during the send process between PLC and module.
16#C030 Error when receiving.
16#0030 uiRcvLength is longer than the memory available in the receive buffer.
16#0040 uiRcvLength <> 0 for end-to-end protocol.
16#0060 Process data timeout during the receive process between PLC and module.
16#C110 Invalid input.
16#0001 Invalid input uiSlaveAddress.
16#0002 Invalid input uiOffset.
16#0003 Invalid input diBaudrate.
16#C520 Error of an internal used FB.
16#0001 Error of Driver ILRSUNI.
16#0002 Error of MB_RTU_IL_SLAVE.
Modbus_RTU_9 158/192

41 Startup examples
For the startup instruction of the Modbus_RTU function blocks please find the following examples:

MB_*_EXA_AXL_MA.zwt
MB_*_EXA_AXL_SL.zwt
MB_*_EXA_IL_MA.zwt
MB_*_EXA_IL_SL.zwt
MB_*_EXA_SE_RS232_MA.zwt
MB_*_EXA_SE_RS232_SL.zwt
MB_*_EXA_SE_RS485_MA.zwt
MB_*_EXA_SE_RS485_SL.zwt
MB_*_EXA_SE_RS485_EF_MA.zwt
MB_*_EXA_SE_RS485_EF_SL.zwt
MB_*_EXA_SE_RS232_EF_MA.zwt
MB_*_EXA_SE_RS232_EF_SL.zwt

These examples can be found in the “Examples” folder of the zipped file of the library.
They describe the communication between Modbus Master and Modbus Slave.
The serial interface from the Master (MA) example must be connected with the serial interface from the Slave (SL)
example via RS485 (two wires and termination at each end).

41.1 Example 1: MB_*_EXA_AXL_MA


This example project describes the startup of MB_AXL_F_RSUNI_Master function block with AXL F RS UNI 1H
(2688666).

41.1.1 Bus structure


For this example, the following hardware is used:

AXC 1050 (2700988)


AXL F RS UNI 1H (2688666)
Modbus_RTU_9 159/192

41.1.2 Example description


The Modbus master as well as the FC blocks are connected with each other via a structure.

41.1.2.1 Example machine

To start the example set the xStart input of the Example function block to TRUE.

41.1.2.2 State machine


CASE udtExample.iState OF
0: (* wait for xStart *)
IF xStart = TRUE THEN
udtExample.iState := 100;
END_IF;
100: (* Start Master *)
udtExample.udtMB_AXL_RSUNI_Master.tModbus_Timeout := TIME#5s;
udtExample.udtMB_AXL_RSUNI_Master.tPD_Timeout := TIME#2s;
udtExample.udtMB_AXL_RSUNI_Master.xMode := FALSE;
udtExample.udtMB_AXL_RSUNI_Master.xActivate := TRUE;
udtExample.iState := 200;
200: (* wait for Master xActive and xReady *)
IF udtExample.udtMB_AXL_RSUNI_Master.xError = TRUE THEN
udtExample.iState := 9000;
ELSIF
udtExample.udtMB_AXL_RSUNI_Master.xActive = TRUE AND
udtExample.udtMB_AXL_RSUNI_Master.xError = FALSE
THEN
udtExample.iState := 300;
END_IF;
300: (* Activate FC1 *)
udtExample.udtMB_RTU_FC1.xActivate := TRUE;
udtExample.udtMB_RTU_FC1.xSendRequest := FALSE;
udtExample.udtMB_RTU_FC1.uiSlaveAddress := UINT#1;
udtExample.udtMB_RTU_FC1.xEnablePoll := FALSE;
udtExample.udtMB_RTU_FC1.tPollInterval := T#0s;
udtExample.udtMB_RTU_FC1.uiStartAddress := UINT#3000;
udtExample.udtMB_RTU_FC1.iDataCount := 100;
IF udtExample.udtMB_RTU_FC1.xError = TRUE THEN
udtExample.iState := 9000;
ELSIF
udtExample.udtMB_RTU_FC1.xActive = TRUE AND
udtExample.udtMB_RTU_FC1.xError = FALSE AND
udtExample.udtMB_RTU_FC1.xBusy = FALSE
THEN (* wait for xActive of FC1 *)
udtExample.iState := 400;
END_IF;
400: (* Activate FC2 *)
udtExample.udtMB_RTU_FC2.xActivate := TRUE;
udtExample.udtMB_RTU_FC2.xSendRequest := FALSE;
udtExample.udtMB_RTU_FC2.uiSlaveAddress := UINT#1;
Modbus_RTU_9 160/192

udtExample.udtMB_RTU_FC2.xEnablePoll := FALSE;
udtExample.udtMB_RTU_FC2.tPollInterval := T#0s;
udtExample.udtMB_RTU_FC2.uiStartAddress := UINT#4000;
udtExample.udtMB_RTU_FC2.iDataCount := 100;
IF udtExample.udtMB_RTU_FC2.xError = TRUE THEN
udtExample.iState := 9000;
ELSIF (* wait for xActive of FC2 *)
udtExample.udtMB_RTU_FC2.xActive = TRUE AND
udtExample.udtMB_RTU_FC2.xError = FALSE AND
udtExample.udtMB_RTU_FC2.xBusy = FALSE
THEN
udtExample.iState := 500;
END_IF;
500: (* start send request FC1 *)
udtExample.udtMB_RTU_FC1.xSendRequest := TRUE;
IF udtExample.udtMB_RTU_FC1.xError = TRUE THEN
udtExample.iState := 9000;
ELSIF (* wait for xDone of FC1 *)
udtExample.udtMB_RTU_FC1.xActive = TRUE AND
udtExample.udtMB_RTU_FC1.xError = FALSE AND
udtExample.udtMB_RTU_FC1.xBusy = FALSE AND
udtExample.udtMB_RTU_FC1.xDone = TRUE
THEN
udtExample.udtMB_RTU_FC1.xSendRequest := FALSE;
udtExample.iState := 600;
END_IF;
600: (* start send request FC2 *)
udtExample.udtMB_RTU_FC2.xSendRequest := TRUE;
IF udtExample.udtMB_RTU_FC2.xError = TRUE THEN
udtExample.iState := 9000;
ELSIF (* wait for xDone of FC2 *)
udtExample.udtMB_RTU_FC2.xActive = TRUE AND
udtExample.udtMB_RTU_FC2.xError = FALSE AND
udtExample.udtMB_RTU_FC2.xBusy = FALSE AND
udtExample.udtMB_RTU_FC2.xDone = TRUE
THEN
udtExample.udtMB_RTU_FC2.xSendRequest := FALSE;
udtExample.iState := 32000;
END_IF;
9000: (* Error handling *)
(* Implement your error handling here *)
(* In this example: wait for xStart = FALSE and reset *)
IF xStart = FALSE THEN
udtExample.udtMB_AXL_RSUNI_Master.xActivate := FALSE;
udtExample.udtMB_RTU_FC1.xActivate := FALSE;
udtExample.udtMB_RTU_FC2.xActivate := FALSE;
udtExample.iState := 32000;
END_IF;
32000: (* Finish - Wait for deactivation - xStart = FALSE *)
IF xStart = FALSE THEN
udtExample.udtMB_AXL_RSUNI_Master.xActivate := FALSE;
udtExample.udtMB_RTU_FC1.xActivate := FALSE;
udtExample.udtMB_RTU_FC2.xActivate := FALSE;
END_IF;
IF
udtExample.udtMB_AXL_RSUNI_Master.xActive = FALSE AND
udtExample.udtMB_RTU_FC1.xActive = FALSE AND
udtExample.udtMB_RTU_FC2.xActive = FALSE
THEN
udtExample.iState := 0;
Modbus_RTU_9 161/192

END_IF;
END_CASE;
iState := udtExample.iState;
Modbus_RTU_9 162/192

41.2 Example 2: MB_*_EXA_AXL_SL


This example project shows the startup of MB_AXL_F_RSUNI_Slave function block with AXL F RS UNI 1H
(2688666) module.

41.2.1 Bus structure


For this example, the following hardware is used:

ILC 370 PN 2TX-IB (2876915)


AXL F BK PN (2701815)
AXL F RS UNI 1H (2688666)

41.2.2 Example description


To start the example set the xStart input of the Example function block to TRUE.

41.2.2.1 Example machine


Modbus_RTU_9 163/192

41.2.2.2 State machine


CASE udtExample.iState OF
0: (* Wait for xStart *)
IF xStart = TRUE THEN
udtExample.iState := 100;
END_IF;
100: (* Para MB_AXL_RSUNI_SLAVE *)
udtExample.udtMB_AXL_RSUNI_Slave.uiSlaveAddress := UINT#1;
udtExample.udtMB_AXL_RSUNI_Slave.tPD_Timeout := TIME#2s;
(* set to current baudrate *)
udtExample.udtMB_AXL_RSUNI_Slave.diBaudrate := DINT#9600;
udtExample.udtMB_AXL_RSUNI_Slave.xActivate := TRUE;
IF udtExample.udtMB_AXL_RSUNI_Slave.xError = TRUE THEN
udtExample.iState := 9000;
ELSIF (* Wait for xActive of MB_AXL_RSUNI_SLAVE *)
udtExample.udtMB_AXL_RSUNI_Slave.xActive = TRUE AND
udtExample.udtMB_AXL_RSUNI_Slave.xBusy = FALSE AND
udtExample.udtMB_AXL_RSUNI_Slave.xError = FALSE
THEN
udtExample.iState := 200;
END_IF;
200: (* Wait for deactivation *)
IF udtExample.udtMB_AXL_RSUNI_Slave.xError = TRUE THEN
udtExample.iState := 9000;
ELSIF xStart = FALSE THEN
udtExample.udtMB_AXL_RSUNI_Slave.xActivate := FALSE;
udtExample.iState := 32000;
END_IF;
9000: (* Error handling *)
(* Implement your error handling here *)
(* In this example: wait for xStart = FALSE and reset *)
IF xStart = FALSE THEN
udtExample.udtMB_AXL_RSUNI_Slave.xActivate := FALSE;
udtExample.iState := 32000;
END_IF;
32000: (* Finish - Wait for deactivation - xStart = FALSE *)
IF xStart = FALSE THEN
udtExample.udtMB_AXL_RSUNI_Slave.xActivate := FALSE;
END_IF;
IF
udtExample.udtMB_AXL_RSUNI_Slave.xActive = FALSE AND
udtExample.udtMB_AXL_RSUNI_Slave.xBusy = FALSE AND
udtExample.udtMB_AXL_RSUNI_Slave.xError = FALSE
THEN
udtExample.iState := 0;
END_IF;
END_CASE;
iState := udtExample.iState;
Modbus_RTU_9 164/192

41.3 Example 3: MB_*_EXA_IL_MA


This example project shows the startup of MB_IL_485E_MASTER function block with IB IL RS 485-ECO (2702141)
module.

41.3.1 Bus structure


For this example, the following hardware is used:

ILC 370 PN 2TX-IB (2876915)


IB IL RS 485-ECO (2702141)

41.3.2 Example description


To start the example set the xStart input of the Example function block to TRUE.

41.3.2.1 Example machine

Refer to Example 1.
Modbus_RTU_9 165/192

41.4 Example 4: MB_*_EXA_IL_SL


This example project shows the startup of MB_IL_485E_SLAVE function block with IB IL RS 485-ECO (2702141)
module.

41.4.1 Bus structure


For this example, the following hardware is used:

AXC 1050 (2700988)


IL PN BK-PAC (2403696)
IB IL RS 485-ECO (2702141)

41.4.2 Example description


To start the example set the xStart input of the Example function block to TRUE.

41.4.2.1 Example machine

Refer to Example 2.
Modbus_RTU_9 166/192

41.5 Example 5: MB_*_EXA_SE_RS232_MA


This example project shows the startup of MB_AXL_SE_RS232_MASTER function block with AXL SE RS232
(1181787) module.

41.5.1 Bus structure


For this example, the following hardware is used:

AXC 1050 (2700988)


AXL SE RS232 (1181787)
AXL SE SC-A (1088134)
AXL SE SC-A (1088134)
AXL SE SC-A (1088134)

41.5.2 Example description


To start the example set the xStart input of the Example function block to TRUE.

41.5.2.1 Example machine

Refer to Example 1.
Modbus_RTU_9 167/192

41.6 Example 6: MB_*_EXA_SE_RS232_SL


This example project shows the startup of MB_AXL_SE_RS232_SLAVE function block with AXL SE RS232
(1181787) module.

41.6.1 Bus structure


For this example, the following hardware is used:

ILC 370 PN 2TX-IB (2876915)


AXL F BK PN (2701815)
AXL SE RS232 (1181787)
AXL SE SC-A (1088134)
AXL SE SC-A (1088134)
AXL SE SC-A (1088134)

41.6.2 Example description


To start the example set the xStart input of the Example function block to TRUE.

41.6.2.1 Example machine

Refer to Example 2.
Modbus_RTU_9 168/192

41.7 Example 7: MB_*_EXA_SE_RS485_MA


This example project shows the startup of MB_AXL_SE_RS485_MASTER function block with AXL SE RS485
(1088128) module.

41.7.1 Bus structure


For this example, the following hardware is used:

AXC 1050 (2700988)


AXL SE RS485 (1088128)
AXL SE SC-A (1088134)
AXL SE SC-A (1088134)
AXL SE SC-A (1088134)

41.7.2 Example description


To start the example set the xStart input of the Example function block to TRUE.

41.7.2.1 Example machine

Refer to Example 1.
Modbus_RTU_9 169/192

41.8 Example 8: MB_*_EXA_SE_RS485_SL


This example project shows the startup of MB_AXL_SE_RS485_SLAVE function block with AXL SE RS485
(1088128) module.

41.8.1 Bus structure


For this example, the following hardware is used:

ILC 370 PN 2TX-IB (2876915)


AXL F BK PN (2701815)
AXL SE RS485 (1088128)
AXL SE SC-A (1088134)
AXL SE SC-A (1088134)
AXL SE SC-A (1088134)

41.8.2 Example description


To start the example set the xStart input of the Example function block to TRUE.

41.8.2.1 Example machine

Refer to Example 2.
Modbus_RTU_9 170/192

41.9 Example 9: MB_*_EXA_SE_RS485_EF_MA


This example project shows the startup of MB_AXL_SE_RS485_EF_MA function block with AXL SE RS485 EF
(1507978) module.

41.9.1 Bus structure


For this example, the following hardware is used:

AXC 1050 (2700988)


AXL SE RS485 EF (1507978)
AXL SE SC-A (1088134)
AXL SE SC-A (1088134)
AXL SE SC-A (1088134)

41.9.2 Example description


To start the example set the xStart input of the Example function block to TRUE.

41.9.2.1 Example machine

Refer to Example 1.
Modbus_RTU_9 171/192

41.10 Example 10: MB_*_EXA_SE_RS485_EF_SL


This example project shows the startup of MB_AXL_SE_RS485_EF_SL function block with AXL SE RS485 EF
(1507978) module.

41.10.1 Bus structure


For this example, the following hardware is used:

ILC 370 PN 2TX-IB (2876915)


AXL F BK PN (2701815)
AXL SE RS485 EF (1507978)
AXL SE SC-A (1088134)
AXL SE SC-A (1088134)
AXL SE SC-A (1088134)

41.10.2 Example description


To start the example set the xStart input of the Example function block to TRUE.

41.10.2.1 Example machine

Refer to Example 2.
Modbus_RTU_9 172/192

41.11 Example 11: MB_*_EXA_SE_RS232_EF_MA


This example project shows the startup of MB_AXL_SE_RS232_EF_MA function block with AXL SE RS232 EF
(1507979) module.

41.11.1 Bus structure


For this example, the following hardware is used:

AXC 1050 (2700988)


AXL SE RS232 EF (1507979)
AXL SE SC-A (1088134)
AXL SE SC-A (1088134)
AXL SE SC-A (1088134)

41.11.2 Example description


To start the example set the xStart input of the Example function block to TRUE.

41.11.2.1 Example machine

Refer to Example 1.
Modbus_RTU_9 173/192

41.12 Example 12: MB_*_EXA_SE_RS232_EF_SL


This example project shows the startup of MB_AXL_SE_RS232_EF_SL function block with AXL SE RS232 EF
(1507979) module.

41.12.1 Bus structure


For this example, the following hardware is used:

ILC 370 PN 2TX-IB (2876915)


AXL F BK PN (2701815)
AXL SE RS232 EF (1507979)
AXL SE SC-A (1088134)
AXL SE SC-A (1088134)
AXL SE SC-A (1088134)

41.12.2 Example description


To start the example set the xStart input of the Example function block to TRUE.

41.12.2.1 Example machine

Refer to Example 2.
Modbus_RTU_9 174/192

42 Security
42.1 Used third party components (TPC)
This function block library does not use any third party components.

42.2 Security context


42.2.1 General

42.2.2 Security specifications


In this library no technology is used that provides any security threats. Therefore no measures were taken.
Modbus_RTU_9 175/192

43 Appendix
43.1 Modbus_RTU runtime
To simplify the correct selection of task cycle time, bus cycle time, data width and baud rate, the Modbus packet
runtime at different settings is shown below.

43.1.1 Theoretical runtime


43.1.1.1 Calculation of the transmission time on the serial line depending on the baud rate and the serial
settings.

Optimum case (without tolerances from the specification):


Modbus_RTU Mode:
8 Data Bits + 1 Start Bit + 1 Parity Bit (or additional Stop Bit) + 1 Stop Bit.

8 Data Bits = 11 Bits on the line


Optimally without gaps between the characters
RS485 symbol rate 1 baud = 1 bit/s

Determination of the data length:


Telegram structure:

1 byte slave address


1 byte Function Code (FC)
0 to 252 Byte(s) Data (FC Header + Data)
2 bytes CRC

The data field contains the header of the FC code and if necessary the queried or to be written data. See Modbus
specification.
Example FC 4 read 125 registers:
Request:

Data length = Slave address + Function Code + Data (here only FC4 header) + CRC
Data length [Byte] = 1 Byte + 1 Byte + 4 Byte + 2 Byte = 8 Byte

Response:

Data length = Slave address + Function Code + Data (here FC4 header + 125 registers) + CRC
Data length [Byte] = 1 Byte + 1 Byte + (1 + 2*125) Byte + 2 Byte = 255 Byte

Calculation of the transmission duration:


Transmission duration [ms] = Data length [byte] * 11 [bit/byte] * 1000 [ms/s] / Baud rate [bit/s].
Modbus_RTU_9 176/192

Example FC 4: Calculation of the theoretically possible transmission time via the serial line (terminal to terminal):

1 Register 1 Register 125 Registers 125 Registers


Baud rate/ data Request Response Request Response
length (Master -> (Slave -> Master) (Master -> Slave) Slave -> Master)
Slave)
1200 Baud 73,33 ms 64,17 ms 73,33 ms 2337,50 ms
9600 Baud 9,17 ms 8,02 ms 9,17 ms 292,19 ms
38400 Baud 2,29 ms 2,01 ms 2,29 ms 73,05 ms
Worst case (maximum utilization of tolerances)
Modbus_RTU Mode:
8 Data Bits + 1 Start Bit + 1 Parity Bit (or additional Stop Bit) + 1 Stop Bit.

8 Data Bits = 11 Bits on the line


Up to incl. 19200 baud: In worst case 1.5 character times pause between each character
From 19200 baud: In worst case 0.75 ms pause between each character

Calculation of the InterCharacterTimeout time:

up to 19200 Baud: InterCharacterTimeout [ms/Byte] = 1.5 * 11 [Bit/Byte] * 1000 [ms/s] / Baudrate [Bit/s]
from 19200 baud: InterCharacterTimeout [ms/Byte]) = 0.75 [ms/Byte]

Calculation of the transmission time:


Transmission time [ms] = Data length [byte] * (11 [bit/byte] * 1000 [ms/s] / Baud rate [bit/s] +
InterCharacterTimeout [ms/byte])
Example FC 4: Calculation of the max. permissible transmission time via the serial line (terminal to terminal):
1 Register 1 Register 125 Registers 125 Registers
Baud rate/ data Request Response Request Response
length (Master -> (Slave -> Master) (Master -> Slave) (Slave -> Master)
Slave)
1200 Baud 183,33 ms 160,42 ms 183,33 ms 5843,75 ms
9600 Baud 22,92 ms 20,05 ms 22,92 ms 730,47 ms
38400 Baud 5,73 ms 5,01 ms 5,73 ms 182,62 ms
Modbus_RTU_9 177/192

43.1.1.2 Factors that additionally influence the transmission time

Required transmission time from the software to the terminal:


Valid for: MB_IL_xxx_Master, MB_AXL_xxx_Master, MB_IL_xxx_Slave, MB_AXL_xxx_Slave
The duration depends on the amount of data to be sent, since sending to the wire is not started until all data to be
sent has been transferred to the terminal (buffering). This depends on the PLC cycle time, the bus cycle time, the
data width and the response speed of the terminal.
The most decisive factors here are PLC cycle time, bus cycle time, data quantity and data width of the terminal.
This must be coordinated with each other!
Required transmission time from the terminal to the software:
Here it depends in particular on the used parameterization of the terminal.
Transparent Modus (Inline + Axioline):
Data is not buffered on the terminal and is transferred from the terminal to the software on request immediately
after receipt. Incl. 2 byte CRC. The decisive factor for maximum efficiency is that as much data as possible can be
delivered to the PLC via the bus cycle time and data width as is received via the serial line. The PLC cycle time
must also be less than or equal to the bus cycle time. If the baud rate is slow, high transmission power to the
controller is also not required.
Modbus_RTU (AXL F RS UNI only):
Data is stored temporarily on the terminal until it is complete and only then can it be retrieved. This delays the
transfer considerably, especially at slow baud rates, combined with large data volumes and slow CPU and bus
speeds.
The disadvantage is reduced if the amount of data is small, the baud rate is very high and the CPU and bus cycle
time is fast. In addition, the CRC on the terminal is removed, so that 2 bytes less than with “Transparent” must be
retrieved.
The occurring delay due to buffering can be calculated ((data quantity [BYTE] * 11/8) / baud rate).
Modbus_RTU_9 178/192

43.1.1.3 Optimal system setting

Sending large quantities of data:


For example FC15 + FC16 + FC23 with a lot of data:
A high baud rate is recommended. This is one of the largest adjusting screws in relation to the overall speed.

Master side:
If large amounts of data are sent, a fast task and bus cycle time and a large process data width are
decisive on the master side, since buffering is only performed on the terminal. This can be much larger,
regardless of the baud rate. -> The larger the process data width, the better!
It is also almost irrelevant whether the parameterization Modbus_RTU or Transparent is selected, since
the response has only a small amount of data and can always be retrieved with one cycle.
Slave side:
On the slave side, however, it is sufficient to adapt the bus cycle time and task cycle time to the baud
rate. It is best to do this so that the data can be processed at the same speed as it arrives via the serial
line.

Fast repetitive sending of small amounts of data:


For example FC5, FC6 or FC15 + FC16 + FC23 with less data:
A standard baud rate is sufficient. This reduces the susceptibility to errors.

Master side:
If possible, the terminal with the process data size should be selected, in whose user data width the
Modbus request finds place.
The parameterization Modbus_RTU in connection with an Axioline RS UNI terminal is suitable, since
the CRC is calculated in the terminal and thus does not have to be transferred to the terminal (saves 2
bytes) and the FB software requires somewhat fewer cycles than with Inline.
Slave side:
If possible, the terminal with the process data size should be selected, in whose user data width the
Modbus request finds place.
Due to the cycle saving, an Axioline terminal is also suitable here (regardless of whether RS UNI or RS
485). However, these can only be used on the slave side with transparent parameterization.
Modbus_RTU_9 179/192

Receiving large amounts of data:


For example FC1, FC2, FC3, FC4 with many data:
A high baud rate is recommended. This is one of the largest adjusting screws in relation to the overall speed.

Master side:
If large amounts of data are received, it is worth using the transparent mode. It is sufficient to adjust
the bus cycle time and task cycle time to the baud rate. It is best to do this so that the data can be
processed at the same speed as it arrives via the serial line. The larger the process data width, the
slower the bus cycle time and task cycle time can be set!
If data are received in Modbus_RTU_Mode (currently only possible with AXL RS UNI) a fastest possible
CPU and bus cycle time and a high baud rate must be selected. Nevertheless the total reception time
is not insignificantly extended by the previous buffering.
Slave side:
If large amounts of data are sent from the slave back to the master, a fast task and bus cycle time and
a large data width are decisive on the slave side, since buffering is first performed on the terminal. This
can be much larger independent of the baud rate. -> the faster, the better!

Fast repetitive receiving of small amounts of data:


For example FC1, FC2, FC3, FC4 with less data:
A standard baud rate is sufficient. This reduces the susceptibility to errors.

Master side:
If possible, the terminal with the process data size should be selected, in whose user data width the
Modbus response finds place.
The parameterization Modbus_RTU in connection with an Axioline RS UNI terminal is suitable, since
the CRC is calculated in the terminal and thus does not have to be transferred to the terminal (saves 2
bytes) and the FB software requires somewhat fewer cycles than with Inline.
Slave side:
If possible, the terminal with the process data size should be selected, in whose user data width the
Modbus response finds place.
Due to the cycle saving, an Axioline terminal is also suitable here (regardless of whether RS UNI or RS
485). However, these can only be used on the slave side with transparent parameterization.
Modbus_RTU_9 180/192

43.1.2 Practical runtime tests


The tests are based on the recommended settings of the author.
The time starts with sending a request at the FC function block and ends after receiving the response from the
slave with the Done at the FC function block.
System settings:

Task cycle time: 0.5 x bus update rate


Bus update rate: 8 ms / 16 ms

43.1.2.1 Read

FC3 read 1 Holding register:

HW / Baudrate 1200 Baud 9600 Baud 38400 Baud


AXL RS UNI 244 ms / 269 ms 83 ms / 150 ms 60 ms / 99 ms

Master: Modbus_RTU
Slave: Transparent

IL RS UNI 724 ms / 790 ms 649 ms / 860 ms 641 ms / 798 ms

31 Words PD length
Master: Transparent
Slave: Transparent

IL RS 485P 310 ms / 399 ms 210 ms / 327 ms 165 ms / 309 ms

Master: Transparent
Slave: Transparent
Modbus_RTU_9 181/192

FC3 read 125 holding register:

HW / Baudrate 1200 Baud 9600 Baud 38400 Baud


AXL RS UNI 2681 ms / 2820 ms 444 ms / 600 ms 276 ms / 552 ms

Master: Transparent
Slave: Transparent

IL RS UNI 3115 ms / 3222 ms 1042 ms / 1351 ms 1030 ms / 1216 ms

31 Words PD length
Master: Transparent
Slave: Transparent

IL RS 485P 3431 ms / 3986 ms 1666 ms / 2554 ms 1275 ms / 2722 ms

Master: Transparent
Slave: Transparent
Modbus_RTU_9 182/192

43.1.2.2 Write

FC16 write 1 Holding register:

HW / Baudrate 1200 Baud 9600 Baud 38400 Baud


AXL RS UNI 285 ms / 359 ms 84 ms / 123 ms 61 ms / 88 ms

Master: Modbus_RTU
Slave: Transparent

IL RS UNI 699 ms / 792 ms 651 ms / 875 ms 656 ms / 803 ms

31 Words PD length
Master: Transparent
Slave: Transparent

IL RS 485P 367 ms / 588 ms 242 ms / 357 ms 188 ms / 362 ms

Master: Transparent
Slave: Transparent

FC16 write 123 Holding register:

HW / Baudrate 1200 Baud 9600 Baud 38400 Baud


AXL RS UNI 2758 ms / 2900 ms 518 ms / 612 ms 292 ms / 582 ms

Master: Modbus_RTU
Slave: Transparent

IL RS UNI 3117 ms / 3160 ms 1068 ms / 1399 ms 1083 ms / 1261 ms

31 Words PD length
Master: Transparent
Slave: Transparent

IL RS 485P 3390 ms / 3994 ms 1610 ms / 2522 ms 1272 ms / 2545 ms

Master: Transparent
Slave: Transparent
Modbus_RTU_9 183/192

43.2 Data types

(* Modbus *)
TYPE
arrModbus2_W_1_126 : ARRAY [1..126] OF WORD;
arrModbus2_W_1_125 : ARRAY [1..125] OF WORD;
arrModbus2_W_1_123 : ARRAY [1..123] OF WORD;
arrModbus2_B_1_330 : ARRAY [1..330] OF BYTE;
arrModbus2_X_1_2000 : ARRAY [1..2000] OF BOOL;
arrModbus2_X_1_1968 : ARRAY [1..1968] OF BOOL;
arrModbus2_X_1_16 : ARRAY [1..16] OF BOOL;
arrModbus2_w_0_1999 : ARRAY [0..1999] OF WORD;
(* additional 16 bits were added to avoid out of range error when
processing the last 16 bits *)
arrModbus2_x_3000_3999 : ARRAY [3000..4015] OF BOOL;
(* additional 16 bits were added to avoid out of range error when
processing the last 16 bits *)
arrModbus2_x_4000_4999 : ARRAY [4000..5015] OF BOOL;
arrModbus2_w_2000_2999 : ARRAY [2000..2999] OF WORD;
arrModbus2_w_0_124 : ARRAY [0..124] OF WORD;
arrModbus2_x_0_15 : ARRAY [0..15] OF BOOL;
arrModbus2_B_0_256 : ARRAY [0..257] OF BYTE;
udtModbus2_Data : STRUCT
(* Modbus Handling *)
(* send Modbus request *)
xSendRequest : BOOL; (* indicates FC wants to send a
Modbus request *)
xNDR : BOOL; (* new modbus response received *)
xBusy : BOOL; (* FC only operates IF not busy *)
xReset : BOOL; (* reset from input on master FB *)
tTimeout : TIME; (* input tTimeout of the Modbus_Master FB*)
(* general Modbus data *)
uiSlaveAddress : UINT; (* address of the Modbus slave *)
iFunctionCode : INT; (* Function Code by the Master *)
uiStartAddress : UINT; (* starting address in the Modbus
register table *)
iSndDataCount : INT; (* required data length from FC *)
iExpDataCount : INT; (* expected data length depending
of the function code number of
bits or words *)
uiRcvdDataCount : UINT; (* received bytes from Serial IF / UINT
for the range higher than 127 *)
arrData : arrModbus2_W_1_126; (* modbus telegram *)
(* failure handling (master outputs) *)
xMasterActive : BOOL; (* interface is ready *)
xMasterBusy : BOOL; (* interface is busy *)
xMasterError : BOOL; (* error indication *)
wMasterDiagCode : WORD; (* diagnostics code *)
wMasterAddDiagCode : WORD; (* additional diagnostics code *)
xMB_Error : BOOL; (* Exception Code Response *)
xFC_Busy : BOOL; (* FC catches bit IF request and
NOT xFC_Busy *)
END_STRUCT;
END_TYPE
(* Diagnostic Structures udtDiag *)
TYPE
TYPE
MB_UDT_RTU_MASTER_DIAG : STRUCT
iState : INT;
Modbus_RTU_9 184/192

wDiagCode : WORD;
wAddDiagCode : WORD;
END_STRUCT;
MB_UDT_RTU_SLAVE_DIAG : STRUCT
iState : INT;
wDiagCode : WORD;
wAddDiagCode : WORD;
END_STRUCT;
MB_UDT_RTU_REC_DIAG : STRUCT
iState : INT;
wDiagCode : WORD;
wAddDiagCode : WORD;
bControlByte0 : BYTE;
bStatusByte0 : BYTE;
END_STRUCT;
MB_UDT_RTU_SND_DIAG : STRUCT
iState : INT;
wDiagCode : WORD;
wAddDiagCode : WORD;
bControlByte0 : BYTE;
bStatusByte0 : BYTE;
END_STRUCT;
MB_UDT_RTU_FC_DIAG : STRUCT
iState : INT;
wDiagCode : WORD;
wAddDiagCode : WORD;
END_STRUCT;
MB_UDT_ILRS232P_DIAG : STRUCT
iState : INT;
wDiagCode : WORD;
wAddDiagCode : WORD;
END_STRUCT;
MB_UDT_ILRS232ECO_DIAG : STRUCT
iState : INT; (* Current state of statemachine *)
wDiagCode : WORD; (* Diag Code *)
wAddDiagCode : WORD; (* Additional Diag Code *)
END_STRUCT;
MB_UDT_ILRS485ECO_DIAG : STRUCT
iState : INT;
wDiagCode : WORD;
wAddDiagCode : WORD;
END_STRUCT;
MB_UDT_ILRS485P_DIAG : STRUCT
iState : INT;
wDiagCode : WORD;
wAddDiagCode : WORD;
END_STRUCT;
MB_UDT_ILRSUNI_DIAG : STRUCT
iState : INT;
wDiagCode : WORD;
wAddDiagCode : WORD;
END_STRUCT;
MB_UDT_IL_UNI_MASTER_DIAG : STRUCT
udtMB_ILRSUNI_Diag : MB_UDT_ILRSUNI_DIAG;
Modbus_RTU_9 185/192

udtMB_RTU_Master_Diag : MB_UDT_RTU_MASTER_DIAG;
END_STRUCT;
MB_UDT_IL_RS232P_MASTER_DIAG : STRUCT
udtMB_ILRS232P_Diag : MB_UDT_ILRS232P_DIAG;
udtMB_RTU_Master_Diag : MB_UDT_RTU_MASTER_DIAG;
END_STRUCT;
MB_UDT_IL_232E_MASTER_DIAG : STRUCT
udtMB_ILRS232ECO_Diag : MB_UDT_ILRS232ECO_DIAG;
udtMB_RTU_Master_Diag : MB_UDT_RTU_MASTER_DIAG;
END_STRUCT;
MB_UDT_IL_485E_MASTER_DIAG : STRUCT
udtMB_ILRS485ECO_Diag : MB_UDT_ILRS485ECO_DIAG;
udtMB_RTU_Master_Diag : MB_UDT_RTU_MASTER_DIAG;
END_STRUCT;
MB_UDT_IL_485P_MASTER_DIAG : STRUCT
udtMB_ILRS485P_Diag : MB_UDT_ILRS485P_DIAG;
udtMB_RTU_Master_Diag : MB_UDT_RTU_MASTER_DIAG;
END_STRUCT;
MB_UDT_IL_UNI_SLAVE_DIAG : STRUCT
wDiagCode : WORD;
wAddDiagCode : WORD;
udtMB_ILRSUNI_Diag : MB_UDT_ILRSUNI_DIAG;
udtMB_RTU_Slave_Diag : MB_UDT_RTU_SLAVE_DIAG;
END_STRUCT;
MB_UDT_IL_232P_SLAVE_DIAG : STRUCT
wDiagCode : WORD;
wAddDiagCode : WORD;
udtMB_ILRS232P_Diag : MB_UDT_ILRS232P_DIAG;
udtMB_RTU_Slave_Diag : MB_UDT_RTU_SLAVE_DIAG;
END_STRUCT;
MB_UDT_IL_232E_SLAVE_DIAG : STRUCT
wDiagCode : WORD;
wAddDiagCode : WORD;
udtMB_ILRS232ECO_Diag : MB_UDT_ILRS232ECO_DIAG;
udtMB_RTU_Slave_Diag : MB_UDT_RTU_SLAVE_DIAG;
END_STRUCT;
MB_UDT_IL_485E_SLAVE_DIAG : STRUCT
wDiagCode : WORD;
wAddDiagCode : WORD;
udtMB_ILRS485ECO_Diag : MB_UDT_ILRS485ECO_DIAG;
udtMB_RTU_Slave_Diag : MB_UDT_RTU_SLAVE_DIAG;
END_STRUCT;
MB_UDT_IL_485P_SLAVE_DIAG : STRUCT
wDiagCode : WORD;
wAddDiagCode : WORD;
udtMB_ILRS485P_Diag : MB_UDT_ILRS485P_DIAG;
udtMB_RTU_Slave_Diag : MB_UDT_RTU_SLAVE_DIAG;
END_STRUCT;
MB_UDT_AXL_RSUNI_DIAG_MASTER : STRUCT
udtMB_AXL_RS_UNI_REC_Diag : MB_UDT_RTU_REC_DIAG;
udtMB_AXL_RS_UNI_SND_Diag : MB_UDT_RTU_SND_DIAG;
udtMB_RTU_Master_Diag : MB_UDT_RTU_MASTER_DIAG;
END_STRUCT;
MB_UDT_AXL_RSUNI_DIAG_SLAVE : STRUCT
Modbus_RTU_9 186/192

wDiagCode : WORD;
wAddDiagCode : WORD;
udtMB_AXL_RS_UNI_REC_Diag : MB_UDT_RTU_REC_DIAG;
udtMB_AXL_RS_UNI_SND_Diag : MB_UDT_RTU_SND_DIAG;
udtMB_RTU_Slave_Diag : MB_UDT_RTU_SLAVE_DIAG;
END_STRUCT;
MB_UDT_AXL_SE_RS485_DIAG_MA : STRUCT
udtMB_AXL_RS_UNI_REC_Diag : MB_UDT_RTU_REC_DIAG;
udtMB_AXL_RS_UNI_SND_Diag : MB_UDT_RTU_SND_DIAG;
udtMB_RTU_Master_Diag : MB_UDT_RTU_MASTER_DIAG;
END_STRUCT;
MB_UDT_AXL_SE_RS485_DIAG_SLAVE : STRUCT
wDiagCode : WORD;
wAddDiagCode : WORD;
udtMB_AXL_RS_UNI_REC_Diag : MB_UDT_RTU_REC_DIAG;
udtMB_AXL_RS_UNI_SND_Diag : MB_UDT_RTU_SND_DIAG;
udtMB_RTU_Slave_Diag : MB_UDT_RTU_SLAVE_DIAG;
END_STRUCT;
MB_UDT_AXL_SE_RS232_DIAG_MA : STRUCT
udtMB_AXL_RS_UNI_REC_Diag : MB_UDT_RTU_REC_DIAG;
udtMB_AXL_RS_UNI_SND_Diag : MB_UDT_RTU_SND_DIAG;
udtMB_RTU_Master_Diag : MB_UDT_RTU_MASTER_DIAG;
END_STRUCT;
MB_UDT_AXL_SE_RS232_DIAG_SLAVE : STRUCT
wDiagCode : WORD;
wAddDiagCode : WORD;
udtMB_AXL_RS_UNI_REC_Diag : MB_UDT_RTU_REC_DIAG;
udtMB_AXL_RS_UNI_SND_Diag : MB_UDT_RTU_SND_DIAG;
udtMB_RTU_Slave_Diag : MB_UDT_RTU_SLAVE_DIAG;
END_STRUCT;
MB_UDT_AXL_SE_RS485_EF_DIAG_MA : STRUCT
udtMB_AXL_RS_UNI_REC_Diag : MB_UDT_RTU_REC_DIAG;
udtMB_AXL_RS_UNI_SND_Diag : MB_UDT_RTU_SND_DIAG;
udtMB_RTU_Master_Diag : MB_UDT_RTU_MASTER_DIAG;
END_STRUCT;
MB_UDT_AXL_SE_RS485_EF_DIAG_SL : STRUCT
wDiagCode : WORD;
wAddDiagCode : WORD;
udtMB_AXL_RS_UNI_REC_Diag : MB_UDT_RTU_REC_DIAG;
udtMB_AXL_RS_UNI_SND_Diag : MB_UDT_RTU_SND_DIAG;
udtMB_RTU_Slave_Diag : MB_UDT_RTU_SLAVE_DIAG;
END_STRUCT;
MB_UDT_AXL_SE_RS232_EF_DIAG_MA : STRUCT
udtMB_AXL_RS_UNI_REC_Diag : MB_UDT_RTU_REC_DIAG;
udtMB_AXL_RS_UNI_SND_Diag : MB_UDT_RTU_SND_DIAG;
udtMB_RTU_Master_Diag : MB_UDT_RTU_MASTER_DIAG;
END_STRUCT;
MB_UDT_AXL_SE_RS232_EF_DIAG_SL : STRUCT
wDiagCode : WORD;
wAddDiagCode : WORD;
udtMB_AXL_RS_UNI_REC_Diag : MB_UDT_RTU_REC_DIAG;
udtMB_AXL_RS_UNI_SND_Diag : MB_UDT_RTU_SND_DIAG;
udtMB_RTU_Slave_Diag : MB_UDT_RTU_SLAVE_DIAG;
END_STRUCT;
END_TYPE

(* AXL RS UNI *)
Modbus_RTU_9 187/192

TYPE
(* *** AXL F RS UNI 1H *** *)
(* input and output array for processdata of the module *)
MB2_AXL_RSUNI2_ARR_B_0_19 : ARRAY [0..19] OF BYTE;
(* buffer for temporary saving of received data *)
MB2_AXL_RSUNI2_ARR_B_1_17 : ARRAY [1..17] OF BYTE;
(* input and output array for processdata of the module *)
MB_ARR_B_0_63 : ARRAY [0..63] OF BYTE;
(* buffer for temporary saving of received data *)
MB_ARR_B_1_61 : ARRAY [1..61] OF BYTE;

(* rs uni by processdata *)
(* maximum buffer for outgoing user data *)
MB2_AXL_RSUNI2_ARR_B_1_1023 : ARRAY [1..1023] OF BYTE;
(* maximum buffer for incoming user data *)
MB2_AXL_RSUNI2_ARR_B_1_4096 : ARRAY [1..4096] OF BYTE;
(* status of the serial interface *)
MB2_AXL_RSUNI2_UDT_STATUS : STRUCT
(* Error in module - peripheral fault or invalid command *)
xErrorModule : BOOL;
(* additional status of the module *)
(* TRUE -> Data set ready. Opposite side is ready for communication *)
xDSR : BOOL;
(* TRUE -> Data carrier detect. Opposite side detecting incoming data *)
xDCD : BOOL;
(* status of the receiving part of the module *)
(* TRUE -> Error during data receive operation of the module *)
xErrorRcv : BOOL;
(* TRUE -> Receive buffer of module full *)
xRcvBufferFull : BOOL;
(* TRUE -> Receive buffer of module not empty *)
xRcvBufferNotEmpty : BOOL;
(* status of the sending part of the module *)
(* TRUE -> Error during data send operation of the module *)
xErrorSend : BOOL;
(* TRUE -> Send buffer of module full *)
xSendBufferFull : BOOL;
(* TRUE -> Send buffer of module not empty *)
xSendBufferNotEmpty : BOOL;
(* Number of characters in the receive buffer of the module *)
uiRcvBufferModule : UINT;
(* Firmware version of the module *)
wFirmwareVersion : WORD;
END_STRUCT;

(* counter of the serial interface *)


MB2_AXL_RSUNI2_UDT_COUNTER : STRUCT
uiRcvCharValid : UINT; (* Number of valid received characters *)
uiRcvCharInvalid : UINT; (* Number of invalid received characters *)
uiSendChar : UINT; (* Number of sent characters *)
Modbus_RTU_9 188/192

END_STRUCT;
MB2_AXL_RSUNI2_UDT_IF : STRUCT
(* TRUE -> Serial Driver is Activated *)
xActive : BOOL;
(* TRUE -> Serial IL Driver is Ready to send / receive *)
xReady : BOOL;
(* TRUE -> End to end protocoll is used for communication *)
xEndToEnd : BOOL;
(* TRUE -> Acknowledge incoming errors *)
xAck : BOOL;
(* TRUE -> Reset communication errors automatically *)
xAutoAck : BOOL;
(* TRUE -> Turn on DTR function of module *)
xDTR : BOOL;
(* TRUE -> Read status counters of the module *)
xReadStatusCounter : BOOL;
(* TRUE -> Send send request to module *)
xSend : BOOL;
(* Number of bytes to be sent *)
uiSendLength : UINT;
(* TRUE -> Reset receive buffer of function block *)
xResetRecBuf : BOOL;
(* Number of characters to be read in *)
uiRcvLength : UINT;
(* Function block in sending mode *)
xFBSending : BOOL;
(* Function block in receiving mode *)
xFBReceiving : BOOL;
(* Structure containing status counters *)
udtStatusCounter : MB2_AXL_RSUNI2_UDT_COUNTER;
(* Structure containing status of serial interface *)
udtStatusSerialInterface : MB2_AXL_RSUNI2_UDT_STATUS;
(* Receive or send error existing *)
xStatusFailure : BOOL;
(* TRUE -> Receive buffer containing data *)
xRcvBufferNotEmpty : BOOL;
(* TRUE -> Software receive buffer full *)
xRecBufFull : BOOL;
(* Finished reading in status counter same cycle *)
xReadCounterDone : BOOL;
(* Finished sending of data same cycle *)
xSendDone : BOOL;
(* Finished reading of data same cycle *)
xNDR : BOOL;
(* Number of read in characters *)
uiRcvDataLength : UINT;
(* Timeout value for timeout in CASE of freezed receiving, sending, buffering operation *)
tTimeout : TIME;
(* Array containing received data *)
arrRcvData : MB2_AXL_RSUNI2_ARR_B_1_4096;
(* Array containing data to be sent *)
arrSendData : MB2_AXL_RSUNI2_ARR_B_1_1023;
(* mirroring for observing in Modbus Master FB *)
xActive_REC : BOOL;
xBusy_REC : BOOL;
xError_REC : BOOL;
wDiagCode_REC : WORD;
wAddDiagCode_REC : WORD;
xActive_SND : BOOL;
xBusy_SND : BOOL;
xError_SND : BOOL;
Modbus_RTU_9 189/192

wDiagCode_SND : WORD;
wAddDiagCode_SND : WORD;
xComSerial_IL : BOOL; (* TRUE: Inline Module *)
xRCV_ComSerial_IL : BOOL; (* xReceive for Inline modules *)
END_STRUCT;
END_TYPE
TYPE
(* IL RS UNI *)
(* IB IL RS485 PRO *)
MB2_COM_UDT_RS485P_PARA_V1 : STRUCT
diBaudrate : DINT;
bDataWidth : BYTE;
bErrorPattern : BYTE;
xOutputTyp : BOOL;
bFirstDelimeter : BYTE;
bSecondDelimeter : BYTE;
bProtocol : BYTE;
bDummy1 : BYTE;
bDummy2 : BYTE;
END_STRUCT;
MB2_COM_UDT_RS485P_DATA_V1 : STRUCT
xErrorRcv : BOOL;
xErrorSend : BOOL;
xRcvBufferFull : BOOL;
xSendBufferFull : BOOL;
xSendBufferNotEmpty : BOOL;
uiRcvCounter : UINT;
wFWVersion : WORD;
END_STRUCT;
(* ** Datentypen RS232P_xxx************************************ *)
MB2_COM_UDT_RS232P_PARA_V1 : STRUCT
diBaudrate : DINT;
bDataWidth : BYTE;
bErrorPattern : BYTE;
xDTR_Control : BOOL;
xCTS_Output : BOOL;
bFirstDelimeter : BYTE;
bSecondDelimeter : BYTE;
bProtocol : BYTE;
bDummy1 : BYTE;
END_STRUCT;
MB2_COM_UDT_RS232P_DATA_V1 :
STRUCT
xCTS : BOOL;
xErrorRcv3964R : BOOL;
xErrorSend3964R : BOOL;
xRcvBufferFull : BOOL;
xSendBufferFull : BOOL;
xSendBufferNotEmpty : BOOL;
uiRcvCounter : UINT;
wFWVersion : WORD;
END_STRUCT;
(* Parameterization , IL_RSUNI_xxx_V1_01 *)
(* Padding-Bytes *)
MB2_RSUNI_UDT_PARA_V2 : STRUCT
Modbus_RTU_9 190/192

bSelectMode : BYTE;
xDTR_Control : BOOL;
diBaudrate : DINT;
wDatawidth : WORD;
bErrorPattern : BYTE;
bSecondDelimeter : BYTE;
bFirstDelimeter : BYTE;
bProtocol : BYTE;
bDummy1 : BYTE;
bDummy2 : BYTE;
END_STRUCT;
(* Additional Diagnostics *)
MB2_RSUNI_UDT_DATA_V1 : STRUCT
xDCD : BOOL;
xDSR : BOOL;
xRcvBufferNotEmpty : BOOL;
xRcvBufferFull : BOOL;
xSendBufferFull : BOOL;
xSendBufferNotEmpty : BOOL;
wRcvBufferHW : WORD;
wRcvBufferSW : WORD;
wRcvCounter : WORD;
wRcvCounterFailed : WORD;
wSendCounter : WORD;
wFWVersion : WORD;
iState : INT; (* Current state of statemachine *)
wDiagCode : WORD; (* Diag Code *)
wAddDiagCode : WORD; (* Additional Diag Code *)
END_STRUCT;
(* Common arrays *)
MB2_COM_ARR_B_1_12 : ARRAY [1..12] OF BYTE;
MB2_COM_ARR_B_1_128 : ARRAY [1..128] OF BYTE;
MB2_COM_ARR_B_1_330 : ARRAY [1..330] OF BYTE;
MB2_COM_ARR_B_1_2048 : ARRAY [1..2048] OF BYTE;
(* process data width 11 BYTE *)
MB2_RSUNI_ARR_B_1_14 : ARRAY [1..14] OF BYTE;
(* process data width 27 BYTE *)
MB2_RSUNI_ARR_B_1_30 : ARRAY [1..30] OF BYTE;
(* process data width 59 BYTE *)
MB2_RSUNI_ARR_B_1_62 : ARRAY [1..62] OF BYTE;
MB2_RSUNI_ARR_B_1_256 : ARRAY [1..256] OF BYTE;
END_TYPE
(* *)
Modbus_RTU_9 191/192

44 In case of problems
In case of problems you should check in general:

1. Is the latest version of the library used? You can download the latest version from the Phoenix Contact
website.
2. Is the library released for the PC Worx 6 version you are using? Please refer to the chapter “Change notes” of
this documentation.
3. Is the library released for the PLC / PLC firmware version you are using? Please refer to the chapter “Change
notes” of this documentation.
4. Does every module in your system has the required firmware version? In some cases functionalities are
supported for higher firmware versions only.
5. Is your system running? Check all LEDs of all modules. Check the status in the web based management of
your PLC.
Modbus_RTU_9 192/192

45 Support
For technical support please contact your local Phoenix Contact agency
at https://www.phoenixcontact.com
Owner:
Phoenix Contact Electronics GmbH
Business Unit Automation Systems
System Services
Library Services
In case of a support request we need:

Development system with


Name (e.g. PC Worx, PLCnext Engineer)
Version (e.g. PLCnext Engineer 2022.0.1 LTS)
Bus structure / plant including all articles with
Name
Order number
Firmware version
External components
Used libraries with
Name
Version (e.g. IOL_Basic_7)
Detailed problem description with
Diag codes of all function blocks in error state

You might also like