Generic_Service (FB)ΒΆ
FUNCTION_BLOCK Generic_Service EXTENDS BaseService
This function block can be used to generate an own service for an EtherNet/IP Adapter. The message will be sent as an unconnected explicit message request.
Note
Data received and send needs to be swapped. See parent folder.
/// Set trigger to TRUE to execute the service.
/// Example device used here is EtherNet_IP_Adapter.
/// The following service is an example. It can be adapted and be changed to any service.
PROGRAM PLC_PRG
VAR
dut : ENIP.Generic_Service ;
data: usint:=16#FF;
trigger: BOOL;
END_VAR
dut.xExecute := trigger;
dut.itfEtherNetIPDevice := EtherNet_IP_Adapter;
dut.eClass := 16#F5; // TCPIP Interface Object
dut.dwInstance := 1;
dut.wAttribute := 13; // Encapsulation Inactivity Timeout
dut.eService := ENIP.CIPCommonService.SET_ATTRIBUTE_SINGLE;
dut.pWriteData := ADR(data);
dut.udiWriteDataSize := 1;
dut();
- InOut:
Scope
Name
Type
Comment
Inherited from
Input
xExecuteBOOLETrig
Output
xDoneBOOLETrig
xBusyBOOLETrig
xErrorBOOLETrig
Input
itfEtherNetIPDeviceIEtherNetIPServiceBaseService
eClassBaseService
dwInstanceDWORDBaseService
tTimeOutTIMEBaseService
Output
eErrorBaseService
Input
wAttributeWORDAttribute the services is addressed to. Leave 0 if this service does not address an attribute.
eServiceChoose one of the CIPCommonService members, or insert any vendor specific service code.
pWriteDataPOINTER TO BYTE
Data to write to the EtherNet/IP Adapter. Leave 0 if no data should be sent to the EtherNet/IP Adapter.
udiWriteDataSizeUDINTSize of data to write to the EtherNet/IP Adapter. Leave 0 if no data should be sent to the EtherNet/IP Adapter.
pReadDataPOINTER TO BYTE
Data expected to receive from the EtherNet/IP Adapter. Leave 0 if no data is expected to be received from the EtherNet/IP Adapter.
udiReadDataSizeUDINTSize of data expected to receive from the EtherNet/IP Adapter. Leave 0 if no data is expected to be received from the EtherNet/IP Adapter.
Output
udiReceivedDataSizeUDINTSize of the received data