Read byte data from receive buffer of EtherNet/IP unit
This FP instruction reads byte data from the receive data buffer specified by FP_ETHERNETIP_DATA_RECEIVE_DUT for an EtherNet/IP message that has been exchanged with FP_ETHERNETIP_DATA_EXCHANGE_FB.
Input
Data unit type of the receive data buffer.
Number of bytes to be read from the receive data buffer.
Input/output
Current byte offset in the receive data buffer.
Output
Start address of the byte data to be read from the receive data buffer.
if the area specified using the index modifier exceeds the limit.
if the EtherNet/IP function is not used in the Ethernet unit configuration.
if a value specified for a parameter is outside the permissible range.
if the area specified using the index modifier exceeds the limit.
if the EtherNet/IP function is not used in the Ethernet unit configuration.
if a value specified for a parameter is outside the permissible range.
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
awMessageData: ARRAY [0..1] OF WORD:=[2(16#0)];
dutReceiveData: FP_ETHERNETIP_DATA_RECEIVE_DUT;
iNumberOfBytes: INT:=3;
iCurrentByteOffset: INT:=0;
bDecodeMessage: BOOL:=FALSE;
END_VAR
When the variable bDecodeMessage is set to TRUE, the function is carried out.
BODY
WORKSPACE
NETWORK_LIST_TYPE := NWTYPELD ;
END_WORKSPACE
NET_WORK
NETWORK_TYPE := NWTYPELD ;
NETWORK_LABEL := ;
NETWORK_TITLE := ;
NETWORK_HEIGHT := 9 ;
NETWORK_BODY
B(B_CONTACT,,bDecodeMessage,5,1,7,3,);
B(B_F,FP_ETHERNETIP_DATA_GET_BYTES!,,17,0,34,6,,?DEN?DdutReceiveData?DnNumberOfBytes?DByteOffset?AByteOffset?AENO?CDataStart);
B(B_VARIN,,dutReceiveData,15,2,17,4,);
B(B_VAROUT,,awMessageData,34,2,36,4,);
B(B_VARIN,,iNumberOfBytes,15,3,17,5,);
B(B_VARIN,,iCurrentByteOffset,15,4,17,6,);
L(1,0,1,9);
L(1,2,5,2);
L(7,2,17,2);
END_NETWORK_BODY
END_NET_WORK
END_BODY
if (bDecodeMessage) then
FP_ETHERNETIP_DATA_GET_BYTES(dutReceiveData := dutReceiveData,
nNumberOfBytes := iNumberOfBytes,
ByteOffset := iCurrentByteOffset,
DataStart => awMessageData);
end_if;