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();
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: |
|