-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug fixes, code clean up and new timer
- Loading branch information
1 parent
34818cf
commit 0326346
Showing
32 changed files
with
361 additions
and
282 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
Retentive Timers/RetentiveTimers/DUTs/Structs/ST_PLC_TASK_INFORMATION.TcDUT
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4024.4"> | ||
<DUT Name="ST_PLC_TASK_INFORMATION" Id="{a37eef95-8873-4302-8f44-a07702bc3028}"> | ||
<Declaration><![CDATA[TYPE ST_PLC_TASK_INFORMATION EXTENDS PlcTaskSystemInfo : | ||
STRUCT | ||
tCycleTime : TIME; // Current task cycle time | ||
tlCycleTime : LTIME; // Current task cycle time in LTIME | ||
END_STRUCT | ||
END_TYPE | ||
]]></Declaration> | ||
</DUT> | ||
</TcPlcObject> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
...tive Timers/RetentiveTimers/POUs/Examples/Section 3 - Stopwatch/P_Example_Stopwatch.TcPOU
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4024.4"> | ||
<POU Name="P_Example_Stopwatch" Id="{869ebe88-c85f-4038-b57e-d41e80f8402e}" SpecialFunc="None"> | ||
<Declaration><![CDATA[PROGRAM P_Example_Stopwatch | ||
VAR | ||
bStart : BOOL; | ||
tElapsed_Time_Stopwatch, | ||
tElapsed_Time_RStopwatch : TIME; | ||
fbStopwatch : FB_Stopwatch; | ||
fbRStopwatch : FB_RStopwatch; | ||
END_VAR | ||
]]></Declaration> | ||
<Implementation> | ||
<ST><![CDATA[(* | ||
NOTES: | ||
-> Activate Configuration and START(F5) PLC Boot Project | ||
-> Login (if you haven't already) | ||
-> Make sure both timers are set for 10 mins | ||
-> Start the timers by writing a TRUE to the bStart variable | ||
-> Let the timers run for a little bit | ||
-> Notice that both elapsed time read are the same | ||
-> STOP(Shift+F5) the PLC Boot Project for approx. 10-30secs | ||
-> START(F5) the PLC Boot Project | ||
*) | ||
fbStopwatch(bStart := bStart, tElapsed => tElapsed_Time_Stopwatch); | ||
fbRStopwatch(bStart := bStart, tElapsed => tElapsed_Time_RStopwatch); ]]></ST> | ||
</Implementation> | ||
<LineIds Name="P_Example_Stopwatch"> | ||
<LineId Id="15" Count="9" /> | ||
<LineId Id="28" Count="2" /> | ||
<LineId Id="32" Count="0" /> | ||
</LineIds> | ||
</POU> | ||
</TcPlcObject> |
15 changes: 15 additions & 0 deletions
15
Retentive Timers/RetentiveTimers/POUs/Examples/Section 3 - Stopwatch/P_Section_3.TcPOU
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4024.4"> | ||
<POU Name="P_Section_3" Id="{9dfa112c-c28e-495f-b48c-fe41abc3434c}" SpecialFunc="None"> | ||
<Declaration><![CDATA[PROGRAM P_Section_3 | ||
VAR | ||
END_VAR | ||
]]></Declaration> | ||
<Implementation> | ||
<ST><![CDATA[P_Example_Stopwatch();]]></ST> | ||
</Implementation> | ||
<LineIds Name="P_Section_3"> | ||
<LineId Id="6" Count="0" /> | ||
</LineIds> | ||
</POU> | ||
</TcPlcObject> |
30 changes: 30 additions & 0 deletions
30
Retentive Timers/RetentiveTimers/POUs/Function Blocks/FB_RStopwatch.TcPOU
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4024.4"> | ||
<POU Name="FB_RStopwatch" Id="{924f45b3-a994-4dee-b158-033e4b7ec793}" SpecialFunc="None"> | ||
<Declaration><![CDATA[// Retentive stopwatch | ||
FUNCTION_BLOCK FB_RStopwatch | ||
VAR_INPUT | ||
bStart : BOOL; | ||
END_VAR | ||
VAR_OUTPUT | ||
tElapsed : TIME; | ||
END_VAR | ||
VAR | ||
stPLC_Task_Info : ST_PLC_TASK_INFORMATION; | ||
tAccumilator : TIME; | ||
fbTON : FB_RTON; | ||
END_VAR | ||
]]></Declaration> | ||
<Implementation> | ||
<ST><![CDATA[IF bStart THEN stPLC_Task_Info := F_Get_PLC_Task_Information(); END_IF | ||
fbTON(PT := stPLC_Task_Info.tCycleTime*2 + tAccumilator); | ||
fbTON(IN := bStart AND NOT(fbTON.Q)); | ||
tAccumilator := fbTON.ET; | ||
IF bStart THEN tElapsed := tAccumilator; END_IF]]></ST> | ||
</Implementation> | ||
<LineIds Name="FB_RStopwatch"> | ||
<LineId Id="53" Count="3" /> | ||
<LineId Id="17" Count="0" /> | ||
</LineIds> | ||
</POU> | ||
</TcPlcObject> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.