(****** QuickLD compiler *******************************)
(****** Copyright Rockwell Automation Canada, Ltd ******)
(****** ST *********************************************)

(*************** Rung **********************************)
(*When reset, put engine at hook 1*)
__STEPPRAGMA
0,1
__ENDSTEPPRAGMA
(*Label :*)(**)
__EDTB1 := RESET_PB ;
IF __EDTB1 THEN
(*Set coil*)
PROX1 := TRUE ;
END_IF ;

(*************** Code for the end of Rung **************)
__GL __LG0001 ;


(*************** Rung **********************************)
(*Simulate pallet up indication. Delay unlatch when pallet dropped*)
__STEPPRAGMA
0,3
__ENDSTEPPRAGMA
(*Label :*)(**)
(* FB call: TON *)
TON_1(PALL_UPCTL, T#3S) ;
__EDTB2 := TON_1.Q ;
IF __EDTB2 THEN
(*Set coil*)
PALL_UPLS := TRUE ;
END_IF ;

(*************** Code for the end of Rung **************)
__GL __LG0002 ;


(*************** Rung **********************************)
(**)
__STEPPRAGMA
0,6
__ENDSTEPPRAGMA
(*Label :*)(**)
(* FB call: TON *)
TON_2(NOT(PALL_UPCTL), T#1S) ;
__EDTB3 := TON_2.Q ;
IF __EDTB3 THEN
(*Reset coil*)
PALL_UPLS := FALSE ;
END_IF ;

(*************** Code for the end of Rung **************)
__GL __LG0003 ;


(*************** Rung **********************************)
(*Simulate rotator up/down control. When moved up, the down ls is immediately unlatched off. After 3 secs, the up ls is latched on. When moving down, the up ls immediately unlatched off. After 3 secs, the down is latched on.*)
__STEPPRAGMA
0,9
__ENDSTEPPRAGMA
(*Label :*)(**)
__EDTB4 := ROTR_DOWN ;
(* FB call: TON *)
TON_3(__EDTB4, T#3S) ;
__EDTB5 := TON_3.Q ;
IF __EDTB5 THEN
(*Set coil*)
ROTR_DNLS := TRUE ;
END_IF ;
__EDTB6 := __EDTB4 ;
IF __EDTB6 THEN
(*Reset coil*)
ROTR_UPLS := FALSE ;
END_IF ;

(*************** Code for the end of Rung **************)
__GL __LG0004 ;


(*************** Rung **********************************)
(**)
__STEPPRAGMA
0,13
__ENDSTEPPRAGMA
(*Label :*)(**)
__EDTB7 := ROTR_UP ;
(* FB call: TON *)
TON_4(__EDTB7, T#3S) ;
__EDTB8 := TON_4.Q ;
IF __EDTB8 THEN
(*Set coil*)
ROTR_UPLS := TRUE ;
END_IF ;
__EDTB9 := __EDTB7 ;
IF __EDTB9 THEN
(*Reset coil*)
ROTR_DNLS := FALSE ;
END_IF ;

(*************** Code for the end of Rung **************)
__GL __LG0005 ;


(*************** Rung **********************************)
(*Simulate rotator rotating control. When rotated CW, the CCW ls is immediately unlatched off. After 3 secs, the CW ls is latched on. When rotated CCW, the CW ls immediately unlatched off. After 3 secs, the CCW is latched on.*)
__STEPPRAGMA
0,17
__ENDSTEPPRAGMA
(*Label :*)(**)
__EDTB10 := ROTAT_CW ;
(* FB call: TON *)
TON_5(__EDTB10, T#3S) ;
__EDTB11 := TON_5.Q ;
IF __EDTB11 THEN
(*Set coil*)
ROTR_CWLS := TRUE ;
END_IF ;
__EDTB12 := __EDTB10 ;
IF __EDTB12 THEN
(*Reset coil*)
ROTR_CCWLS := FALSE ;
END_IF ;

(*************** Code for the end of Rung **************)
__GL __LG0006 ;


(*************** Rung **********************************)
(**)
__STEPPRAGMA
0,21
__ENDSTEPPRAGMA
(*Label :*)(**)
__EDTB13 := ROTAT_CCW ;
(* FB call: TON *)
TON_6(__EDTB13, T#3S) ;
__EDTB14 := TON_6.Q ;
IF __EDTB14 THEN
(*Set coil*)
ROTR_CCWLS := TRUE ;
END_IF ;
__EDTB15 := __EDTB13 ;
IF __EDTB15 THEN
(*Reset coil*)
ROTR_CWLS := FALSE ;
END_IF ;

(*************** Code for the end of Rung **************)
__GL __LG0007 ;


(*************** Rung **********************************)
(*Simulate Pallet Prox Latch it on 6 seconds after one has left the station
Unlatch it off 1.5 seconds after new one retained*)
__STEPPRAGMA
0,25
__ENDSTEPPRAGMA
(*Label :*)(**)
__EDTB16 := ENG2_RET ;
__EDTB17 := TON_7.REDGE ;
(* FB call: TON *)
TON_7((__EDTB16 OR __EDTB17) AND NOT(TON_7.Q), T#6S) ;
__EDTB18 := TON_7.Q ;
IF __EDTB18 THEN
(*Set coil*)
PROX1 := TRUE ;
END_IF ;

(*************** Code for the end of Rung **************)
__GL __LG0008 ;


(*************** Rung **********************************)
(**)
__STEPPRAGMA
0,28
__ENDSTEPPRAGMA
(*Label :*)(**)
(* FB call: TON *)
TON_8(ENG1_RET, T#1S500MS) ;
__EDTB19 := TON_8.Q ;
IF __EDTB19 THEN
(*Reset coil*)
PROX1 := FALSE ;
END_IF ;

(*************** Code for the end of Rung **************)
__GL __LG0009 ;


(*************** Code for the end of File **************)
__GL __LG0000 ;



(*************** Local Symbols table *******************)
(* __EDTB1 *)
(* __EDTB2 *)
(* __EDTB3 *)
(* __EDTB4 *)
(* __EDTB5 *)
(* __EDTB6 *)
(* __EDTB7 *)
(* __EDTB8 *)
(* __EDTB9 *)
(* __EDTB10 *)
(* __EDTB11 *)
(* __EDTB12 *)
(* __EDTB13 *)
(* __EDTB14 *)
(* __EDTB15 *)
(* __EDTB16 *)
(* __EDTB17 *)
(* __EDTB18 *)
(* __EDTB19 *)

