Generic_Service (FB)ΒΆ
FUNCTION_BLOCK Generic_Service EXTENDS BaseService
This function block performs a generic service at 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.
/// Force trigger to TRUE to activate.
/// Example device used here is WAGO 750-352 FC ETHERNET.
/// But you can adapt it, by using the services which are implemented by your prefered device.
PROGRAM PLC_PRG
VAR
dut : ENIP.Generic_Service ;
data: usint:=16#FF;
trigger: BOOL;
END_VAR
dut.xExecute := trigger;
dut.itfEtherNetIPDevice := WAGO_750_352_FC_ETHERNET;
dut.eClass := 100;
dut.dwInstance := 1;
dut.wAttribute := 11;
dut.eService := ENIP.CIPCommonService.SET_ATTRIBUTE_SINGLE;
dut.pWriteData := ADR(data);
dut.udiWriteDataSize := 1;
dut();
- InOut:
Scope
Name
Type
Comment
Inherited from
Input
itfEtherNetIPDeviceIEtherNetIPServiceBaseService
eClassBaseService
dwInstanceDWORDBaseService
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