diff --git a/.gitignore b/.gitignore
index 8f8c117..63a08bd 100644
--- a/.gitignore
+++ b/.gitignore
@@ -17,3 +17,5 @@ logs.0*
solution/TrialLicense.tclrs
tools/linux/ADS/
tools/linux/getADSState/getADSState.bin
+_Config/NC/Axes
+_Config/IO
diff --git a/solution/_Config/NC/NC.xti b/solution/_Config/NC/NC.xti
index 2c8f8d7..759c7a3 100644
--- a/solution/_Config/NC/NC.xti
+++ b/solution/_Config/NC/NC.xti
@@ -16,6 +16,5 @@
NC-Task 1 SVB
-
diff --git a/solution/solution.tsproj b/solution/solution.tsproj
index 8c3ec91..bcc972e 100644
--- a/solution/solution.tsproj
+++ b/solution/solution.tsproj
@@ -906,135 +906,6 @@ External Setpoint Generation:
tc_project_app Instance
{08500001-0000-0000-F000-000000000064}
-
- PlcTask Inputs
-
- GVL.axes[1].inputs.bLimitFwd
-
- BOOL
-
-
- GVL.axes[1].inputs.bLimitBwd
-
- BOOL
-
-
- GVL.axes[1].inputs.bHomeSensor
-
- BOOL
-
-
- GVL.axes[1].inputs.bEncLAtch
-
- BOOL
-
-
- GVL.axes[1].Axis.NcToPlc
- NCTOPLC_AXIS_REF
-
- AxisState
-
-
-
- HomingState
-
-
-
- CoupleState
-
-
-
-
- GVL.axes[2].inputs.bLimitFwd
-
- BOOL
-
-
- GVL.axes[2].inputs.bLimitBwd
-
- BOOL
-
-
- GVL.axes[2].inputs.bHomeSensor
-
- BOOL
-
-
- GVL.axes[2].inputs.bEncLAtch
-
- BOOL
-
-
- GVL.axes[2].Axis.NcToPlc
- NCTOPLC_AXIS_REF
-
- AxisState
-
-
-
- HomingState
-
-
-
- CoupleState
-
-
-
-
PlcTask Outputs
@@ -1042,14 +913,6 @@ External Setpoint Generation:
BOOL
-
- GVL.axes[1].Axis.PlcToNc
- PLCTONC_AXIS_REF
-
-
- GVL.axes[2].Axis.PlcToNc
- PLCTONC_AXIS_REF
-
diff --git a/solution/tc_project_app/GVLs/GVL_APP.TcGVL b/solution/tc_project_app/GVLs/GVL_APP.TcGVL
index 9e800ab..e125049 100644
--- a/solution/tc_project_app/GVLs/GVL_APP.TcGVL
+++ b/solution/tc_project_app/GVLs/GVL_APP.TcGVL
@@ -7,7 +7,7 @@ VAR_GLOBAL
END_VAR
VAR_GLOBAL CONSTANT
- axisNum : UINT:=2;
+ axisNum : UINT:=0;
//axisCoupleMax : UINT:=4;
END_VAR]]>
diff --git a/solution/tc_project_app/POUs/MAIN.TcPOU b/solution/tc_project_app/POUs/MAIN.TcPOU
index f81cabd..2621b5e 100644
--- a/solution/tc_project_app/POUs/MAIN.TcPOU
+++ b/solution/tc_project_app/POUs/MAIN.TcPOU
@@ -6,6 +6,7 @@ VAR
sVersion: STRING:='1.0.0';
i : UINT; //index variable for AXES()
aFbAxes: ARRAY [1..gvl_app.axisNum] OF FB_Axis;
+
hmiAxisSelection : INT:=1; //Not possible to use local hmi variables for array indexes
(******Outputs: Power for Limit switches and Home Sensors (every 4th output)********)
@@ -48,6 +49,7 @@ VAR
iRetry : INT;
fbReadEncRefSys : ARRAY [1..gvl_app.axisNum] OF MC_ReadParameter;
fbRestorePosition : ARRAY [1..GVL_app.axisNum] OF MC_SetPosition;
+ fbGetDeviceIdentification : FB_GetDeviceIdentification;
END_VAR
@@ -55,7 +57,22 @@ VAR PERSISTENT
bRestoreOnStartup : BOOL;
END_VAR]]>
-
+
+
+
+
+
+
+
+
+
+ eSUPS_PowerFailure THEN
+ELSIF eGlobalSUpsState <> eSUPS_PowerOK THEN
(* next cycles of powerfailure *)
(* skip regular code execution for the remaining cycles of the powerfailure/writing of persistent data/quick shutdown ... *)
RETURN;
-END_IF
-
-RESTORE_POSITIONS();
-PROG();
-AXES();
-ERROR();]]>
-
-
-
-
+END_IF]]>
@@ -121,6 +127,15 @@ fbEL1808(
]]>
+
+
+ '0') THEN
+ CHECK_UPS();
+ RESTORE_POSITIONS();
+END_IF]]>
+
+
-
+
if busy then continue with PLC cycle and check again next time.
@@ -199,14 +214,14 @@ IF bRestoreExecute AND NOT bPositionRestoreDone THEN
// .valid=FALSE and .busy=FALSE which indicateds the FB probably hasn't started and thus needs to see a rising edge.
// Set execute to low, Exit MAIN.STARTUP and go back a step in the CASE statement.
bExecuteReadEncRefSys:=FALSE;
- eStartUp:=eStartUp-1;
+ eStartUp:=ReadAxisFeedbackType;
iRetry:=iRetry+1; // counter used for troubleshooting to see how many cycles it takes before fbReadEncRefSys function blocks are read correctly
RETURN;
END_IF
END_IF
END_FOR
// If the code gets here all axes either have .valid=TRUE for all axes
- eStartUp:=eStartUp+1;
+ eStartUp:= ExecuteRestore;
ExecuteRestore:
// Execute position restore by setting fbRestorePosition.execute = TRUE
@@ -217,7 +232,7 @@ IF bRestoreExecute AND NOT bPositionRestoreDone THEN
END_IF
END_IF
END_FOR
- eStartUp:=eStartUp+1;
+ eStartUp:= CheckRestore;
CheckRestore:
// Check the set position fbs are finished
@@ -232,7 +247,7 @@ IF bRestoreExecute AND NOT bPositionRestoreDone THEN
END_IF
END_IF
END_FOR
- eStartUp:=eStartUp+1;
+ eStartUp:= FinishRestore;
FinishRestore:
// Remove execute = TRUE for fbRestorePosition
@@ -245,7 +260,7 @@ IF bRestoreExecute AND NOT bPositionRestoreDone THEN
END_IF]]>
-
+
-
-
-
-
+
@@ -271,6 +283,10 @@ END_FOR]]>
+
+
+
+
@@ -287,6 +303,10 @@ END_FOR]]>
+
+
+
+