Initial commit
This commit is contained in:
168
TC3_CNCPLCBase/OEM/PRG_Einspeisung.TcPOU
Normal file
168
TC3_CNCPLCBase/OEM/PRG_Einspeisung.TcPOU
Normal file
@@ -0,0 +1,168 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4024.6">
|
||||
<POU Name="PRG_Einspeisung" Id="{5cd6801a-283d-4acd-9eba-b4e80aa15a2c}" SpecialFunc="None">
|
||||
<Declaration><![CDATA[PROGRAM PRG_Einspeisung
|
||||
VAR
|
||||
// Einschalten der Einspeisung
|
||||
bEnable : BOOL := TRUE;
|
||||
|
||||
// statuswort der Einspeisung
|
||||
uiZsw AT %I* : UINT;
|
||||
|
||||
bError : BOOL;
|
||||
|
||||
// Steuerwort der Einspeisung
|
||||
uiStw AT %Q* : UINT := 0;
|
||||
|
||||
// Ausgänge der CU
|
||||
uiCUIO AT %Q* : USINT;
|
||||
|
||||
// Einspeisung aktiv (für extern)
|
||||
bInfeedActive : BOOL;
|
||||
|
||||
wZsw : WORD := 0;
|
||||
wStw : WORD := 0;
|
||||
wCUIO : WORD := 0;
|
||||
|
||||
// Zustandsvariable
|
||||
nState : INT := 0;
|
||||
|
||||
bBtnEnable : BOOL;
|
||||
bBtnDisable AT %I* : BOOL;
|
||||
|
||||
bLEDBtnEnable : BOOL;
|
||||
bLEDBtnDissable : BOOL;
|
||||
|
||||
rtEinschalten : R_TRIG;
|
||||
rtAusschalten : R_TRIG;
|
||||
END_VAR
|
||||
]]></Declaration>
|
||||
<Implementation>
|
||||
<ST><![CDATA[// Umwandeln des Zustandwortes
|
||||
wZsw := UINT_TO_WORD(uiZsw);
|
||||
wStw := UINT_TO_WORD(uiStw);
|
||||
|
||||
bError := (gpAx[0]^.lr_state.axis_state_r <> 7) AND (gpAx[1]^.lr_state.axis_state_r <> 7);
|
||||
|
||||
wStw.10 := 1;
|
||||
|
||||
bBtnEnable := GVL_OEM.bBtnInfeedEnable;
|
||||
GVL_OEM.bBtnInfeedEnableLED := bLEDBtnEnable;
|
||||
|
||||
rtEinschalten(CLk := bBtnEnable AND bError);
|
||||
IF rtEinschalten.Q THEN
|
||||
bEnable := TRUE;
|
||||
END_IF
|
||||
|
||||
rtAusschalten(CLK := bBtnDisable);
|
||||
IF rtAusschalten.Q THEN
|
||||
bEnable := FALSE;
|
||||
END_IF
|
||||
|
||||
bLEDBtnEnable := wZsw.2;
|
||||
bLEDBtnDissable := NOT wZsw.2;
|
||||
|
||||
wCUIO.4 := wZsw.2;
|
||||
wCUIO.5 := wZsw.2;
|
||||
|
||||
CASE nState OF
|
||||
0: // Einschaltsperre
|
||||
wStw.0 := 0;
|
||||
wStw.1 := 1;
|
||||
|
||||
bInfeedActive := FALSE;
|
||||
|
||||
IF wZsw.0 AND (NOT wZsw.1) AND (NOT wZsw.2) AND (NOT wZsw.6) AND bEnable THEN
|
||||
nState := 10;
|
||||
END_IF
|
||||
|
||||
10: // Einschaltbereit
|
||||
wStw.0 := 1;
|
||||
|
||||
IF (wZsw.0 = 1) AND (wZsw.1 = 1) AND (wZsw.2 = 0) AND (wZsw.6 = 0) THEN
|
||||
nState := 20;
|
||||
END_IF
|
||||
|
||||
20: // Betriebsbereit
|
||||
wStw.3 := 1;
|
||||
|
||||
IF (wZsw.0 = 1) AND (wZsw.1 = 1) AND (wZsw.2 = 1) AND (wZsw.6 = 0) THEN
|
||||
nState := 30;
|
||||
END_IF
|
||||
|
||||
30: //Betrieb
|
||||
bInfeedActive := TRUE;
|
||||
|
||||
IF (NOT bEnable) THEN
|
||||
wStw.0 := 0;
|
||||
wStw.1 := 0;
|
||||
wStw.3 := 0;
|
||||
wCUIO.4 := 0;
|
||||
wCUIO.5 := 0;
|
||||
nState := 0;
|
||||
END_IF
|
||||
END_CASE
|
||||
|
||||
IF (wZsw.3) AND PLCReset THEN
|
||||
wStw.7 := 1;
|
||||
ELSE
|
||||
wStw.7 := 0;
|
||||
END_IF
|
||||
|
||||
// Umwandeln des Steuerwortes
|
||||
uiStw := WORD_TO_UINT(wStw);
|
||||
uiCUIO := WORD_TO_USINT(wCUIO);]]></ST>
|
||||
</Implementation>
|
||||
<LineIds Name="PRG_Einspeisung">
|
||||
<LineId Id="48" Count="0" />
|
||||
<LineId Id="5" Count="0" />
|
||||
<LineId Id="52" Count="0" />
|
||||
<LineId Id="297" Count="0" />
|
||||
<LineId Id="296" Count="0" />
|
||||
<LineId Id="74" Count="0" />
|
||||
<LineId Id="73" Count="0" />
|
||||
<LineId Id="334" Count="0" />
|
||||
<LineId Id="333" Count="0" />
|
||||
<LineId Id="335" Count="0" />
|
||||
<LineId Id="137" Count="0" />
|
||||
<LineId Id="136" Count="0" />
|
||||
<LineId Id="138" Count="2" />
|
||||
<LineId Id="142" Count="0" />
|
||||
<LineId Id="141" Count="0" />
|
||||
<LineId Id="143" Count="2" />
|
||||
<LineId Id="150" Count="0" />
|
||||
<LineId Id="149" Count="0" />
|
||||
<LineId Id="151" Count="0" />
|
||||
<LineId Id="261" Count="1" />
|
||||
<LineId Id="260" Count="0" />
|
||||
<LineId Id="18" Count="0" />
|
||||
<LineId Id="17" Count="0" />
|
||||
<LineId Id="19" Count="0" />
|
||||
<LineId Id="21" Count="1" />
|
||||
<LineId Id="181" Count="1" />
|
||||
<LineId Id="23" Count="10" />
|
||||
<LineId Id="35" Count="3" />
|
||||
<LineId Id="40" Count="1" />
|
||||
<LineId Id="39" Count="0" />
|
||||
<LineId Id="42" Count="1" />
|
||||
<LineId Id="184" Count="1" />
|
||||
<LineId Id="44" Count="0" />
|
||||
<LineId Id="85" Count="1" />
|
||||
<LineId Id="84" Count="0" />
|
||||
<LineId Id="224" Count="1" />
|
||||
<LineId Id="55" Count="0" />
|
||||
<LineId Id="54" Count="0" />
|
||||
<LineId Id="20" Count="0" />
|
||||
<LineId Id="105" Count="0" />
|
||||
<LineId Id="104" Count="0" />
|
||||
<LineId Id="106" Count="0" />
|
||||
<LineId Id="108" Count="0" />
|
||||
<LineId Id="110" Count="0" />
|
||||
<LineId Id="107" Count="0" />
|
||||
<LineId Id="50" Count="0" />
|
||||
<LineId Id="49" Count="0" />
|
||||
<LineId Id="51" Count="0" />
|
||||
<LineId Id="226" Count="0" />
|
||||
</LineIds>
|
||||
</POU>
|
||||
</TcPlcObject>
|
||||
Reference in New Issue
Block a user