Refresh EtherNet/IP output
This FP instruction refreshes the output data for the node and connection number specified. Data are copied from the PLC’s operation memory to the PLC’s send buffer.
Input
Node number of the output data to refresh. Scan list range: 1–256
An error occurs when the value specified is outside the scan list range.
The I/O map is used for sending data to a target device (PLC).
Connection number of the output data to refresh. Range: 1–256
An error occurs when the value specified is outside the scan list range.
Output
Memory area storing the refresh results. If this instruction is executed in cycles faster than RPI, the output refresh may not be performed.
0: Refresh operation is completed successfully.
1: No data is received. Refresh is not performed.
2: EtherNet/IP is not ready for communication.
Before you execute the instruction, check if the communication of a specified connection runs normally using FP_ETHERNETIP_GET_STATE_TABLE_RUN.
Call this instruction after sys_bIsEtherNetIPReady turns to TRUE. If it is called before sys_bIsEtherNetIPReady turns to TRUE, an error indicating EtherNet/IP is not ready for communication is returned.
Do not execute this instruction continuously in one scan to reduce communication load.
Use this instruction only for the connection for which Instruction is selected as Refresh Method in EtherNet/IP setting.
if the EtherNet/IP function is not used in the Ethernet unit configuration.
if the area specified using the index modifier exceeds the limit.
if a value specified for a parameter is outside the permissible range.
if the I/O map or the node/connection specified by s1_NodeNumber and s2_ConnectionNumber does not exist.
if the refresh method selected for the connection is something other than Instruction.
if the number of output data of the specified connection is 0.
if the number of refreshed data of the specified connection is 0.
if the EtherNet/IP function is not used in the Ethernet unit configuration.
if the area specified using the index modifier exceeds the limit.
if a value specified for a parameter is outside the permissible range.
if the I/O map or the node/connection specified by s1_NodeNumber and s2_ConnectionNumber does not exist.
if the refresh method selected for the connection is something other than Instruction.
if the number of output data of the specified connection is 0.
if the number of refreshed data of the specified connection is 0.
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
bEnable: BOOL:=FALSE;
iNodeNumber: INT:=0;
iConnectionNumber: INT:=0;
wResult: WORD:=0;
END_VAR
When the variables sys_bIsEtherNetIPReady and bEnable are set to TRUE, the function is executed.
BODY
WORKSPACE
NETWORK_LIST_TYPE := NWTYPELD ;
ACTIVE_NETWORK := 0 ;
END_WORKSPACE
NET_WORK
NETWORK_TYPE := NWTYPELD ;
NETWORK_LABEL := ;
NETWORK_TITLE := ;
NETWORK_HEIGHT := 9 ;
NETWORK_BODY
B(B_VARIN,,iNodeNumber,13,4,15,6,);
B(B_VARIN,,iConnectionNumber,13,5,15,7,);
B(B_VAROUT,,wResult,32,4,34,6,);
B(B_CONTACT,,bEnable,13,1,15,3,);
B(B_CONTACT,,sys_bIsEtherNetIPReady,5,1,7,3,);
B(B_F,FP_ETHERNETIP_REFRESH_OUTPUT!,,15,2,32,7,,?DEN?Ds1_NodeNumber?Ds2_ConnectionNumber?AENO?Cd_Result);
L(1,2,5,2);
L(7,2,13,2);
L(15,2,15,4);
L(1,0,1,9);
END_NETWORK_BODY
END_NET_WORK
END_BODY
IF (sys_bIsEtherNetIPReady) AND (bEnable) then
FP_ETHERNETIP_REFRESH_OUTPUT(s1_NodeNumber := iNodeNumber,
s2_ConnectionNumber := iConnectionNumber,
d_Result => wResult);
END_IF;