Return the IPv4 connection parameters set by system registers
This FP instruction returns the connection parameters of an IPv4 connection as it has been configured in system registers or by FP_ETHERNET_CONNECTION_SET.
Input
Ethernet port on CPU (FP7 E types):
SYS_ETHERNET_USER_CONNECTION_1–SYS_ETHERNET_USER_CONNECTION_216
Output
Parameters of the Ethernet connection
Elements of the DUT (identifiers): |
Data type |
With/without connection established |
IPv4 | Array[0..3] OF WORD | IP address in Internet protocol version 4 format |
SubnetMask | Array[0..3] OF WORD | Subnet mask |
DefaultGateway | Array[0..3] OF WORD | Default gateway |
wHomePortNumber | WORD | Number of the home port |
wDestIPAddressType | Array[0..3] OF WORD | Address type of destination IP address |
IPv4Dest | Array[0..3] OF WORD | Destination IP address in Internet protocol version 4 format |
wDestPortNumber | WORD | Number of the destination port |
All input and output variables used for programming this function have been declared in the POU header. The same POU header is used for all programming languages.
VAR
dutConnectionStatusConfigured: FP_IPv4_CONNECTION_STATUS_DUT;
bGetConnectionConfigured: BOOL:=FALSE;
@'': @'';
END_VAR
When the variable bGetConnectionConfigured is set to TRUE, the function is carried out.
BODY
WORKSPACE
NETWORK_LIST_TYPE := NWTYPELD ;
ACTIVE_NETWORK := 0 ;
END_WORKSPACE
NET_WORK
NETWORK_TYPE := NWTYPELD ;
NETWORK_LABEL := ;
NETWORK_TITLE := ;
NETWORK_HEIGHT := 6 ;
NETWORK_BODY
B(B_F,FP_IPV4_GET_CONNECTION_CONFIGURED!,,23,0,42,4,,?DEN?DnPort?AENO?CdutIPv4ConnectionStatus);
B(B_VARIN,,SYS_ETHERNET_USER_CONNECTION_1,21,2,23,4,);
B(B_VAROUT,,dutConnectionStatusConfigured,42,2,44,4,);
B(B_CONTACT,,bGetConnectionConfigured,6,1,8,3,);
L(8,2,23,2);
L(1,2,6,2);
L(1,0,1,6);
END_NETWORK_BODY
END_NET_WORK
END_BODY
IF (bGetConnectionConfigured) THEN
FP_IPV4_GET_CONNECTION_CONFIGURED(nPort := SYS_ETHERNET_USER_CONNECTION_1,
dutIPv4ConnectionStatus => dutConnectionStatusConfigured);
END_IF;