FP_ETHERNETIP_DATA_EXCHANGE_FB

Exchange message with EtherNet/IP unit

This function block exchanges an explicit message with an EtherNet/IP unit at the specified destination.

Parameters

Input

bSend (BOOL)

Data exchange starts at a rising edge

dutDestination (FP_ETHERNETIP_DATA_DESTINATION_DUT)

Data unit type with information of the destination EtherNet/IP unit

dutSendData (FP_ETHERNETIP_DATA_SEND_DUT)

Data unit type of the send data buffer.

Data can be written into the send data buffer using the instruction FP_ETHERNETIP_DATA_SET

Output

bInProgress (BOOL)

Flag indicating that the data exchange with the destination EtherNet\IP unit is in progress.

dutResult (FP_ETHERNETIP_DATA_EXCHANGE_RESULT_DUT)

Data unit type of the instruction execution result

dutReceiveData (FP_ETHERNETIP_DATA_RECEIVE_DUT)

Data unit type of the receive data buffer.

Data can be read from the receive data buffer using the instructions FP_ETHERNETIP_DATA_GET and FP_ETHERNETIP_DATA_GET_BYTES

Error flags

sys_bIsOperationErrorHold (turns to TRUE and remains TRUE)
  • 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 the instruction is executed in an interrupt program

  • if the size of the receive data buffer for dutReceiveData is outside the permissible range (3–253 words).

  • if the size of the receive data buffer for dutResult is less than 3 words.

sys_bIsOperationErrorNonHold (turns to TRUE for one scan)
  • 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 the instruction is executed in an interrupt program

  • if the size of the receive data buffer for dutReceiveData is outside the permissible range (3–253 words).

  • if the size of the receive data buffer for dutResult is less than 3 words.

Example

POU header

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
		dutSend: FP_ETHERNETIP_DATA_SEND_DUT;
		FP_ETHERNETIP_DATA_EXCHANGE_FB1: FP_ETHERNETIP_DATA_EXCHANGE_FB;
		bSend: BOOL:=FALSE;
		dutDestination: FP_ETHERNETIP_DATA_DESTINATION_DUT;
		dutReceive: FP_ETHERNETIP_DATA_RECEIVE_DUT;
		dutResult: FP_ETHERNETIP_DATA_EXCHANGE_RESULT_DUT;
	END_VAR

LD body

When the variables sys_bIsEtherNetIPReady and bSend are set to TRUE, the function is executed.

BODY
    WORKSPACE
        NETWORK_LIST_TYPE := NWTYPELD ;
    END_WORKSPACE
    NET_WORK
        NETWORK_TYPE := NWTYPELD ;
        NETWORK_LABEL :=  ;
        NETWORK_TITLE :=  ;
        NETWORK_HEIGHT := 6 ;
        NETWORK_BODY
B(B_CONTACT,,sys_bIsEtherNetIPReady,5,2,7,4,);
B(B_CONTACT,,bSend,13,2,15,4,);
B(B_FB,FP_ETHERNETIP_DATA_EXCHANGE_FB!,FP_ETHERNETIP_DATA_EXCHANGE_FB1,21,1,39,6,,?BbSend?BdutDestination?BdutSendData?AbInProgress?AdutReceiveData?AdutResult);
B(B_VARIN,,dutDestination,19,3,21,5,);
B(B_VAROUT,,dutResult,39,3,41,5,);
B(B_VARIN,,dutSend,19,4,21,6,);
B(B_VAROUT,,dutReceive,39,4,41,6,);
L(1,0,1,6);
L(1,3,5,3);
L(7,3,13,3);
L(15,3,21,3);
        END_NETWORK_BODY
    END_NET_WORK
END_BODY

ST body

If (sys_bIsEtherNetIPReady) and (bSend) Then
    FP_ETHERNETIP_DATA_EXCHANGE_FB1(bSend := bSend,
                                    dutDestination := dutDestination,
                                    dutSendData := dutSend,
                                    dutResult => dutResult,
                                    dutReceiveData => dutReceive);
End_if;

Modified on: 2022-03-02Feedback on this pagePanasonic hotline