// Declaration Part PROGRAM MAIN VAR stMoverRef : ARRAY [1..cAxcnt] OF AXIS_REF;
fbXtsUnit : FB_XtsUnit;
eMoverIdDetectionMode : MoverIdDetectionMode:= MoverIdDetectionMode.Mover1; //Should be the same as shown in the TcIoXtsDrv object bStartMoverIdDetection : BOOL := TRUE; //Can also be written to trigger the process manually after start up
bMoverIdDetectionError : BOOL; bMoverIdDetected : BOOL; bMoverIdDetectionActive : BOOL; END_VAR
VAR CONSTANT cAxcnt : INT:=10; // Example END_VAR
//----------------------------------------------------------------------------------------------------
// Programm Part // Cyclic call of the main block of the XtsUtility Library. fbXtsUnit(Axis := stMoverRef);
// Check if the position detection of the Movers has been completed. IF NOT fbXtsUnit.stXtsUnit.stTcIoXtsDrv.stParameter.bAreAllMoverPositionsValid THEN // If not all Mover positions are valid, do not process any further. RETURN; END_IF
// Mover1 Functionality // Check if "MoverIdDetectionMode" has been activated. IF eMoverIdDetectionMode = E_MoverIdDetectionMode.Mover1 THEN
// Check if the "MoverIdDetection" has already been started or the Mover1 was found. IF bStartMoverIdDetection AND NOT (bMoverIdDetectionActive OR bMoverIdDetected) THEN bStartMoverIdDetection:=FALSE;
// Trigger the "MoverIdDetection". fbXtsUnit.stXtsUnit.stTcIoXtsDrv.ipTcXtsIo.TriggerMoverIdDetection(); bMoverIdDetectionActive:=TRUE; END_IF
// Check for error or success of "MoverIdDetection". bMoverIdDetectionError := fbXtsUnit.stXtsUnit.stTcIoXtsDrv.stParameter.bHasMoverIdDetectionError; bMoverIdDetected := fbXtsUnit.stXtsUnit.stTcIoXtsDrv.stParameter.bIsMoverIdDetectionValid;
// If the detection has an error, check for errors in output and try again. IF bMoverIdDetectionError THEN bMoverIdDetectionActive:=FALSE; RETURN;
END_IF
// Do not process any further until the "MoverId" was deteced. IF NOT bMoverIdDetected THEN RETURN; END_IF bMoverIdDetectionActive:=FALSE;
// If the "MoverIdDetection" was not activated, // then the start of the "MoverIdDetection" and the search of Mover1 is skipped. ELSE ; END_IF
|