Modbus TCP 9-20210426171633
Modbus TCP 9-20210426171633
Modbus_TCP_9
Table of Contents
1 Installation hint
2 General information
2.1 Modbus
2.2 Modbus TCP
3 Change notes
4 Function blocks
5 MB_TCP_Client
5.1 Function block call
5.2 Input parameters
5.3 Output parameters
5.4 Inout parameters
5.5 Diagnosis
6 MB_TCP_Server
6.1 Function block call
6.2 Input parameters
6.3 Output parameters
6.4 Inout parameters
6.5 Diagnosis
7 MB_TCP_FC1
7.1 Function block call
7.2 Input parameters
7.3 Output parameters
7.4 Inout parameters
7.5 Diagnosis
8 MB_TCP_FC2
8.1 Function block call
8.2 Input parameters
8.3 Output parameters
8.4 Inout parameters
8.5 Diagnosis
9 MB_TCP_FC3
9.1 Function block call
9.2 Input parameters
9.3 Output parameters
9.4 Inout parameters
9.5 Diagnosis
10 MB_TCP_FC4
10.1 Function block call
10.2 Input parameters
10.3 Output parameters
10.4 Inout parameters
10.5 Diagnosis
Modbus_TCP_9 3/62
11 MB_TCP_FC5
11.1 Function block call
11.2 Input parameters
11.3 Output parameters
11.4 Inout parameters
11.5 Diagnosis
12 MB_TCP_FC6
12.1 Function block call
12.2 Input parameters
12.3 Output parameters
12.4 Inout parameters
12.5 Diagnosis
13 MB_TCP_FC15
13.1 Function block call
13.2 Input parameters
13.3 Output parameters
13.4 Inout parameters
13.5 Diagnosis
14 MB_TCP_FC16
14.1 Function block call
14.2 Input parameters
14.3 Output parameters
14.4 Inout parameters
14.5 Diagnosis
15 MB_TCP_FC23
15.1 Function block call
15.2 Input parameters
15.3 Output parameters
15.4 Inout parameters
15.5 Diagnosis
16 MB_TCP_DiagInfo_EN
16.1 Function block call
16.2 Input parameters
16.3 Output parameters
16.4 Inout parameters
16.5 Diagnosis
17 Startup examples
17.1 System
17.2 Modbus_TCP server TCP-Mode
17.3 Modbus_TCP client TCP-Mode
17.4 Modbus_TCP server UDP-Mode
17.5 Modbus_TCP client UDP-Mode
18 Appendix
18.1 Diag codes of used firmware function blocks
18.2 Data types
Modbus_TCP_9 4/62
19 Support
Modbus_TCP_9 5/62
1 Installation hint
If you did not specify a different directory during library installation all data in the MSI file will be unpacked to
c:\Users\Public\Documents\Phoenix Contact Libraries\PLCnext Engineer (former: PC Worx Engineer)
Please copy the library data to your PLCnext Engineer (former: PC Worx Engineer) working library directory.
If you did not specify a different directory during PLCnext Engineer installation the default PLCnext Engineer
working library directory is
c:\Users\Public\Documents\PLCnext Engineer\Libraries (former: PC Worx Engineer\Libraries)
2 General information
2.1 Modbus
Modbus is an open protocol for control communication with various functions for read and write access for digital
inputs, outputs and registers.
Modbus is maintained by a dedicated user organization.
Documents with a detailed protocol description are available from the organization's homepage at
www.modbus.org.
Depending on the transmission system, a distinction is made between the Modbus RTU, Modbus ASCII, and
Modbus TCP protocols.
3 Change notes
Library Library PLCnext Supported
version build Engineer Change notes PLCs
version
9 20210423 2021.0 LTS MB_TCP_Server: AXC F 1152
(1151412)
AXC F 2152
Internal improvement. (2404267)
InOuts have been adapted to the Modbus AXC F 3152
standards. (1069208)
New InOuts:
arrCoils
arrInputs
arrHoldingRegisters
arrInputsRegisters
MB_TCP_Client:
Documentation corrected
MB_TCP_Client_5:
MB_TCP_Client_4:
MB_TCP_FC23_4:
udtIP_UDP_SOCKET changed to
udtUDP_SOCKET
udtIP_UDP_SEND changed to udtUDP_SEND
udtIP_UDP_RECEIVE changed to
udtUDP_RECEIVE
MB_TCP_Client_3:
MB_TCP_DiagInfo_EN_2:
MB_TCP_FC1,2,3,4,23_3:
Bugfix - uiByteCount
MB_TCP_Server_2:
4 Function blocks
Function block Description Version Supported License
articles
MB_TCP_Client The function block provides the functionality of a 6 - none
Modbus TCP client.
MB_TCP_Server The function block provides the functionality of a 6 - none
Modbus TCP server
MB_TCP_FC1 Function block for function codes 1 3 - none
MB_TCP_FC2 Function block for function codes 2 3 - none
MB_TCP_FC3 Function block for function codes 3 3 - none
MB_TCP_FC4 Function block for function codes 4 3 - none
MB_TCP_FC5 Function block for function codes 5 1 - none
MB_TCP_FC6 Function block for function codes 6 1 - none
MB_TCP_FC15 Function block for function codes 15 1 - none
MB_TCP_FC16 Function block for function codes 16 1 - none
MB_TCP_FC23 Function block for function codes 23 4 - none
MB_TCP_DiagInfo_EN This optional function block displays diagnostic 2 - none
messages of the Modbus client as clear text in
English.
Modbus_TCP_9 10/62
5 MB_TCP_Client
5.1 Function block call
5.5 Diagnosis
wDiagCode wAddDiagCode Description
16#0000 16#0000 Function block is deactivated.
16#8000 16#0000 Function block is in regular operation.
16#8100 16#0000 The block is connecting to server
16#C010 A parameterization error has occurred
16#0010 The IP address of the Modbus server was not specified.
16#C020 16#0000 Timeout error
16#C030 16#xxxx TCP_SOCKET error 16#xxxx. Refer to appendix.
16#C040 16#xxxx TCP_SEND error 16#xxxx. Refer to appendix.
16#C050 16#xxxx TCP_RECEIVE error 16#xxxx. Refer to appendix.
5.5.1 udtDiag
The udtDiag structure contains all inputs and outputs of the used firmware function blocks: For details refer to
appendix "Data types".
Modbus_TCP_9 13/62
6 MB_TCP_Server
This function block organizes the read and writes accesses of a remote control system to internal data via Modbus
TCP. The data is stored in arrCoils, arrInputs, arrInputRegister and arrHoldingRegister. Each array has 65535
elements. Since this arrays have been defined as IN/OUT parameter, they can be read and written to in the local
user program as required.
Attention: Depending on the control system used, the number of functions that the Modbus server can process in a
given time is limited. In the event of overloading it may happen that the server does not respond to a telegram. In
this case the accessing control system must send the telegram again.
TCP Mode: Only one Modbus client can access the Modbus server.
UDP Mode: Several Modbus clients can access the Modbus Server.
Access to Registers
The Read/Write Holding Registers functions access the WORD elements of the arrHoldingRegisters.
The Read/Write Input Registers functions access the WORD elements of the arrInputRegisters.
The Read/Write Discrete Inputs functions access the BOOL elements of the arrInputs.
The Read/Write Coils funtions access the BOOL elements of the arrCoils.
The array index and the register address to be specified when calling the Modbus functions are identical.
Modbus_TCP_9 14/62
Connected to TCP_SOCKET.DEST_IP.
FB creates a listening socket, only requests from the client with this IP
address are accepted. If the string is empty, contains the value 0.0.0.0. or
the input is not connected, any client IP address is accepted.
UDP-Mode:
Not used. The answer is sent to the IP address of the requesting client.
Connected to TCP_SOCKET.DEST_PORT.
FB creates a listening socket, only requests from the client with this IP
port are accepted. If the string is empty, contains the value 0 or the input is
not connected, any client IP port is accepted.
UDP-Mode:
Not used. The answer is sent to the port of the requesting client.
tReconnectDelay TIME Delay between two IP connect executions. Needed by PLC. Default value =
500ms.
tTimeout Time Timeout monitoring when there is a write access. After a write function was
executed, a write telegram must be received again within the time specified
here. A timeout error is reported if this is not the case. Specify the timeout value
T#0s to disable this function.
Modbus_TCP_9 16/62
6.5 Diagnosis
wDiagCode wAddDiagCode Description
16#0000 16#0000 Function block is deactivated.
16#8000 16#0000 Function block is in regular operation.
16#C020 16#0000 Timeout error. A write services was executed and another write telegram
was not received within the time specified in the tTimeout parameter. Enter
the value T#0s in the tTimeout parameter to disable this function.
16#C030 16#xxxx TCP_SOCKET error 16#xxxx. Refer to appendix.
16#C040 16#xxxx TCP_SEND error 16#xxxx. Refer to appendix.
16#C050 16#xxxx TCP_RECEIVE error 16#xxxx. Refer to appendix.
6.5.1 udtDiag
The udtDiag structure contains all inputs and outputs of the used firmware function blocks. For details refer to
appendix "Data types".
Modbus_TCP_9 18/62
7 MB_TCP_FC1
This function block reads coils from a Modbus server.
Before this function block is Activated, xReady of the MB_TCP_Client must be TRUE.
The data is read in the form of a byte array (CoilStatus parameter), the first bit in the first byte of this array
corresponds to the first output to be read. The following diagram shows the assignment of the bits in the byte array
to the outputs and the internal bits, in this example output 1 to 16 are read:
Byte 1 (Coil Status) Byte 2 (Coil Status)
Bit number 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0
Bit number 8 7 6 5 4 3 2 1 16 15 14 13 12 11 10 9
7.5 Diagnosis
wDiagCode wAddDiagCode Description
16#0000 16#0000 Function block is deactivated.
16#8000 16#0000 Function block is in regular operation.
16#C010 16#0000 The MB_TCP_Client block is not ready.
16#C030 16#0000 The iMT_ID used is invalid. The iMT_ID must be in the range from 1 to 10.
16#C040 16#0000 The iMT_ID used is assigned twice. Several Modbus function blocks use the
same iMT_ID, in this case only the first called block operates, all other
blocks indicate this error.
16#C060 Modbus error
16#0001 Illegal function
16#0002 Illegal data address
16#0003 Illegal data value
16#0004 Slave device failure
16#0005 Acknowledge
16#0006 Slave device busy
16#0008 Memory parity error
16#000A Gateway path unavailable
16#000B Gateway target device failed to respond
Modbus_TCP_9 20/62
8 MB_TCP_FC2
This function block reads digital inputs from a Modbus server.
Before this function block is Activated, xReady of the MB_TCP_Client must be TRUE.
The data is read in the form of a byte array (InputStatus parameter), the first bit in the first byte of this array
corresponds to the first input to be read. The following diagram shows the assignment of the bits in the byte array
to the inputs in this example inputs 1 to 16 are read:
Byte 1 (Input Status) Byte 2 (Input Status)
Bit number 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0
Bit number 8 7 6 5 4 3 2 1 16 15 14 13 12 11 10 9
8.5 Diagnosis
wDiagCode wAddDiagCode Description
16#0000 16#0000 Function block is deactivated.
16#8000 16#0000 Function block is in regular operation.
16#C010 16#0000 The MB_TCP_Client block is not ready.
16#C030 16#0000 The iMT_ID used is invalid. The iMT_ID must be in the range from 1 to 10.
16#C040 16#0000 The iMT_ID used is assigned twice. Several Modbus function blocks use the
same iMT_ID, in this case only the first called block operates, all other
blocks indicate this error.
16#C060 Modbus error
16#0001 Illegal function
16#0002 Illegal data address
16#0003 Illegal data value
16#0004 Slave device failure
16#0005 Acknowledge
16#0006 Slave device busy
16#0008 Memory parity error
16#000A Gateway path unavailable
16#000B Gateway target device failed to respond
Modbus_TCP_9 22/62
9 MB_TCP_FC3
This function block reads holding registers from a Modbus server.
Before this function block is Activated, xReady of the MB_TCP_Client must be TRUE.
The data is read in the form of a byte array (InputStatus parameter), the first bit in the first byte of this array
corresponds to the first input to be read. The following diagram shows the assignment of the bits in the byte array
to the inputs in this example inputs 1 to 16 are read:
Byte 1 (InputStatus) Byte 2 (InputStatus)
Bit number 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0
Bit number 8 7 6 5 4 3 2 1 16 15 14 13 12 11 10 9
9.5 Diagnosis
wDiagCode wAddDiagCode Description
16#0000 16#0000 Function block is deactivated.
16#8000 16#0000 Function block is in regular operation.
16#C010 16#0000 The MB_TCP_Client block is not ready.
16#C030 16#0000 The iMT_ID used is invalid. The iMT_ID must be in the range from 1 to 10.
16#C040 16#0000 The iMT_ID used is assigned twice. Several Modbus function blocks use the
same iMT_ID, in this case only the first called block operates, all other
blocks indicate this error.
16#C060 Modbus error
16#0001 Illegal function
16#0002 Illegal data address
16#0003 Illegal data value
16#0004 Slave device failure
16#0005 Acknowledge
16#0006 Slave device busy
16#0008 Memory parity error
16#000A Gateway path unavailable
16#000B Gateway target device failed to respond
Modbus_TCP_9 25/62
10 MB_TCP_FC4
This function block reads digital registers from a Modbus server.
Before this function block is Activated, xReady of the MB_TCP_Client must be TRUE.
10.5 Diagnosis
wDiagCode wAddDiagCode Description
16#0000 16#0000 Function block is deactivated.
16#8000 16#0000 Function block is in regular operation.
16#C010 16#0000 The MB_TCP_Client block is not ready.
16#C030 16#0000 The iMT_ID used is invalid. The iMT_ID must be in the range from 1 to 10.
16#C040 16#0000 The iMT_ID used is assigned twice. Several Modbus function blocks use the
same iMT_ID, in this case only the first called block operates, all other
blocks indicate this error.
16#C060 Modbus error
16#0001 Illegal function
16#0002 Illegal data address
16#0003 Illegal data value
16#0004 Slave device failure
16#0005 Acknowledge
16#0006 Slave device busy
16#0008 Memory parity error
16#000A Gateway path unavailable
16#000B Gateway target device failed to respond
Modbus_TCP_9 27/62
11 MB_TCP_FC5
This function block writes a bit in the memory of a Modbus server.
Before this function block is Activated, xReady of the MB_TCP_Client must be TRUE.
11.5 Diagnosis
wDiagCode wAddDiagCode Description
16#0000 16#0000 Function block is deactivated.
16#8000 16#0000 Function block is in regular operation.
16#C010 16#0000 The MB_TCP_Client block is not ready.
16#C030 16#0000 The iMT_ID used is invalid. The iMT_ID must be in the range from 1 to 10.
16#C040 16#0000 The iMT_ID used is assigned twice. Several Modbus function blocks use the
same iMT_ID, in this case only the first called block operates, all other
blocks indicate this error.
16#C060 Modbus error
16#0001 Illegal function
16#0002 Illegal data address
16#0003 Illegal data value
16#0004 Slave device failure
16#0005 Acknowledge
16#0006 Slave device busy
16#0008 Memory parity error
16#000A Gateway path unavailable
16#000B Gateway target device failed to respond
Modbus_TCP_9 29/62
12 MB_TCP_FC6
This function block writes a register into the memory of a Modbus server.
Before this function block is Activated, xReady of the MB_TCP_Client must be TRUE.
12.5 Diagnosis
wDiagCode wAddDiagCode Description
16#0000 16#0000 Function block is deactivated.
16#8000 16#0000 Function block is in regular operation.
16#C010 16#0000 The MB_TCP_Client block is not ready.
16#C030 16#0000 The iMT_ID used is invalid. The iMT_ID must be in the range from 1 to 10.
16#C040 16#0000 The iMT_ID used is assigned twice. Several Modbus function blocks use the
same iMT_ID, in this case only the first called block operates, all other
blocks indicate this error.
16#C060 Modbus error
16#0001 Illegal function
16#0002 Illegal data address
16#0003 Illegal data value
16#0004 Slave device failure
16#0005 Acknowledge
16#0006 Slave device busy
16#0008 Memory parity error
16#000A Gateway path unavailable
16#000B Gateway target device failed to respond
Modbus_TCP_9 31/62
13 MB_TCP_FC15
This function block writes multiple bits into the memory of the Modbus server.
Before this function block is Activated, xReady of the MB_TCP_Client must be TRUE.
The data is read in the form of a byte array, the first bit in the first byte of this array corresponds to the first output
to be written. The following diagram shows the assignment of the bits in the byte array to the outputs; in this
example outputs 1 to 16 are written:
Byte 1 (Output value) Byte 2 (Output value)
Bit number 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0
Bit number 8 7 6 5 4 3 2 1 16 15 14 13 12 11 10 9
13.5 Diagnosis
wDiagCode wAddDiagCode Description
16#0000 16#0000 Function block is deactivated.
16#8000 16#0000 Function block is in regular operation.
16#C010 16#0000 The MB_TCP_Client block is not ready.
16#C030 16#0000 The iMT_ID used is invalid. The iMT_ID must be in the range from 1 to 10.
16#C040 16#0000 The iMT_ID used is assigned twice. Several Modbus function blocks use the
same iMT_ID, in this case only the first called block operates, all other
blocks indicate this error.
16#C060 Modbus error
16#0001 Illegal function
16#0002 Illegal data address
16#0003 Illegal data value
16#0004 Slave device failure
16#0005 Acknowledge
16#0006 Slave device busy
16#0008 Memory parity error
16#000A Gateway path unavailable
16#000B Gateway target device failed to respond
Modbus_TCP_9 34/62
14 MB_TCP_FC16
This function block writes multiple registers into the memory of a Modbus server.
Before this function block is Activated, xReady of the MB_TCP_Client must be TRUE.
14.5 Diagnosis
wDiagCode wAddDiagCode Description
16#0000 16#0000 Function block is deactivated.
16#8000 16#0000 Function block is in regular operation.
16#C010 16#0000 The MB_TCP_Client block is not ready.
16#C030 16#0000 The iMT_ID used is invalid. The iMT_ID must be in the range from 1 to 10.
16#C040 16#0000 The iMT_ID used is assigned twice. Several Modbus function blocks use the
same iMT_ID, in this case only the first called block operates, all other
blocks indicate this error.
16#C060 Modbus error
16#0001 Illegal function
16#0002 Illegal data address
16#0003 Illegal data value
16#0004 Slave device failure
16#0005 Acknowledge
16#0006 Slave device busy
16#0008 Memory parity error
16#000A Gateway path unavailable
16#000B Gateway target device failed to respond
Modbus_TCP_9 36/62
15 MB_TCP_FC23
This function block writes and reads multiple registers into/of the memory of a Modbus server.
Before this function block is Activated, xReady of the MB_TCP_Client must be TRUE.
15.5 Diagnosis
wDiagCode wAddDiagCode Description
16#0000 16#0000 Function block is deactivated.
16#8000 16#0000 Function block is in regular operation.
16#C010 16#0000 The MB_TCP_Client block is not ready.
16#C030 16#0000 The iMT_ID used is invalid. The iMT_ID must be in the range from 1 to 10.
16#C040 16#0000 The iMT_ID used is assigned twice. Several Modbus function blocks use the
same iMT_ID, in this case only the first called block operates, all other
blocks indicate this error.
16#C060 Modbus error
16#0001 Illegal function
16#0002 Illegal data address
16#0003 Illegal data value
16#0004 Slave device failure
16#0005 Acknowledge
16#0006 Slave device busy
16#0008 Memory parity error
16#000A Gateway path unavailable
16#000B Gateway target device failed to respond
Modbus_TCP_9 39/62
16 MB_TCP_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 outputs (strDiagCode and strAddDiagCode) are
limited to 80 characters.
16.5 Diagnosis
None
Modbus_TCP_9 40/62
17 Startup examples
For the startup instructions of the Modbus_TCP library the following examples are available:
MB_TCP_9_EXA_TCP_Client.pcwex
MB_TCP_9_EXA_TCP_Server.pcwex
MB_TCP_9_EXA_UDP_Client.pcwex
MB_TCP_9_EXA_UDP_Server.pcwex
The examples are located in the “Example” folder to the unzipped msi-file of the library.
17.1 System
Modbus_TCP_9 41/62
17.2.1 Plant
17.3.1 Plant
END_IF;
(* Read max. number of registers *)
2000: (* Deactivation of FC3 function block before read again *)
udtExample.udtMB_TCP_FC3.xActivate := FALSE;
(* Wait for xActive = FALSE after deactivation *)
IF udtExample.udtMB_TCP_FC3.xActive = FALSE THEN
iState := 2010;
END_IF;
2010: (* Activation of FC3 function block and set inputs *)
udtExample.udtMB_TCP_FC3.xActivate := TRUE;
(* udtFC3.arrRegisterValues = ARRAY [1..125] OF WORD *)
udtExample.udtMB_TCP_FC3.uiQuantityOfRegisters := UINT#125;
(* read Register 2200 to 2324 *)
udtExample.udtMB_TCP_FC3.wStartRegister := WORD#200;
(* Wait for xActive = TRUE *)
IF
udtExample.udtMB_TCP_FC3.xActive = TRUE AND
udtExample.udtMB_TCP_FC3.xError = FALSE
THEN
iState := 2020;
END_IF;
2020: (* Check values, if uiByteCount = 250 values are read correctly *)
(* Modbus server has to deliver these values! *)
IF
udtExample.udtMB_TCP_FC3.xError = FALSE AND
udtExample.udtMB_TCP_FC3.uiByteCount = UINT#250
THEN
iState := 2100;
END_IF;
2100: (* Deactivate FC3 function block *)
udtExample.udtMB_TCP_FC3.xActivate := FALSE;
IF udtExample.udtMB_TCP_FC3.xActive = FALSE THEN
iState := 2200;
END_IF;
2200: (* wait for xStart = FASLE *)
IF xRestartIfFinished = TRUE THEN
udtExample.uiRestartIfFinished := udtExample.uiRestartIfFinished + UINT#1;
iState := 10;
END_IF;
IF xStart = FALSE THEN
iState := 3000;
END_IF;
3000: (* Finish *)
(* Deactivate client function block *)
udtExample.udtClient.xActivate := FALSE;
IF udtExample.udtMB_TCP_FC3.xActive = FALSE THEN
iState := 0;
END_IF;
END_CASE;
Modbus_TCP_9 48/62
17.4.1 Plant
17.5.1 Plant
18 Appendix
18.1 Diag codes of used firmware function blocks
18.1.1 TCP_SOCKET, TCP_RECEIVE, TCP_SEND, UDP_SOCKET,
UDP_RECEIVE, UDP_SEND
ERROR = FALSE
16#C151 An error regarding the START_TLS input of the TLS_SOCKET function TLS_*
block has occurred. START_TLS was set from TRUE to FALSE during
opened TLS socket (ACTIVE input = TRUE). This is the case when:
16#C201 There are too many open sockets in the underlying socket provider.
Modbus_TCP_9 56/62
16#C229 The connection attempt timed out, or the connected host has failed to
respond.
16#C22A The operation failed because the remote host is down.
16#C22B There is no network route to the specified host. Could not connect to
DEST_IP.
16#C22C Too many processes are using the underlying socket provider.
16#C22D The network subsystem is unavailable.
16#C22E The version of the underlying socket provider is out of range.
16#C22F The underlying socket provider has not been initialized.
16#C230 A graceful shutdown is in progress.
16#C231 The specified class was not found.
16#C232 The name of the host could not be resolved. Try again later.
16#C233 The error is unrecoverable or the requested database cannot be
located.
16#C234 The requested name or IP address was not found on the name server.
Modbus_TCP_9 58/62
Protocol_ID: WORD;
Length: WORD;
Unit_ID: BYTE;
FC: BYTE;
Reference: WORD;
Word_Count: WORD;
DATA: MB_TCP_ARR_B_1_250;
END_STRUCT;
MB_TCP_UDT_MBS_RESPONSE : STRUCT
DATA_CNT: WORD; (* Not part of Modbus protocol *)
Transaction_ID: WORD;
Protocol_ID: WORD;
Length: WORD;
Unit_ID: BYTE;
FC: BYTE;
DATA: MB_TCP_ARR_B_1_250;
END_STRUCT;
(* Buffers for requests *)
MB_TCP_ARR_MBS_BUFFER : ARRAY [0..10] OF MB_TCP_UDT_MBS_REQUEST;
(* Information for UDP Client Sockets *)
MB_TCP_UDT_UDP_CLIENT_SOCKET : STRUCT
uiClientPort : UINT;
strClientIP : STRING;
END_STRUCT;
(* Buffer with Client Socket Informations (same Index like requests Array) *)
MB_TCP_ARR_UDP_CLIENT_SOCKET : ARRAY [0..10] OF MB_TCP_UDT_UDP_CLIENT_SOCKET;
(* I/O parameter of firmware iFunction blocks as struct *)
(* Inputs and outputs of TCP_SOCKET *)
MB_TCP_UDT_TCP_SOCKET : STRUCT
(* Inputs *)
xActivate : BOOL;
xIS_SRV : BOOL;
strBIND_IP : STRING;
uiBIND_Port : UINT;
strDEST_IP : STRING;
uiDEST_Port : UINT;
(* Outputs *)
dwHandle : DWORD;
xActive : BOOL;
xBusy : BOOL;
xError : BOOL;
wStatus : WORD;
uiUSED_Port : UINT;
END_STRUCT;
(* Inputs and outputs of TCP_SEND *)
MB_TCP_UDT_TCP_SEND : STRUCT
(* Inputs *)
xReq : BOOL;
udiData_CNT : UDINT;
(* Outputs *)
xDone : BOOL;
xBusy : BOOL;
xError : BOOL;
wStatus : WORD;
END_STRUCT;
Modbus_TCP_9 60/62
wAddDiagCode : WORD;
udtTCP_SOCKET : MB_TCP_UDT_TCP_SOCKET;
udtTCP_SEND : MB_TCP_UDT_TCP_SEND;
udtTCP_RECEIVE : MB_TCP_UDT_TCP_RECEIVE;
udtUDP_SOCKET : MB_TCP_UDT_UDP_SOCKET;
udtUDP_SEND : MB_TCP_UDT_UDP_SEND;
udtUDP_RECEIVE : MB_TCP_UDT_UDP_RECEIVE;
END_STRUCT;
(* Diag structure for MB_TCP_Client *)
MB_TCP_UDT_CLI_DIAG : STRUCT
iState : INT;
wDiagCode : WORD;
wAddDiagCode : WORD;
udtTCP_SOCKET : MB_TCP_UDT_TCP_SOCKET;
udtTCP_SEND : MB_TCP_UDT_TCP_SEND;
udtTCP_RECEIVE : MB_TCP_UDT_TCP_RECEIVE;
udtUDP_SOCKET : MB_TCP_UDT_UDP_SOCKET;
udtUDP_SEND : MB_TCP_UDT_UDP_SEND;
udtUDP_RECEIVE : MB_TCP_UDT_UDP_RECEIVE;
END_STRUCT;
(*Struct for outputs of TCP/UDP_SOCKET*)
MB_TCP_UDT_SOCKET : STRUCT
xActive : BOOL;
xBusy : BOOL;
xError : BOOL;
wStatus : WORD;
uiUsed_Port : UINT;
END_STRUCT;
(*Struct for outputs of TCP/UDP_SEND*)
MB_TCP_UDT_SEND : STRUCT
xDone : BOOL;
xBusy : BOOL;
xError : BOOL;
wStatus : WORD;
END_STRUCT;
(*Struct for outputs of TCP/UDP_RECEIVE*)
MB_TCP_UDT_RECEIVE : STRUCT
xNDR : BOOL;
xError : BOOL;
wStatus : WORD;
strSource_IP : STRING;
uiSource_Port : UINT;
udiDataCNT : UDINT;
END_STRUCT;
END_TYPE
Modbus_TCP_9 62/62
19 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