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 - itfEtherNetIPDevice- IEtherNetIPService- BaseService - eClass- BaseService - dwInstance- DWORD- BaseService - Output - eError- BaseService - Input - wAttribute- WORD- Attribute the services is addressed to. Leave 0 if this service does not address an attribute. - eService- Choose one of the CIPCommonService members, or insert any vendor specific service code. - pWriteData- POINTER TO BYTE - Data to write to the EtherNet/IP Adapter. Leave 0 if no data should be sent to the EtherNet/IP Adapter. - udiWriteDataSize- UDINT- Size of data to write to the EtherNet/IP Adapter. Leave 0 if no data should be sent to the EtherNet/IP Adapter. - pReadData- POINTER 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. - udiReadDataSize- UDINT- Size 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 - udiReceivedDataSize- UDINT- Size of the received data 
