![background image](http://html1.mh-extra.com/html/omron/r88a-mcw151-drt-e/r88a-mcw151-drt-e_operation-manual_742243263.webp)
248
Programming Examples
Appendix C
RETURN
'Motion error routine
'-------------------------------
m_error:
' Program status: Error or emergency stop
VR(programstatus) = 3
' Stop all movements
GOSUB stop_all
' If Servo Driver comm. error then
IF AXISSTATUS AND 4 > 0 THEN
' Stop all programs (including master shell)
HALT
ENDIF
' A reset input can be defined to continue operation
' WAIT UNTIL IN(resetting)=ON
' If Servo Driver Alarm then
' IF AXISSTATUS AND 8 > 0 THEN
' Clear alarm
' DRV_CLEAR
' ENDIF
' GOTO start
STOP
'Emergency stop
'-------------------------------
e_stop:
' Program status: Error or emergency stop
VR(programstatus) = 3
'Stop all movements
GOSUB stop_all
WAIT UNTIL IN(e_stop) = 1
GOTO start
Servo Driver Parameter Setting program
The following program can be used to set the correct Servo Driver settings. Modify the parameters to those
required for the application.
'####################################################################
' Servo Driver parameter setting program
' Tasks: Set-up Servo Driver parameters
' Inputs: None
' Outputs: VR(114) Force reset
' value = FALSE => power toggle or drv_reset not required
' value = TRUE => power toggle or drv_reset required
'####################################################################
force_reset = 114
VR(force_reset)=FALSE
' Initialisation parameters I (re-start / reset required):
' Pn000 Function selection basic switch
' Pn000.1 = 0 : Speed Control (selected)
' Pn000.1 = 9 : Torque / Speed control
IF DRV_READ($000) <> $0000 THEN
DRV_WRITE($000,$0000)
VR(force_reset) = TRUE
ENDIF
' Pn002 Function selection application switch 2
' Pn002.0 = 0 : Torque Limit during speed control not used (selected)
' Pn002.0 = 1 : Torque Limit
' Pn002.1 = 0 : Speed Limit during torque control not used (selected)
' Pn002.1 = 1 : Speed Limit
IF DRV_READ($002)<>$0000 THEN