FUNCTION_BLOCK DeviceIterator
Iterator for the devices that are, in the current application, configured for a profinet controller.
Example: generic check of all devices below a controller
PROGRAM CheckDeviceRunning
VAR
devices : ProfinetCommon.DeviceIterator;
deviceList : ARRAY[0..7] OF ProfinetCommon.DeviceInfo;
deviceCount : DINT;
END_VAR
deviceCount := 0;
devices.InitByID(PN_Controller.MasterID); // init. iterator with the controller's ID
WHILE(devices.Next(device => deviceList[deviceCount]) AND deviceCount < 8) DO
deviceCount := deviceCount + 1;
IF(deviceList[deviceCount].xError) THEN
;//show some error
END_IF
END_WHILE
InOut: |
|