
&ACCESS RVO
&REL 24
&COMMENT PLC on control
DEF SPS ( )
;FOLD DECLARATIONS
;FOLD BASISTECH DECL
;Automatik extern
DECL STATE_T STAT
DECL MODUS_T MODE
;ENDFOLD (BASISTECH DECL)
;ENDFOLD (DECLARATIONS) ;FOLD USER DECL
; Please insert user defined declarations ;ENDFOLD (USER DECL)
;FOLD INI
;FOLD DEFAULT MSG_T
$MSG_T={MSG_T: VALID FALSE,RELEASE FALSE,TYP #NOTIFY,MODUL[] " ",KEY[] " ",PARAM_TYP #VALUE,PARAM[] " ",DLG_FORMAT[] " ",ANSWER 0}
;ENDFOLD (DEFAULT MSG_T)
;FOLD AUTOEXT INIT
INTERRUPT DECL 91 WHEN $PRO_STATE1==#P_FREE DO RESET_OUT ()
INTERRUPT ON 91
$LOOP_MSG[]=" "
MODE=#SYNC
$H_POS=$H_POS
;Automatik extern
IF $MODE_OP==#EX THEN
CWRITE($CMD,STAT,MODE,"RUN /R1/CELL()")
ENDIF
;ENDFOLD (AUTOEXT INIT)
;FOLD USER INIT
; Please insert user defined initialization commands ;ENDFOLD (USER INIT)
;ENDFOLD (INI) LOOP
WAIT FOR NOT($POWER_FAIL) ;FOLD USER PLC
;Make your modifications here
if $out[88]==false then ;workspace[1]==false
enable_mould_close=false
else
endif if $t1==true then
if $out[88]==true then
enable_mould_close=true
enable_mould_open=true
robot_not_ready=true
enable_ejector_back=true
enable_ejector_forward=true
enable_core_puller_1pos1=true
enable_core_puller_1pos2=true
enable_core_puller_2pos1=true
enable_core_puller_2pos2=true
else
enable_mould_close=false
endif
else
endif if $aut==true then
if mould_close==true then
enable_mould_close=false
else
endif
endif if $aut==true then
if ((mould_open==false) and ($out[88]==false)) then
enable_mould_close=false
halt
msg(5)
else
endif
endif ;================
;gripper control
;================
if gripper1_open==true then
gripper1_close=false
else
gripper1_close=true
endif if gripper2_open==true then
gripper2_close=false
else
gripper2_close=true
endif if gripper3_open==true then
gripper3_close=false
else
gripper3_close=true
endif if gripper4_open==true then
gripper4_close=false
else
gripper4_close=true
endif if gripper5_open==true then
gripper5_close=false
else
gripper5_close=true
endif if gripper6_open==true then
gripper6_close=false
else
gripper6_close=true
endif if gripper7_open==true then
gripper7_close=false
else
gripper7_close=true
endif
;ENDFOLD (USER PLC)
ENDLOOP
;FOLD ;%{H}
;FOLD
END
;ENDFOLD
DEF RESET_OUT ( )
INT N
$LOOP_MSG[]=" "
IF REFLECT_PROG_NR == 1 THEN
FOR N = 0 TO PGNO_LENGTH - 1
$OUT[PGNO_FBIT_REFL + N] = FALSE
ENDFOR
ENDIF
IF (PGNO_REQ>0) THEN
$OUT[PGNO_REQ]=FALSE
ELSE
IF (PGNO_REQ<0) THEN
$OUT[-PGNO_REQ]=TRUE
ENDIF
ENDIF
END ;FOLD USER SUBROUTINE
; Integrate your user defined subroutines ;ENDFOLD (USER SUBROUTINE)
&REL 24
&COMMENT PLC on control
DEF SPS ( )
;FOLD DECLARATIONS
;FOLD BASISTECH DECL
;Automatik extern
DECL STATE_T STAT
DECL MODUS_T MODE
;ENDFOLD (BASISTECH DECL)
;ENDFOLD (DECLARATIONS) ;FOLD USER DECL
; Please insert user defined declarations ;ENDFOLD (USER DECL)
;FOLD INI
;FOLD DEFAULT MSG_T
$MSG_T={MSG_T: VALID FALSE,RELEASE FALSE,TYP #NOTIFY,MODUL[] " ",KEY[] " ",PARAM_TYP #VALUE,PARAM[] " ",DLG_FORMAT[] " ",ANSWER 0}
;ENDFOLD (DEFAULT MSG_T)
;FOLD AUTOEXT INIT
INTERRUPT DECL 91 WHEN $PRO_STATE1==#P_FREE DO RESET_OUT ()
INTERRUPT ON 91
$LOOP_MSG[]=" "
MODE=#SYNC
$H_POS=$H_POS
;Automatik extern
IF $MODE_OP==#EX THEN
CWRITE($CMD,STAT,MODE,"RUN /R1/CELL()")
ENDIF
;ENDFOLD (AUTOEXT INIT)
;FOLD USER INIT
; Please insert user defined initialization commands ;ENDFOLD (USER INIT)
;ENDFOLD (INI) LOOP
WAIT FOR NOT($POWER_FAIL) ;FOLD USER PLC
;Make your modifications here
if $out[88]==false then ;workspace[1]==false
enable_mould_close=false
else
endif if $t1==true then
if $out[88]==true then
enable_mould_close=true
enable_mould_open=true
robot_not_ready=true
enable_ejector_back=true
enable_ejector_forward=true
enable_core_puller_1pos1=true
enable_core_puller_1pos2=true
enable_core_puller_2pos1=true
enable_core_puller_2pos2=true
else
enable_mould_close=false
endif
else
endif if $aut==true then
if mould_close==true then
enable_mould_close=false
else
endif
endif if $aut==true then
if ((mould_open==false) and ($out[88]==false)) then
enable_mould_close=false
halt
msg(5)
else
endif
endif ;================
;gripper control
;================
if gripper1_open==true then
gripper1_close=false
else
gripper1_close=true
endif if gripper2_open==true then
gripper2_close=false
else
gripper2_close=true
endif if gripper3_open==true then
gripper3_close=false
else
gripper3_close=true
endif if gripper4_open==true then
gripper4_close=false
else
gripper4_close=true
endif if gripper5_open==true then
gripper5_close=false
else
gripper5_close=true
endif if gripper6_open==true then
gripper6_close=false
else
gripper6_close=true
endif if gripper7_open==true then
gripper7_close=false
else
gripper7_close=true
endif
;ENDFOLD (USER PLC)
ENDLOOP
;FOLD ;%{H}
;FOLD
END
;ENDFOLD
DEF RESET_OUT ( )
INT N
$LOOP_MSG[]=" "
IF REFLECT_PROG_NR == 1 THEN
FOR N = 0 TO PGNO_LENGTH - 1
$OUT[PGNO_FBIT_REFL + N] = FALSE
ENDFOR
ENDIF
IF (PGNO_REQ>0) THEN
$OUT[PGNO_REQ]=FALSE
ELSE
IF (PGNO_REQ<0) THEN
$OUT[-PGNO_REQ]=TRUE
ENDIF
ENDIF
END ;FOLD USER SUBROUTINE
; Integrate your user defined subroutines ;ENDFOLD (USER SUBROUTINE)
