Example - command error – Galil DMC-2X00 User Manual
Page 149
TW 1000
Set the time out to 1000 ms
PA 10000
Position Absolute command
BGA Begin
motion
MCA
Motion Complete trip point
EN
End main program
#MCTIME
Motion Complete Subroutine
MG “A fell short”
Send out a message
EN End
subroutine
This simple program will issue the message “A fell short” if the A axis does not reach the commanded
position within 1 second of the end of the profiled move.
Example - Command Error
Instruction Interpretation
#BEGIN
Begin main program
IN "ENTER SPEED", speed
Prompt for speed
JG speed;BGA
Begin motion
JP #BEGIN
Repeat
EN
End main program
#CMDERR Command
error
utility
JP#DONE,_ED<>2
Check if error on line 2
JP#DONE,_TC<>6
Check if out of range
MG "SPEED TOO HIGH"
Send message
MG "TRY AGAIN"
Send message
ZS1 Adjust
stack
JP #BEGIN
Return to main program
#DONE
End program if other error
ZS0
Zero stack
EN End
program
The above program prompts the operator to enter a jog speed. If the operator enters a number out of
range (greater than 8 million), the #CMDERR routine will be executed prompting the operator to enter
a new number.
In multitasking applications, there is an alternate method for handling command errors from different
threads. Using the XQ command along with the special operands described below allows the
controller to either skip or retry invalid commands.
OPERAND FUNCTION
_ED1
Returns the number of the thread that generated an error
_ED2
Retry failed command (operand contains the location of the failed command)
_ED3
Skip failed command (operand contains the location of the command after the failed
command)
The operands are used with the XQ command in the following format:
XQ _ED2 (or _ED3),_ED1,1
DMC-2X00
Chapter 7 Application Programming
y 139