background image

MotionBASIC

TM

Error Handler

Modifying Your Program

ON ERROR GOTO YOUR.LABEL

Will disarm the MBTools error handler
and arm a new error handler routine
identified by the label "YOUR.LABEL".

ON ERROR GOTO 0

Will disable error handling completely.
Any subsequent faults or errors will
stop the program.

5.4 Application Specific Error Traps

Your application may have specific errors or faults that you want to handle
outside the MBTools error handler. Typically, these would be faults that are not
critical and you would want to warn the operator and present a choice of
aborting the operation or continuing.

To trap an application specific error you must create a subroutine using the
label APPL.ERR.TRAP: This subroutine is called by the ERR.HDLR routine
unless the error is a range error in data input statement and MENU.BAS is
present.

NOTE......

The Error Handler module will always call the APPL.ERR.TRAP subroutine
whenever a fault or error occurs. If your application does not need any
application specific error trapping, you must add the following line to your
program:

APPL.ERR.TRAP: :RETURN

When your application does need application specific error trapping, the
APPL.ERR.TRAP should do the following:

1.

Test ERR, FAULT@, etc. to determine if the error is one that needs
special handling.

2.

If it is an error you want to trap, take what ever action is needed to
handle the error.

3.

If you want to continue execution of the program, set the variable
RESUME.FLAG=TRUE.

4.

If the error is not one that needs special handling, or if you want the
error handler to shut the machine down, leave the variable
RESUME.FLAG=FALSE.

5.

Return to the error handler using a RETURN statement.

NOTE......

The error handler always sets RESUME.FLAG=FALSE before calling your
APPL.ERR.TRAP subroutine.

Figure 4 shows an example for an application specific error trapping subroutine.
The example traps the occurrence of a software overtravel limit fault while
manually jogging the machine.

GN3-ERRb

page 15

Содержание MotionBASIC

Страница 1: ...MotionBASICTM TM TM Tools Tools Tools Error Handler Software Module Software Manual GN3 ERRb Copyright c 1990 Ormec Systems Corporation All Rights Reserved 19 Linden Park Rochester NY 14625 716 385 3...

Страница 2: ...ORMEC extends no warranty with respect to the merchantability or fitness for any particular purpose for this software It is the customer s responsibility to determine whether it is suitable for the s...

Страница 3: ...ii...

Страница 4: ...3 Initializing The Module 14 5 4 Application Specific Error Traps 15 5 5 Application Specific Shutdown Procedures 16 5 6 Restart After Fault Procedures 16 5 7 Invoking The Fault Menu 17 5 8 Invoking...

Страница 5: ...MotionBASICTM Error Handler Table of Contents A3 Complete Program Listings 31 iv...

Страница 6: ...v...

Страница 7: ...t Menu Screen 4 Figure 2 ERR DATA Configuration Data 6 Figure 3 MBTOOLS BAS Include File 9 Figure 4 Application Specific Error Handling 16 Figure 5 Recomended Power Up Sequence 17 Figure 6 Response to...

Страница 8: ...vii...

Страница 9: ...r 2 Description tells you what the Error Handler Software Module does and how to operate it Chapter 3 Configuring the Module tells you how to configure the Error Handler for your application Chapter 4...

Страница 10: ...MotionBASICTM Error Handler Welcome THIS PAGE INTENTIONALLY LEFT BLANK page 2 GN3 ERRb...

Страница 11: ...that you can easily modify it to form part of a larger application program It requires approximately 6 000 bytes of program memory The configuration information for ERRMENU is contained in a single b...

Страница 12: ...no controller faults program errors or axis faults If the faults cannot be cleared the screen will show those faults errors etc that remain 2 3 Restarting The Machine When you press the ESCAPE key th...

Страница 13: ...th the Error Handler Module This chapter describes how to do step one 3 1 The Configuration Process There are two things that need to be configured for the Error Handler You need to tell the Error Han...

Страница 14: ...u can set the required axes to any combination of eight axes using axis numbers from 1 to 32 NOTE Both the quotation marks and the curly braces are required The remaining DATA statements set the names...

Страница 15: ...le amount of memory If you need to refer to the information that is in the comment load the MBTOOLS HYP file into the Hypertext On Line Help system The information will be displayed if you press ALT w...

Страница 16: ...MotionBASICTM Error Handler Configuring The Module THIS PAGE INTENTIONALLY LEFT BLANK page 8 GN3 ERRb...

