MotionBASIC
TM
Error Handler
Source Code Overview
When an error occurs, the program branches to the ERR.HDLR subroutine.
If
the error is a range error from an INPUT @ data input statement (ERR = 1218
or 1219) and MENU.BAS is present (MENU.VER$ <> ""), it calls MENU.ERR to
handle the fault. After the program returns from MENU.ERR, the error handler
executes a RESUME statement.
If the error is not a data input range error, or MENU.BAS is not present,
ERR.HDLR calls your APPL.ERR.TRAP subroutine. APPL.ERR.TRAP should
check whether it is a recoverable error. If the error is recoverable, your
subroutine should do whatever is necessary to recover and then set
RESUME.FLAG=TRUE. Execution then resumes at the statement where the
error occurred.
If the program RETURNs from APPL.ERR.TRAP with RESUME.FLAG=FALSE,
execution continues with the rest of the Error Handler.
Up to this point, the Error Handler has not taken any action to contain the
problem. Your APPL.ERR.TRAP subroutine must determine if the problem is
not recoverable and return to ERR.HDLR quickly as possible so that the
machine can be shutdown safely.
CAUTION......
Any programming errors, etc. in your APPL.ERR.TRAP subroutine will cause
the program to stop execution without going through the shutdown sequence. If
this happens, any motion in process will be stopped, however the NO FAULT
relay contacts may remain closed and the servo drives may remain enabled.
Controller Faults, regardless of when they happen, will always open the
NO FAULT relay contacts.
After returning from your APPL.ERR.TRAP subroutine, the Error Handler
executes a GOTO ERR.ESTOP.
ERR.ESTOP calls your APPL.ESTOP subroutine. This subroutine gives you
the opportunity to create an emergency stop sequence that considers your
machine’s special requirements.
NOTE......
Controller Faults will automatically open the NO FAULT relay contacts before
the program gets to your APPL.ESTOP subroutine.
After the program RETURNs from your APPL.ESTOP subroutine, ERR.ESTOP
will stop all motion, wait for 500 user time units and then disable all servos.
ERR.ESTOP will do all this even if your APPL.ESTOP has already taken these
steps.
CAUTION......
Any programming errors, etc. in your APPL.ESTOP subroutine will cause the
program to stop execution without completing your shutdown sequence. If this
happens, any motion in process will be stopped, however the NO FAULT relay
contacts may remain closed and the servo drives may remain enabled.
Controller Faults, regardless of when they happen, will always open the
NO FAULT relay contacts.
After the servos have been disabled, ERR.ESTOP executes a RESUME
ERR.REARM which re-arms the Error Handler. Any faults or errors that occur
after this point will cause the program to jump back to the start of ERR.HDLR.
page 22
GN3-ERRb
Summary of Contents for MotionBASIC
Page 3: ...ii...
Page 5: ...MotionBASICTM Error Handler Table of Contents A3 Complete Program Listings 31 iv...
Page 6: ...v...
Page 8: ...vii...
Page 10: ...MotionBASICTM Error Handler Welcome THIS PAGE INTENTIONALLY LEFT BLANK page 2 GN3 ERRb...
Page 37: ...MotionBASICTM Error Handler Appendix A1 GN3 ERRb page 29...
Page 38: ...MotionBASICTM Error Handler Appendix A1 THIS PAGE INTENTIONALLY LEFT BLANK page 30 GN3 ERRb...
Page 40: ...MotionBASICTM Error Handler Appendix A2 THIS PAGE INTENTIONALLY LEFT BLANK page 32 GN3 ERRb...