MotionBASIC
TM
Error Handler
Modifying Your Program
routine that will put the machine back into a condition in which it can be safely
restarted. APPL.RESTART can be a special routine or simply a label in your
normal program power-up initialization code.
Before executing the GOTO APPL.RESTART statement, the error handler
executes a STACK CLEAR statement. This clears the control stack of any
subroutine RETURNs, WHILE/WEND loops and FOR/NEXT loops. Without this
statement each time an error occured any open RETURNS or loops would be
left on the stack and your program would eventually run out of memory. This
means that the APPL.RESTART label must be placed in a location in the
program where no subroutines, WHILE/WEND loops or FOR/NEXT loops are
open. Figure 5 shows the recommended location for the APPL.RESTART
label.
Figure 5, Recomended Power-Up Sequence
POWERUP:
.
.
in-line initialization code
.
GOSUB MISC.COLORS
GOSUB ERR.INIT
.
.
other MBTools initialization subroutine calls
.
ON ERROR GOTO ERR.HDLR
APPL.RESTART:
GOSUB MAIN
END
The APPL.RESTART label is located immediately after the
ON ERROR GOTO ERR.HDLR statement. If there were statements between
these two lines, a run-time error while executing one of them could cause the
remaining statements to be skipped with unpredictable results.
5.7 Invoking The Fault Menu
After completing the error trapping and shutdown routines, the Error Handler
module will automatically invoke the Fault Display Menu. If you want to call the
Fault Display when no fault has occurred, include a GOSUB ERR.MENU
statement at the appropriate point in your program. When the operator leaves
the Fault Display, the program will return to the next statement in your program.
5.8 Invoking From MENU.BAS
If you are using the MBTools MENU.BAS MMI Module to provide your man
machine interface, you can use MENU.BAS to call the Fault Menu Display
Menu. Details on how to configure MENU.BAS to do this are included in the
manual for MENU.BAS.
GN3-ERRb
page 17
Содержание MotionBASIC
Страница 3: ...ii...
Страница 5: ...MotionBASICTM Error Handler Table of Contents A3 Complete Program Listings 31 iv...
Страница 6: ...v...
Страница 8: ...vii...
Страница 10: ...MotionBASICTM Error Handler Welcome THIS PAGE INTENTIONALLY LEFT BLANK page 2 GN3 ERRb...
Страница 16: ...MotionBASICTM Error Handler Configuring The Module THIS PAGE INTENTIONALLY LEFT BLANK page 8 GN3 ERRb...
Страница 20: ...MotionBASICTM Error Handler Loading The Module THIS PAGE INTENTIONALLY LEFT BLANK page 12 GN3 ERRb...
Страница 26: ...MotionBASICTM Error Handler Modifying Your Program THIS PAGE INTENTIONALLY LEFT BLANK page 18 GN3 ERRb...
Страница 35: ...MotionBASICTM Error Handler Source Code Overview THIS PAGE INTENTIONALLY LEFT BLANK GN3 ERRb page 27...
Страница 37: ...MotionBASICTM Error Handler Appendix A1 GN3 ERRb page 29...
Страница 38: ...MotionBASICTM Error Handler Appendix A1 THIS PAGE INTENTIONALLY LEFT BLANK page 30 GN3 ERRb...
Страница 40: ...MotionBASICTM Error Handler Appendix A2 THIS PAGE INTENTIONALLY LEFT BLANK page 32 GN3 ERRb...