First test
This commit is contained in:
90
TwinCAT Projekt1/PLC/POUs/FB_Machine.TcPOU
Normal file
90
TwinCAT Projekt1/PLC/POUs/FB_Machine.TcPOU
Normal file
@@ -0,0 +1,90 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<TcPlcObject Version="1.1.0.1">
|
||||
<POU Name="FB_Machine" Id="{2a7d0c64-8fe2-4a47-820b-42d0ca475bdf}" SpecialFunc="None">
|
||||
<Declaration><![CDATA[FUNCTION_BLOCK FB_Machine EXTENDS FB_ModuleBase
|
||||
VAR_INPUT
|
||||
END_VAR
|
||||
VAR_OUTPUT
|
||||
END_VAR
|
||||
VAR
|
||||
// Debug tags
|
||||
_xRaiseError : BOOL;
|
||||
_xRaiseWarning : BOOL;
|
||||
|
||||
// Alarms
|
||||
_fbError : FB_TcAlarm;
|
||||
_fbWarning : FB_TcAlarm;
|
||||
|
||||
// Helper
|
||||
_xFirstCycle : BOOL := TRUE;
|
||||
END_VAR
|
||||
]]></Declaration>
|
||||
<Implementation>
|
||||
<ST><![CDATA[IF _xFirstCycle THEN
|
||||
_xFirstCycle := FALSE;
|
||||
|
||||
_fbError.CreateEx(stEventEntry := TC_EVENTS.TestAlarms.TestError, FALSE, NULL);
|
||||
_fbWarning.CreateEx(stEventEntry := TC_EVENTS.TestAlarms.TestWarning, FALSE, NULL);
|
||||
END_IF
|
||||
|
||||
// ==============
|
||||
// SLM_BASE stuff
|
||||
// ==============
|
||||
|
||||
|
||||
// ==============
|
||||
// Error handling
|
||||
// ==============
|
||||
|
||||
IF _xRaiseError AND (NOT _fbError.bRaised) THEN
|
||||
_fbError.Raise(0);
|
||||
END_IF
|
||||
|
||||
IF _fbError.bRaised AND (NOT _xRaiseError) THEN
|
||||
_fbError.Clear(0, FALSE);
|
||||
END_IF
|
||||
|
||||
|
||||
// ==============
|
||||
// Warning handling
|
||||
// ==============
|
||||
|
||||
IF _xRaiseWarning AND (NOT _fbWarning.bRaised) THEN
|
||||
_fbWarning.Raise(0);
|
||||
END_IF
|
||||
|
||||
IF _fbWarning.bRaised AND (NOT _xRaiseWarning) THEN
|
||||
_fbWarning.Clear(0, FALSE);
|
||||
END_IF]]></ST>
|
||||
</Implementation>
|
||||
<Method Name="HandleError" Id="{a110de09-0389-4020-aba6-4f381a626cfb}">
|
||||
<Declaration><![CDATA[METHOD HandleError : SLM_Base.E_ReturnCode
|
||||
]]></Declaration>
|
||||
<Implementation>
|
||||
<ST><![CDATA[]]></ST>
|
||||
</Implementation>
|
||||
</Method>
|
||||
<Method Name="HandleSignals" Id="{bd53d3b3-4cc9-43e1-81da-f4f9f4a8e439}">
|
||||
<Declaration><![CDATA[METHOD HandleSignals : SLM_Base.E_ReturnCode
|
||||
]]></Declaration>
|
||||
<Implementation>
|
||||
<ST><![CDATA[]]></ST>
|
||||
</Implementation>
|
||||
</Method>
|
||||
<Method Name="InitialOP" Id="{9006096c-4c67-4231-b0b0-02f92f5119b5}">
|
||||
<Declaration><![CDATA[METHOD InitialOP : SLM_Base.E_ReturnCode
|
||||
]]></Declaration>
|
||||
<Implementation>
|
||||
<ST><![CDATA[InitialOP := E_ReturnCode.SUCCESS;]]></ST>
|
||||
</Implementation>
|
||||
</Method>
|
||||
<Method Name="SetConfig" Id="{8a7c676f-fdbb-44cc-a84d-1ccc592972a9}">
|
||||
<Declaration><![CDATA[(*! @summary Sets config for this entity*)
|
||||
METHOD SetConfig
|
||||
]]></Declaration>
|
||||
<Implementation>
|
||||
<ST><![CDATA[]]></ST>
|
||||
</Implementation>
|
||||
</Method>
|
||||
</POU>
|
||||
</TcPlcObject>
|
||||
Reference in New Issue
Block a user