Added JobScheduler and recipe data for stations
This commit is contained in:
41
PLC/01_Stationen/Hotplate/POUs/FB_PWM.TcPOU
Normal file
41
PLC/01_Stationen/Hotplate/POUs/FB_PWM.TcPOU
Normal file
@@ -0,0 +1,41 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<TcPlcObject Version="1.1.0.1">
|
||||
<POU Name="FB_PWM" Id="{39ea0d97-8eb7-44fa-b55f-8461b6c6c8ae}" SpecialFunc="None">
|
||||
<Declaration><![CDATA[FUNCTION_BLOCK FB_PWM
|
||||
VAR_INPUT
|
||||
rPWM : REAL;
|
||||
timPeriod : TIME;
|
||||
END_VAR
|
||||
VAR_OUTPUT
|
||||
xOutput : BOOL;
|
||||
END_VAR
|
||||
VAR
|
||||
_tonTimer : TON;
|
||||
END_VAR
|
||||
]]></Declaration>
|
||||
<Implementation>
|
||||
<ST><![CDATA[// Check for possible division by zero
|
||||
IF TIME_TO_REAL(timPeriod) = 0 THEN
|
||||
xOutput := FALSE;
|
||||
RETURN;
|
||||
END_IF
|
||||
|
||||
_tonTimer(IN := TRUE, PT := timPeriod);
|
||||
IF _tonTimer.Q THEN
|
||||
_tonTimer(IN := FALSE);
|
||||
END_IF
|
||||
|
||||
IF rPWM = 0.0 THEN
|
||||
xOutput := FALSE;
|
||||
ELSIF rPWM >= 100.0 THEN
|
||||
xOutput := TRUE;
|
||||
ELSE
|
||||
IF (1.0 - (TIME_TO_REAL(_tonTimer.ET) / TIME_TO_REAL(timPeriod))) <= (rPWM * 0.01) THEN
|
||||
xOutput := TRUE;
|
||||
ELSE
|
||||
xOutput := FALSE;
|
||||
END_IF
|
||||
END_IF]]></ST>
|
||||
</Implementation>
|
||||
</POU>
|
||||
</TcPlcObject>
|
||||
Reference in New Issue
Block a user