![background image](http://html1.mh-extra.com/html/omron/r88a-mcw151-drt-e/r88a-mcw151-drt-e_operation-manual_742243261.webp)
246
Programming Examples
Appendix C
' Wait until process is stopped
WAIT UNTIL PROC_STATUS PROC(3) = 0
' Possible reset of system
IF VR(force_reset) = TRUE THEN
WA(100)
DRV_RESET
WA(100)
ENDIF
ELSE
GOTO m_error
ENDIF
start:
'Stops all movements and programs
'-----------------------------------------------
GOSUB stop_all
' Program status: Motion & programs stopped
VR(programstatus) = 1
WA(10)
'Necessary condition to start operation
'-----------------------------------------------
WAIT UNTIL IN(start_machine)=1
'Start the application program(s)
RUN "application",3
'...
WA(10)
' Program status: Normal running
VR(programstatus) = 2
BASE(0)
'Main loop
'------------------------------------------
loop:
' Check for motion error or Servo Driver OFF
IF MOTION_ERROR THEN
'...
GOTO m_error
ENDIF
' Check for emergency stop
IF IN(e_stop) = 0 THEN
'...
GOTO e_stop
ENDIF
GOTO loop
'------------------------------
'SUBROUTINE AREA
'------------------------------
'Variable initialisation
'------------------------------
init_vars:
'Init local variables
programstatus = 111
alarm_mcw151 = 112
alarm_servodriver = 113
force_reset = 114
'...
'Init local variables
' Program status = Initialising system
VR(programstatus) = 0
VR(alarm_mcw151) = 0
VR(alarm_servodriver) = 0
VR(force_reset) = 0