Format IF statements with jump line each condition
This commit is contained in:
@@ -104,7 +104,7 @@ GVL.fbGetCurTaskIndex();
|
|||||||
//Create as many programs in that folder as axes and applications you have or need
|
//Create as many programs in that folder as axes and applications you have or need
|
||||||
|
|
||||||
//Axes initial parameters and program
|
//Axes initial parameters and program
|
||||||
Axis_Template();
|
//Axis_Template();
|
||||||
//Pneumatics_Template();
|
//Pneumatics_Template();
|
||||||
|
|
||||||
//Application program calls
|
//Application program calls
|
||||||
@@ -148,7 +148,7 @@ IF bRestoreExecute AND NOT bPositionRestoreDone THEN
|
|||||||
ReadMode := E_READMODE.READMODE_ONCE);
|
ReadMode := E_READMODE.READMODE_ONCE);
|
||||||
END_FOR
|
END_FOR
|
||||||
|
|
||||||
//Cycle through set position function blocks for each axis
|
//Cycle through set position and MC_WritePArameter function blocks for each axis
|
||||||
FOR iAxes := 1 TO GVL_APP.nAXIS_NUM DO
|
FOR iAxes := 1 TO GVL_APP.nAXIS_NUM DO
|
||||||
afbSetPosition[iAxes](
|
afbSetPosition[iAxes](
|
||||||
Axis := GVL.astAxes[iAxes].Axis,
|
Axis := GVL.astAxes[iAxes].Axis,
|
||||||
@@ -199,16 +199,21 @@ IF bRestoreExecute AND NOT bPositionRestoreDone THEN
|
|||||||
eStartUp := eExecuteRestore;
|
eStartUp := eExecuteRestore;
|
||||||
|
|
||||||
eExecuteRestore:
|
eExecuteRestore:
|
||||||
//Execute position restore by setting afbRestorePosition.execute = TRUE
|
//Execute position and encoder BIAS restore by setting Execute = TRUE
|
||||||
//Restore position value for incremental encoders
|
FOR iAxes := 1 TO GVL_APP.nAXIS_NUM DO
|
||||||
FOR iAxes := 1 TO GVL_APP.nAXIS_NUM DO
|
|
||||||
IF GVL.astAxes[iAxes].stConfig.eRestorePosition = E_RestorePosition.eRestoreWithoutHome THEN
|
IF GVL.astAxes[iAxes].stConfig.eRestorePosition = E_RestorePosition.eRestoreWithoutHome THEN
|
||||||
IF NOT astAxesPersistent[iAxes].bMovingAtShutdown AND (afbReadEncRefSys[iAxes].Value = 0 OR afbReadEncRefSys[iAxes].Value = 2 OR afbReadEncRefSys[iAxes].Value = 4) THEN
|
//Restore position value for incremental encoders
|
||||||
afbSetPosition[iAxes].Execute := TRUE;
|
IF NOT astAxesPersistent[iAxes].bMovingAtShutdown AND
|
||||||
//Restore encoder position BIAS for absolute encoders
|
(afbReadEncRefSys[iAxes].Value = 0 OR
|
||||||
ELSIF afbReadEncRefSys[iAxes].Value = 1 OR afbReadEncRefSys[iAxes].Value = 3 OR afbReadEncRefSys[iAxes].Value = 5 THEN
|
afbReadEncRefSys[iAxes].Value = 2 OR
|
||||||
afbWritePositionBias[iAxes].Execute := TRUE;
|
afbReadEncRefSys[iAxes].Value = 4) THEN
|
||||||
END_IF
|
afbSetPosition[iAxes].Execute := TRUE;
|
||||||
|
//Restore encoder position BIAS for absolute encoders
|
||||||
|
ELSIF afbReadEncRefSys[iAxes].Value = 1 OR
|
||||||
|
afbReadEncRefSys[iAxes].Value = 3 OR
|
||||||
|
afbReadEncRefSys[iAxes].Value = 5 THEN
|
||||||
|
afbWritePositionBias[iAxes].Execute := TRUE;
|
||||||
|
END_IF
|
||||||
ELSE
|
ELSE
|
||||||
RETURN;
|
RETURN;
|
||||||
END_IF
|
END_IF
|
||||||
@@ -217,18 +222,23 @@ IF bRestoreExecute AND NOT bPositionRestoreDone THEN
|
|||||||
|
|
||||||
|
|
||||||
eCheckRestore:
|
eCheckRestore:
|
||||||
//Check the set position fbs are finished
|
//Check the set position and write enocder BIAS fbs are finished
|
||||||
//Nothing actually happens if the restore is not done, the code just returns from here each cycle and the
|
//Nothing actually happens if the restore is not done, the code just returns from here each cycle and the
|
||||||
//bPositionRestoreDone will never get set to TRUE and will take up cycle time
|
//bPositionRestoreDone will never get set to TRUE and will take up cycle time
|
||||||
FOR iAxes := 1 TO GVL_APP.nAXIS_NUM DO
|
FOR iAxes := 1 TO GVL_APP.nAXIS_NUM DO
|
||||||
IF GVL.astAxes[iAxes].stConfig.eRestorePosition = E_RestorePosition.eRestoreWithoutHome THEN
|
IF GVL.astAxes[iAxes].stConfig.eRestorePosition = E_RestorePosition.eRestoreWithoutHome THEN
|
||||||
IF NOT astAxesPersistent[iAxes].bMovingAtShutdown AND (afbReadEncRefSys[iAxes].Value = 0 OR afbReadEncRefSys[iAxes].Value = 2 OR afbReadEncRefSys[iAxes].Value = 4) THEN
|
IF NOT astAxesPersistent[iAxes].bMovingAtShutdown AND
|
||||||
|
(afbReadEncRefSys[iAxes].Value = 0 OR
|
||||||
|
afbReadEncRefSys[iAxes].Value = 2 OR
|
||||||
|
afbReadEncRefSys[iAxes].Value = 4) THEN
|
||||||
IF NOT afbSetPosition[iAxes].Done THEN
|
IF NOT afbSetPosition[iAxes].Done THEN
|
||||||
afbSetPosition[iAxes].Execute := FALSE;
|
afbSetPosition[iAxes].Execute := FALSE;
|
||||||
eStartUp := eExecuteRestore;
|
eStartUp := eExecuteRestore;
|
||||||
RETURN;
|
RETURN;
|
||||||
END_IF
|
END_IF
|
||||||
ELSIF afbReadEncRefSys[iAxes].Value = 1 OR afbReadEncRefSys[iAxes].Value = 3 OR afbReadEncRefSys[iAxes].Value = 5 THEN
|
ELSIF afbReadEncRefSys[iAxes].Value = 1 OR
|
||||||
|
afbReadEncRefSys[iAxes].Value = 3 OR
|
||||||
|
afbReadEncRefSys[iAxes].Value = 5 THEN
|
||||||
IF NOT afbWritePositionBias[iAxes].Done THEN
|
IF NOT afbWritePositionBias[iAxes].Done THEN
|
||||||
afbWritePositionBias[iAxes].Execute := FALSE;
|
afbWritePositionBias[iAxes].Execute := FALSE;
|
||||||
eStartUp := eExecuteRestore;
|
eStartUp := eExecuteRestore;
|
||||||
@@ -242,7 +252,7 @@ IF bRestoreExecute AND NOT bPositionRestoreDone THEN
|
|||||||
eStartUp := eFinishRestore;
|
eStartUp := eFinishRestore;
|
||||||
|
|
||||||
eFinishRestore:
|
eFinishRestore:
|
||||||
//Remove execute = TRUE for afbRestorePosition
|
//Remove execute = TRUE for afbRestorePosition and fbWritePositionBias
|
||||||
FOR iAxes := 1 TO GVL_APP.nAXIS_NUM DO
|
FOR iAxes := 1 TO GVL_APP.nAXIS_NUM DO
|
||||||
afbSetPosition[iAxes].Execute := FALSE;
|
afbSetPosition[iAxes].Execute := FALSE;
|
||||||
afbWritePositionBias[iAxes].Execute := FALSE;
|
afbWritePositionBias[iAxes].Execute := FALSE;
|
||||||
|
|||||||
Reference in New Issue
Block a user