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

(*************** Rung **********************************)
(* Modbus masster command 03, read register 400000 to 400019 into local_DATA
see local variables modCFG and startPARA initial value*)
__STEPPRAGMA
0,1
__ENDSTEPPRAGMA
(*Label :*)(**)
__EDTB1 := NOT(FLAGERR) ;
__EDTB2 := _IO_EM_DI_00 ;
(* FB call: MSG_MODBUS *)
MSG_MODBUS_1((__EDTB1 OR __EDTB2), FALSE, MODCFG, STARTPARA, LOCALDATA, 0) ;
FLAGERR := MSG_MODBUS_1.Error ;
ERRID := MSG_MODBUS_1.ErrorID ;

(*************** Code for the end of Rung **************)


(*************** Rung **********************************)
(*Read display weight value of on top platform to dispW. Modbus address 400009 (PLC 400010) is display value in Float (REAL) Big-Endina copy dispaly weight value from buffer [9] to dispW
copy scale status  from buffer[8] to 16 bits global varible ststusP0*)
__STEPPRAGMA
0,8
__ENDSTEPPRAGMA
(*Label :*)(**)
(* FB call: COP *)
COP_V9_DISPW(TRUE, LOCALDATA, 9, DISPW, 0, 1, FALSE, , , , ) ;
__MO_COP_1 := TRUE ;
(* FB call: COP *)
COP_V9_STATUS(TRUE, LOCALDATA, 8, STATUSP0, 0, 1, FALSE, , , , ) ;
__MO_COP_2 := TRUE ;
(* FB call: COP *)
COP_V9_SETPOINT(TRUE, LOCALDATA, 11, SETPOINTP0, 0, 1, FALSE, 0, 0, 0, 0) ;
__MO_COP_3 := TRUE ;

(*************** Code for the end of Rung **************)


(*************** Rung **********************************)
(*2.0 demonstrate use dispW value to control some LEDs If dispW < 10.0 or dispW > 1500.0
turn on LED4 (set PLC output O-03)*)
__STEPPRAGMA
0,20
__ENDSTEPPRAGMA
(*Label :*)(**)
__EDTB4 := TRUE ;
IF __EDTB4 THEN
(* Operator output on : < with __EDTB3 *)
__EDTB3 := (DISPW < 10.0) ;
ELSE
__EDTB3 := FALSE ;
END_IF ;
__MO_LESS_1 := __EDTB3 ;
__EDTB5 := __EDTB3 ;
__EDTB7 := TRUE ;
IF __EDTB7 THEN
(* Operator output on : > with __EDTB6 *)
__EDTB6 := (DISPW > 1500.0) ;
ELSE
__EDTB6 := FALSE ;
END_IF ;
__MO_GREAT_1 := __EDTB6 ;
__EDTB8 := __EDTB6 ;
_IO_EM_DO_03 := (__EDTB5 OR __EDTB8) ;

(*************** Code for the end of Rung **************)


(*************** Rung **********************************)
(* If dispW >= 100.0
turn on LED1 (set PLC output O-00)
*)
__STEPPRAGMA
0,27
__ENDSTEPPRAGMA
(*Label :*)(**)
__EDTB10 := TRUE ;
IF __EDTB10 THEN
(* Operator output on : >= with __EDTB9 *)
__EDTB9 := (DISPW >= 100.0) ;
ELSE
__EDTB9 := FALSE ;
END_IF ;
__MO_GREATEQUAL_1 := __EDTB9 ;
_IO_EM_DO_00 := __EDTB9 ;

(*************** Code for the end of Rung **************)


(*************** Rung **********************************)
(* If dispW >= 500.0
turn on LED2 (set PLC output O-01)
*)
__STEPPRAGMA
0,31
__ENDSTEPPRAGMA
(*Label :*)(**)
__EDTB12 := TRUE ;
IF __EDTB12 THEN
(* Operator output on : >= with __EDTB11 *)
__EDTB11 := (DISPW >= 500.0) ;
ELSE
__EDTB11 := FALSE ;
END_IF ;
__MO_GREATEQUAL_2 := __EDTB11 ;
_IO_EM_DO_01 := __EDTB11 ;

(*************** Code for the end of Rung **************)


(*************** Rung **********************************)
(* If dispW >= 1000.0
turn on LED3 (set PLC output O-02)*)
__STEPPRAGMA
0,35
__ENDSTEPPRAGMA
(*Label :*)(**)
__EDTB14 := TRUE ;
IF __EDTB14 THEN
(* Operator output on : >= with __EDTB13 *)
__EDTB13 := (DISPW >= 1000.0) ;
ELSE
__EDTB13 := FALSE ;
END_IF ;
__MO_GREATEQUAL_3 := __EDTB13 ;
_IO_EM_DO_02 := __EDTB13 ;

(*************** Code for the end of Rung **************)


(*************** Rung **********************************)
(*3.1 unit control shift unit at input I-04 rising edge, single coil weite command 05, set 1 to coil 04 address 100004
LC830 input I-04 rising edgel*)
__STEPPRAGMA
0,39
__ENDSTEPPRAGMA
(*Label :*)(**)
; (*Pulse detection on : _IO_EM_DI_04 with __MEMO__1___IO_EM_DI_04 *)
(* FB call: MSG_MODBUS *)
MSG_MODBUS_COIL_UNIT((_IO_EM_DI_04 AND NOT(__MEMO__1___IO_EM_DI_04)), FALSE, UNITCFG, UNITADDR, UNITDATA, 0) ;

(*************** Code for the end of Rung **************)
__MEMO__1___IO_EM_DI_04 := _IO_EM_DI_04 ; (*Pulse detection on : _IO_EM_DI_04 with __MEMO__1___IO_EM_DI_04 *)


(*************** Rung **********************************)
(*3.2  Net/Gross control toggle net/gross at LC830 input I-05 rising edge.
single coil weite command 05, set 1 to coil 05 address 100005*)
__STEPPRAGMA
0,46
__ENDSTEPPRAGMA
(*Label :*)(**)
; (*Pulse detection on : _IO_EM_DI_05 with __MEMO__2___IO_EM_DI_05 *)
(* FB call: MSG_MODBUS *)
MSG_MODBUS_NETGROSS((_IO_EM_DI_05 AND NOT(__MEMO__2___IO_EM_DI_05)), FALSE, NETGROSSCFG, NETGROSSADDR, NETGRASSDATA, 0) ;

(*************** Code for the end of Rung **************)
__MEMO__2___IO_EM_DI_05 := _IO_EM_DI_05 ; (*Pulse detection on : _IO_EM_DI_05 with __MEMO__2___IO_EM_DI_05 *)


(*************** 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 *)
(* __MEMO__1___IO_EM_DI_04 *)
(* __MEMO__2___IO_EM_DI_05 *)

