Professional Documents
Culture Documents
IP Com 12
IP Com 12
IP_Com_12
Table of Contents
1 Installation hint
2 General information
3 Change notes
4 Supported PLCs
5 Function blocks
6 IPC_Socket
6.1 Function block call
6.2 Input parameters
6.3 Output parameters
6.4 Inout parameters
6.5 Diagnosis
7 Startup examples
7.1 Example 1 : IPC_*_EXA_IPC_SOCKET
8 Appendix
8.1 TCP/UDP/TLS_*
8.2 Data types
9 In case of problems
10 Support
IP_Com_12 3/23
1 Installation hint
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
2 General information
This function block library contains function blocks for establishing IP connections via a controller. The function
blocks make it possible to establish multiple successive connections to different network devices with one
instance of the firmware function block required for IP connections (UDP_SOCKET, UDP_SEND, UDP_RECEIVE,
TLS_SOCKET, TLS_SEND, TLS_RECEIVE). This means that, out of all the available instantiations of the firmware
function block (number is device-specific), only one instance is occupied for multiple IP connections.
The mode is determined via the variables xUDP and xTLS. UDP mode has highest priority here.
Independent IP connections can be established with the function blocks in this library. The IPC_Socket function
block is still required for the use of additional function block libraries in order to enable IP communication.
For server functionalities and connections maintained over prolonged periods of time, the use of the IPC_Socket is
not recommended. In such cases, the firmware function blocks should be used. For more information on the
function of the firmware function blocks, refer to the PC Worx Engineer help documentation.
NOTE : This library is released with a cycle time >= 20 ms.
IP_Com_12 4/23
3 Change notes
Library Library PLCnext
version build Engineer Change notes
version
12 20220603 2022.0.1 IPC_Socket:
LTS
Bugfix: xSendReq trigger was not recognized if IPC_Socket
was called before the function block instance and xSendReq
was reset too fast.
10 20201012 2020.0 LTS Revised documentation: Added information for TLS configuration.
10 20200914 2020.0 LTS IPC_DiagInfo_EN: Bug fix for “SEM1275: The value exceeds the
range of data type ‘INT’”, new verification in PLCnext Engineer 2021.0
LTS.
9 20200312 2020.0 LTS Adaptation to TLS function blocks PLCnext Engineer 2020.0 LTS
8 20200204 2020.0 LTS Bug fix: Reset x_EN_R from firmware block UDP/TCP/TLS_Receive
on disconnection
7 20191029 2019.0 LTS Adaptation to TLS function blocks
2019.3
2019.6
2019.9
6 20191010 2019.0 LTS Revised documentation
2019.3
2019.6
2019.9
6 20190926 2019.0 LTS Added variables to structure:
2019.3
2019.6
2019.9 uiBind_Port
strBind_IP
strSource_IP
uiSource_Port
4 Supported PLCs
AXC F 1152 (1151412)
AXC F 2152 (2404267)
AXC F 3152 (1069208)
IP_Com_12 7/23
5 Function blocks
Function Description Version Supported License
block articles
IPC_Socket This function block manages the socket firmware 8 - none
function blocks
IP_Com_12 8/23
6 IPC_Socket
This function block manages the socket (firmware function blocks UDP/TLS_SOCKET, UDP/TLS_SEND, and
UDP/TLS_RECEIVE) for the connected IP connections (clients connected via the structure udtIP_Socket). This
function block only has to be instantiated once for the connected clients. If there are multiple instances of
IPC_Socket (allocation of clients) the startup instructions must be observed.
If a falling edge is detected in xSendRequest of the udtIP_Socket, the IPC_Socket does not terminate the
connection. If a falling edge is detected in xConnect of the udtIP_Socket, the IPC_Socket does terminate the
connection. Before a connection is established, the variables xTLS, xUDP and xIS_SRV must be set. If
udtIP_Socket.xAutoReset is TRUE, the IPC_Socket tries to reconnect after an error has occurred. A connection is
established on a rising edge at xConnect or xSendRequest if the udtIP_Socket.xOccupied is FALSE. If xOccupied
is TRUE, the IPC_Socket waits until xOccupied is FALSE and then establishes the connection. As long as xBusy
is TRUE do not change the IP parameter. As long as a valid connection exists the mode (UDP/TCP/TLS) may not
be changed.
All parameters must be reset before the IPC_Socket can be used.
To parameterize the TLS connection use the structure udtIP_Socket.udtConnect.udtConnectInfo with the variables
TrustStoreName, IdentityStoreName, CipherList and HostName.
For details refer to the UDP/TLS_* documentation in the PLCnext Engineer help.
The IP connection to the client is maintained. In the event of a transmission/connection request to a different client,
this existing connection will be terminated.
6.5 Diagnosis
DiagCode AddDiagCode Meaning
16#0000 16#0000 Block is not activated
16#8000 16#0000 Block is active
16#C330 Error of the UDP/TLS_SOCKET_2 firmware function block.
16#C330 16#XXXX Status of the UDP/TLS_SOCKET_2 firmware function block, refer to appendix
for details.
16#C331 Error of the UDP/TLS_RECEIVE_2 firmware function block, refer to appendix for
details.
16#C331 16#XXXX Status of the UDP/TLS_RECEIVE_2 firmware function block, refer to appendix
for details.
16#C332 Error of the UDP/TLS_SEND_2 firmware function block, refer to appendix for
details.
16#C332 16#XXXX Status of the UDP/TLS_SEND_2 firmware function block, refer to appendix for
details.
16#C110 16#0001 Wrong input parameter (udiDataCNT)
16#C410 16#0000 Connect timeout
16#C414 16#0000 Sending timeout
IP_Com_12 10/23
7 Startup examples
For the startup instruction of the IPC_SOCKET function block please find the following example(s):
IPC_*_EXA_IPC_SOCKET.pcwex
This example is packed in the zipped Examples folder of the library.
It describes the use of the IPC_SOCKET function block.
For starting ExampleMachine function block, the requested example can be selected at iExample input and xStart
input has set to TRUE.
udtExample.iState := 20;
END_IF;
20: (* Activate the IPC_SOCKET function block *)
udtExample.udtIP_Socket.xActivate := TRUE;
udtExample.iState := 30;
30: (* Init the IPC_Socket function block and set all variables *)
udtExample.udtIP_Socket.udtConnect.xIS_SRV := FALSE;
udtExample.udtIP_Socket.udtConnect.strDEST_IP := '10.250.85.191';
udtExample.udtIP_Socket.udtConnect.uiDEST_Port := 502;
udtExample.udtIP_Socket.udtSend.udtData.udiCNT := 100;
udtExample.iState := 40;
40: (* Connect with the partner and send data *)
udtExample.udtIP_Socket.udtSend.xSendReq := TRUE;
udtExample.iState := 50;
50: (* Wait for udtSend.xDone *)
IF udtExample.udtIP_Socket.xError = TRUE THEN
(* Error while sending *)
udtExample.iState := 9000;
ELSIF
udtExample.udtIP_Socket.udtSend.xDone = TRUE AND
udtExample.udtIP_Socket.udtConnect.xConnected = TRUE
THEN
(* Reset xSendReq *)
udtExample.udtIP_Socket.udtSend.xSendReq := FALSE;
(* Deactivate IP_Socket *)
udtExample.udtIP_Socket.xActivate := FALSE;
udtExample.iState := 32000;
END_IF;
9000: (* Error handling *)
(* Insert your error handling here *)
IF xStart = FALSE THEN
udtExample.iState := 32000;
END_IF;
32000: (* Example is finished *)
IF udtExample.udtIP_Socket.xActive = FALSE THEN
udtExample.udtIP_Socket.xOccupied := FALSE;
udtExample.iState := 0;
udtExample.iExample := 32000;
END_IF;
END_CASE;
END_IF;
udtExample.udtIP_Socket.xOccupied := FALSE;
udtExample.iState := 0;
udtExample.iExample := 32000;
END_IF;
END_CASE;
END_IF;
IP_Com_12 14/23
8 Appendix
8.1 TCP/UDP/TLS_*
ERROR = FALSE
(* Test-struct *)
IPC_UDT_TEST : STRUCT
udtSOCKET : IPC_UDT_TEST_SOCKET;
udtSEND : IPC_UDT_TEST_SEND;
udtRECEIVE : IPC_UDT_TEST_RECEIVE;
END_STRUCT;
(* Inputs and outputs of UDP_SOCKET *)
IPC_UDT_UDP_SOCKET : STRUCT
(* Inputs *)
xActivate : BOOL;
strBIND_IP : STRING;
uiBIND_Port : UINT;
(* Outputs *)
dwHandle : DWORD;
xActive : BOOL;
xBusy : BOOL;
xError : BOOL;
wStatus : WORD;
uiUSED_Port : UINT;
END_STRUCT;
(* Inputs and outputs of UDP_SEND *)
IPC_UDT_UDP_SEND : STRUCT
(* Inputs *)
xReq : BOOL;
strDEST_IP : STRING;
uiDEST_Port : UINT;
udiData_CNT : UDINT;
(* Outputs *)
xDone : BOOL;
xBusy : BOOL;
xError : BOOL;
wStatus : WORD;
END_STRUCT;
(* Inputs and outputs of UDP_RECEIVE *)
IPC_UDT_UDP_RECEIVE : STRUCT
(* Inputs *)
xEN_R : BOOL;
(* Outputs *)
xNDR : BOOL;
xError : BOOL;
wStatus : WORD;
strSource_IP : STRING;
uiSource_Port : UINT;
udiData_CNT : UDINT;
END_STRUCT;
(* Inputs and outputs of TLS_SOCKET *)
IPC_UDT_TLS_SOCKET : STRUCT
(* Inputs *)
xActivate : BOOL;
xIS_SRV : BOOL;
strBIND_IP : STRING;
uiBIND_Port : UINT;
strDEST_IP : STRING;
uiDEST_Port : UINT;
udtConnectInfo : CONNECTINFO;
xStartTLS : BOOL;
(* Outputs *)
dwHandle : DWORD;
xActive : BOOL;
IP_Com_12 20/23
xBusy : BOOL;
xError : BOOL;
wStatus : WORD;
uiUSED_Port : UINT;
END_STRUCT;
(* Inputs and outputs of TLS_SEND *)
IPC_UDT_TLS_SEND : STRUCT
(* Inputs *)
xReq : BOOL;
dwHandle : DWORD;
udiData_CNT : UDINT;
xSendSecure : BOOL;
(* Outputs *)
xDone : BOOL;
xBusy : BOOL;
xError : BOOL;
wStatus : WORD;
END_STRUCT;
(* Inputs and outputs of TLS_RECEIVE *)
IPC_UDT_TLS_RECEIVE : STRUCT
(* Inputs *)
xEN_R : BOOL;
dwHandle : DWORD;
udiEXP_Data_CNT : UDINT;
xReceiveSecure : BOOL;
(* Outputs *)
xNDR : BOOL;
xError : BOOL;
wStatus : WORD;
strSource_IP : STRING;
uiSource_Port : UINT;
udiData_CNT : UDINT;
END_STRUCT;
(*Diag struct*)
IPC_UDT_DIAG : STRUCT
(* Current state of send *)
iState : INT;
(* Number of retrues *)
iRetry : INT;
(* Current diag code *)
wDiagCode : WORD;
(* Current additional diag code *)
wAddDiagCode : WORD;
udtIP_UDP_SOCKET : IPC_UDT_UDP_SOCKET;
udtIP_UDP_SEND : IPC_UDT_UDP_SEND;
udtIP_UDP_RECEIVE : IPC_UDT_UDP_RECEIVE;
udtIP_TLS_SOCKET : IPC_UDT_TLS_SOCKET;
udtIP_TLS_SEND : IPC_UDT_TLS_SEND;
udtIP_TLS_RECEIVE : IPC_UDT_TLS_RECEIVE;
END_STRUCT;
IPC_UDT_IP_SOCKET : STRUCT
(* TRUE - activates the IPC_SOCKET *)
xActivate : BOOL;
(* TRUE - IPC_SOCKET is active *)
xActive : BOOL;
(* TRUE - locked for other clients *)
xBusy : BOOL;
(* TRUE - Error of IPC_SOCKET *)
xError : BOOL;
(* TRUE - for UDP - FALSE for TCP *)
IP_Com_12 21/23
xUDP : BOOL;
(* TRUE - for TLS IF xUDP = FALSE *)
xTLS : BOOL;
(* TRUE - Interface is occupied by a satellite block *)
xOccupied : BOOL;
(* TRUE - Auto retry is executed *)
xAutoRetry : BOOL;
(* Max Retries before error*)
iMaxRetry : INT;
udtConnect : IPC_UDT_IP_CONNECT;
udtSend : IPC_UDT_IP_SEND;
udtReceive : IPC_UDT_IP_RECEIVE;
udtTest : IPC_UDT_TEST;
udtDiag : IPC_UDT_DIAG;
END_STRUCT;
END_TYPE
IP_Com_12 22/23
9 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 PLCnext Store
(https://www.plcnextstore.com).
2. Is the library released for the PLCnext Engineer 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.
IP_Com_12 23/23
10 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:
Name
Version (e.g. IOL_Basic_7)
Detailed problem description with
Diag codes of all function blocks in error state