Galil Motion Control manc 18x 6 Page 62
DMC-18x6 Command Reference
54
#CMDERR
FUNCTION: Command error automatic subroutine
DESCRIPTION:
Without #CMDERR defined, if an error (see TC command) occurs in an application program
running on the Galil controller, the program (all threads) will stop. #CMDERR allows the
programmer to handle the error by running code instead of stopping the program.
USAGE:
While Moving
Yes
In a Program
Yes
Command Line
No
Controller Usage
ALL
RELATED COMMANDS:
Tell Error Code
_ED
Last program line with an error
program
EXAMPLES:
#BEGIN
;
'Begin main program
IN
"ENTER SPEED",Speed ;
'Prompt for speed
JG
Speed
BG
X
;
'Begin motion
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
ZS
1 ;
'Adjust stack
JP
#BEGIN
;
'Return to main program
#DONE
;
'End program if other error
ZS
0 ;
'Zero stack
EN
1 ;
'End program
NOTE: An application program must be executing for #CMDERR to execute, which runs in thread 0.
NOTE: Use EN to end the routine