Страница 17: ...s Setup Area 3 Third you modify your program to work with the Error Handler Module This chapter describes how to do step two 4 1 Include Files The best way to merge MBTools modules with your program i...

Страница 18: ...module The example then goes on to load ERRMENU BAS at line 41000 using the same line number increment and checking for a maximum line number of 41999 Similarly MENU BAS and MISC BAS are loaded at li...

Страница 19: ...menu to turn file line numbers off Then type MERGE MBTOOLS BAS After the modules have been merged into your program you should use the F8 function key to disable the Setup Area and proceed to the nex...

Страница 20: ...MotionBASICTM Error Handler Loading The Module THIS PAGE INTENTIONALLY LEFT BLANK page 12 GN3 ERRb...

Страница 21: ...e Error Handler Module This chapter describes how to do step three 5 1 Steps Required To Modify Your Program Modifying your program is a four step process 1 You must check for and resolve conflicts in...

Страница 22: ...hat must be executed before the module is first invoked For ERRMENU BAS these subroutines set up the screen color variables set up logical names for testing keys pressed by the operator initialize the...

Страница 23: ...he APPL ERR TRAP subroutine whenever a fault or error occurs If your application does not need any application specific error trapping you must add the following line to your program APPL ERR TRAP RET...

Страница 24: ...fic Shutdown Procedures Your application may have to follow a specific sequence to safely execute an emergency stop To include such a sequence you must add a subroutine using the label APPL ESTOP This...

Страница 25: ...n 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 ERRO...

Страница 26: ...MotionBASICTM Error Handler Modifying Your Program THIS PAGE INTENTIONALLY LEFT BLANK page 18 GN3 ERRb...

Страница 27: ...onal GOSUB statement is always included for example GOSUB ERR CODES rather than just ERR CODES 4 The same names are not used for variables and program labels 5 The default variable type integer is use...

Страница 28: ...execution of the program Therefore only one error can exist at a time If a second error occurs before the first is cleared MotionBASICTM will reset the ERR function to report only the most recent err...

Страница 29: ...ROR OCCURS ERR HLDR ERR ESTOP SUBROUTINE ROUTINE APPL ESTOP DISPLAY CHECK DATA RANGE LIMITS ENTRY RANGE APPLICATION THEN RESUME ERRORS SPECIFIC ESTOP SEQUENCE NOT A DATA ENTRY ERROR RESUME ERROR APPL...

Страница 30: ...n 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 FAUL...

Страница 31: ...res string messages that describe controller faults AXNAM 8 Stores user defined names for each of the axes AFLT 7 Used as temporary for the status eight possible axis fault conditions BINARY 8 Stores...

Страница 32: ...is the Fault Display Screen It is called by ERR ESTOP or directly by the application program It prints the initial backdrop for the Fault Display Screen and then enters a WHILE WEND loop which loops...

Страница 33: ...which includes a list of all possible axis faults It then loops through all installed axes printing the axis name and calling ERR AFLT and ERR APRN Within the loop it tests MY FAULT to determine wheth...

Страница 34: ...Handler Source Code Overview numeric status values for the first three items and OK BAD message for the rest ERR MENUBAR Subroutine ERR MENUBAR prints text which describes the available operator actio...

Страница 35: ...MotionBASICTM Error Handler Source Code Overview THIS PAGE INTENTIONALLY LEFT BLANK GN3 ERRb page 27...

Страница 36: ...WN RESUME FLAG A LEFT ENTER RIGHT A RIGHT ERR LEN SCRN TYPE A UP ESC SELECT ACTIVE FAULT SELECT BG ACTIVE BG FLAG SELECTED AFLT FLT TMP SELECTED BG ALARM INACTIVE TITLE MSG ALARM BG LEFT TMP AXES MY E...

Страница 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...

Страница 39: ...Program Labels Used APPL ERR TRAP ERR DATA ERR REARM APPL ESTOP ERR ESTOP MISC CLR5 APPL RESTART ERR FLTS MISC COLORS ERR AFLT ERR HDLR MISC KEYS ERR APRN ERR INIT MISC TITLE ERR AXIS ERR MENU ERR CO...

Страница 40: ...MotionBASICTM Error Handler Appendix A2 THIS PAGE INTENTIONALLY LEFT BLANK page 32 GN3 ERRb...

Страница 41: ...MotionBASICTM Error Handler Appendix A3 Appendix A3 Complete Program Listings A3 Complete Program Listings GN3 ERRb page 33...

Отзывы: