DMC-40x0 Command Reference #CMDERR • 67
#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:
TC Tell Error Code
_ED Last program line with an error
EN End program
EXAMPLES:
#BEGIN ;'Begin main program
IN "ENTER SPEED",Speed ;'Prompt for speed
JG Speed
BGX ;'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
ZS1 ;'Adjust stack
JP #BEGIN ;'Return to main program
#DONE ;'End program if other error
ZS0 ;'Zero stack
EN1 ;'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