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

(*************** Rung **********************************)
(*Example 8.1 
Generate part dwell and part move indications. If Run turns off, finish cycle.*)
__STEPPRAGMA
0,1
__ENDSTEPPRAGMA
(*Label :*)(**)
__EDTB1 := RUN ;
__EDTB2 := DWEL_DLY.REDGE ;
__EDTB3 := (__EDTB1 OR __EDTB2) ;
(* FB call: TON *)
Dwel_Dly(__EDTB3 AND NOT(MOVE_DLY.Q), ) ;
MV_PART := Dwel_Dly.Q ;
(* FB call: TON *)
Move_Dly(__EDTB3 AND DWEL_DLY.Q, ) ;
__EDTB4 := Move_Dly.Q ;

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


(*************** Rung **********************************)
(**)
__STEPPRAGMA
0,6
__ENDSTEPPRAGMA
(*Label :*)(**)
DWELL := DWEL_DLY.REDGE AND NOT(DWEL_DLY.Q) ;

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


(*************** Rung **********************************)
(*Shift defect indications left one position. Always shift in a false.*)
__STEPPRAGMA
0,8
__ENDSTEPPRAGMA
(*Label :*)(**)
(* FB call: BSL *)
Def_RCtl(DWELL, DEF_REG, 0, FALSE, 24, 0, 0) ;

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


(*************** Rung **********************************)
(*Initialize shift register by clearing both words.*)
__STEPPRAGMA
0,16
__ENDSTEPPRAGMA
(*Label :*)(**)
(* FB call: COP *)
COP_1(INT_RESET, ZERO_DINT, 0, DEF_REG, 0, 2, FALSE, 0, 0, 0, 0) ;
__MO_COP_1 := INT_RESET ;

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


(*************** Rung **********************************)
(*If defective at station 25 (shift reg .UL bit), hold sol. for 1 sec. to kick it off.*)
__STEPPRAGMA
0,28
__ENDSTEPPRAGMA
(*Label :*)(**)
; (*Pulse detection on : DWELL with __MEMO__1__DWELL *)
__EDTB5 := (DWELL AND NOT(__MEMO__1__DWELL)) AND DEF_RCTL.UNLOAD ;
__EDTB6 := _IO_EM_DO_09 ;
_IO_EM_DO_09 := (__EDTB5 OR __EDTB6) AND NOT(REJ_DLY.Q) ;
(* FB call: TON *)
Rej_Dly(_IO_EM_DO_09, T#1S) ;
__EDTB7 := Rej_Dly.Q ;

(*************** Code for the end of Rung **************)
__GL __LG0005 ;
__MEMO__1__DWELL := DWELL ; (*Pulse detection on : DWELL with __MEMO__1__DWELL *)


(*************** Rung **********************************)
(*Set station 10 defect on rising edge of when part is moved.*)
__STEPPRAGMA
0,33
__ENDSTEPPRAGMA
(*Label :*)(**)
; (*Pulse detection on : MV_PART with __MEMO__2__MV_PART *)
DEF_REG[0].9 := (MV_PART AND NOT(__MEMO__2__MV_PART)) AND ST10_DEFECT ;

(*************** Code for the end of Rung **************)
__GL __LG0006 ;
__MEMO__2__MV_PART := MV_PART ; (*Pulse detection on : MV_PART with __MEMO__2__MV_PART *)


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



(*************** Local Symbols table *******************)
(* __EDTB1 *)
(* __EDTB2 *)
(* __EDTB3 *)
(* __EDTB4 *)
(* __MEMO__1__DWELL *)
(* __EDTB5 *)
(* __EDTB6 *)
(* __EDTB7 *)
(* __MEMO__2__MV_PART *)

