FUNCTION FC1 :void
VAR_INPUT
sensor:BOOL;
mytime : TIMER;
initialvalue : S5TIME ;
END_VAR
VAR_OUTPUT
motor_start:BOOL;
END_VAR
VAR
PE:BOOL; //kenar kontrolu için kullanıcaz
basla : BOOL ;
reset : BOOL ;
bcdvalue : s5time;
binvalue : WORD ;
END_VAR
BEGIN
bcdvalue := S_PEXT (T_NO := mytime,
S := basla ,
TV := initialvalue ,
R := not motor_start ,
BI := binvalue ,
Q := motor_start) ;
IF sensor=1 AND PE=0 THEN
PE:=1;
END_IF;
IF sensor=true AND PE=true THEN
basla:=1;
PE:=0;
END_IF;
IF motor_start=true THEN
basla:=false;
END_IF;
END_FUNCTION