Modbus RTU 9
Modbus RTU 9
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
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
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:
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_F_RSUNI_Master:
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
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:
MB_AXL_SE_RS485_Master:
Bugfix: xActive may only become TRUE if all internal blocks are
active.
MB_RTU_FCx:
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
MB_RTU_AXL_F_RSUNI_Master
MB_RTU_AXL_F_RSUNI_Slave
Modbus_RTU_9 12/192
Additional check of the Modbus response for validity (inside the FC).
Response is consistent with the request.
MB_RTU_Master_5:
MB_RTU_FC23:
MB_AXL_RS_UNI_SND:
MB_IL_232P_Master:
MB_IL_232P_Slave:
MB_IL_485E_Master:
MB_IL_485E_Slave:
MB_IL_485P_Master:
MB_IL_485P_Slave:
MB_IL_UNIxx_Master:
MB_IL_UNIxx_Slave:
New functionalities:
MB_RTU_Master_4:
MB_RTU_FC1,2,3,4,23:
MB_RTU_FC2:
MB_RTU_FC23:
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.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.
8 MB_RTU_FC2
This function block reads discrete inputs from a Modbus slave.
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.
9 MB_RTU_FC3
This function block reads holding registers from a Modbus slave.
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.
10 MB_RTU_FC4
This function block reads input registers from a Modbus slave.
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.
11 MB_RTU_FC5
This function block writes a single output bit of a Modbus slave.
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.
12 MB_RTU_FC6
This function block writes a single holding register of a Modbus slave.
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.
13 MB_RTU_FC15
This function block writes multiple output bits of a Modbus slave.
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.
14 MB_RTU_FC16
This function block writes multiple holding registers of a Modbus slave.
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.
15 MB_RTU_FC23
This function block writes or reads multiple holding registers of a Modbus slave.
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.
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.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.5 Diagnosis
17.5.1 MB_RTU_Master
17.5.2 MB_AXL_RS_UNI_REC
17.5.3 MB_AXL_RS_UNI_SND
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).
CRC error
Send error
Paket too long or too short
Remedial action
18.5 Diagnosis
18.5.1 MB_RTU_Slave
18.5.2 MB_AXL_RS_UNI_REC
18.5.3 MB_AXL_RS_UNI_SND
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.5 Diagnosis
19.5.1 MB_RTU_Master
19.5.2 MB_AXL_RS_UNI_REC
19.5.3 MB_AXL_RS_UNI_SND
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).
CRC error
Send error
Paket too long or too short
Remedial action
20.5 Diagnosis
20.5.1 MB_RTU_Slave
20.5.2 MB_AXL_RS_UNI_REC
20.5.3 MB_AXL_RS_UNI_SND
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.5 Diagnosis
21.5.1 MB_RTU_Master
21.5.2 MB_AXL_RS_UNI_REC
21.5.3 MB_AXL_RS_UNI_SND
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.3.1 udtTransactions
22.5 Diagnosis
22.5.1 MB_RTU_Slave
22.5.2 MB_AXL_RS_UNI_REC
22.5.3 MB_AXL_RS_UNI_SND
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.5 Diagnosis
23.5.1 MB_RTU_Master
23.5.2 MB_AXL_RS_UNI_REC
23.5.3 MB_AXL_RS_UNI_SND
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).
CRC error
Send error
Paket too long or too short
Remedial action
24.5 Diagnosis
24.5.1 MB_RTU_Slave
24.5.2 MB_AXL_RS_UNI_REC
24.5.3 MB_AXL_RS_UNI_SND
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.5 Diagnosis
25.5.1 MB_RTU_Master
25.5.2 MB_AXL_RS_UNI_REC
25.5.3 MB_AXL_RS_UNI_SND
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.3.1 udtTransactions
26.5 Diagnosis
26.5.1 MB_RTU_Slave
26.5.2 MB_AXL_RS_UNI_REC
26.5.3 MB_AXL_RS_UNI_SND
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.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).
CRC error
Send error
Paket too long or too short
Remedial action
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).
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.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).
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
CRC error
Send error
Paket too long or too short
Remedial action
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).
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.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).
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
CRC error
Send error
Paket too long or too short
Remedial action
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.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).
CRC error
Send error
Paket too long or too short
Remedial action
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).
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.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).
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.
CRC error
Send error
Paket too long or too short
Remedial action
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).
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.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).
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.
CRC error
Send error
Paket too long or too short
Remedial action
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).
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.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).
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.
CRC error
Send error
Paket too long or too short
Remedial action
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).
To start the example set the xStart input of the Example function block to TRUE.
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
Refer to Example 1.
Modbus_RTU_9 165/192
Refer to Example 2.
Modbus_RTU_9 166/192
Refer to Example 1.
Modbus_RTU_9 167/192
Refer to Example 2.
Modbus_RTU_9 168/192
Refer to Example 1.
Modbus_RTU_9 169/192
Refer to Example 2.
Modbus_RTU_9 170/192
Refer to Example 1.
Modbus_RTU_9 171/192
Refer to Example 2.
Modbus_RTU_9 172/192
Refer to Example 1.
Modbus_RTU_9 173/192
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.
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.
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
Example FC 4: Calculation of the theoretically possible transmission time via the serial line (terminal to terminal):
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]
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.
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
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!
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.1 Read
Master: Modbus_RTU
Slave: Transparent
31 Words PD length
Master: Transparent
Slave: Transparent
Master: Transparent
Slave: Transparent
Modbus_RTU_9 181/192
Master: Transparent
Slave: Transparent
31 Words PD length
Master: Transparent
Slave: Transparent
Master: Transparent
Slave: Transparent
Modbus_RTU_9 182/192
43.1.2.2 Write
Master: Modbus_RTU
Slave: Transparent
31 Words PD length
Master: Transparent
Slave: Transparent
Master: Transparent
Slave: Transparent
Master: Modbus_RTU
Slave: Transparent
31 Words PD length
Master: Transparent
Slave: Transparent
Master: Transparent
Slave: Transparent
Modbus_RTU_9 183/192
(* 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;
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: