DCP_Identify (FB)ΒΆ
FUNCTION_BLOCK DCP_Identify
The Identify service can be used to discover Profinet devices on the network.
It can be optionally applied with a filter.
Example
PROGRAM PLC_PRG
VAR
    scan : ProfinetCommon.DCP_Identify;
    device : ProfinetCommon.DCP_DeviceData;
    i : DINT;
    dcpSet : ProfinetCommon.DCP_Set;
END_VAR
scan.ControllerID := PN_Controller.MasterID;
scan();          // trigger execution of function block by scan.xExecute := TRUE
IF(scan.xDone) THEN
    FOR i := 0 TO scan.DetectedDevices.Count - 1 DO
        device := scan.DetectedDevices.Get(i);
        IF(device.StationName = 'hello')THEN
            //for testing we just change the IP
            dcpSet.xExecute := TRUE;
            dcpSet.ControllerID := PN_Controller.MasterID;
            dcpSet.MAC := device.MAC;
            dcpSet.Data.Options.IPSettings := TRUE;
            dcpSet.Data.IPSettings := device.IPSettings;
            dcpSet.Data.IPSettings.IPAddress[3] := 123;
        END_IF
    END_FOR
END_IF
dcpSet();
- InOut:
- Scope - Name - Type - Initial - Comment - Input - xExecute- BOOL- Rising edge: Start Operation DCP-Identify - ControllerID- BYTE- The ID of the Controller/Supervisor - Mode- DCP_FilterMode.All - Either detect all devices, or use filter - Filter- DCP attributes used for filtering - Output - xDone- BOOL- Action successfully completed - xBusy- BOOL- Function block active - xError- BOOLTRUE: error occurred, function block aborts actionFALSE: no error- ErrorCode- Service failed - DetectedDevices- List of discovered devices 
