background image

MotionBASIC

TM

Error Handler

Modifying Your Program

5.2 Resolving Conflicts

Appendices A1 and A2 provide a list of variables and program labels used by
ERRMENU.BAS. Review these lists and compare them with your program.
Resolve any conflicts by renaming the variable or changing the label in your
program.

NOTE......

We recommend changing the variable name or label in your program rather
than in the MBTools Module. The assumption is that you understand the
implication of making changes to your program in more detail than in the
MBTools Module. By only changing your program you will be less likely to
introduce problems than if you were to change the MBTools Module.

If you have not written your program, you simply need to keep the variables
and program labels used by MBTools in mind as you write it.

NOTE......

To make it easy to avoid program label conflicts, all labels used in MBTools
Modules begin with a prefix that identifies the module to which they belong.
For example, all labels used in ERRMENU.BAS begin with ERR.

5.3 Initializing The Module

Each Module has a number of subroutines that 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 module and arm the error handler.

Your program should include the following statements as part of its power up
initialization:

GOSUB MISC.COLORS
GOSUB MISC.KEYS
GOSUB ERR.INIT
ON ERROR GOTO ERR.HDLR

If you are using other modules in addition to ERRMENU.BAS, they also will
have initialization subroutines that must be executed. It is a good idea to keep
all of these GOSUBs together in your program. Figure 5 provides additional
recommendations for the power up initialization sequence.

NOTE......

If more than one of the modules you are using requires that you execute a
particular initialization subroutine, MISC.COLORS for example, you only have to
execute it once. You do not need to execute it again for each module that
needs it.

The "ON ERROR GOTO ERR.HDLR" statement arms the error handler. Any
faults or errors that occur after this statement will cause the program to jump to
the ERR.HLDR program label. This statement should be placed after the other
initialization statements.

You can disarm the error handler by executing another "ON ERROR GOTO"
statement. For example:

page 14

GN3-ERRb

Summary of Contents for MotionBASIC

Page 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...

Page 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...

Page 3: ...ii...

Page 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...

Page 5: ...MotionBASICTM Error Handler Table of Contents A3 Complete Program Listings 31 iv...

Page 6: ...v...

Page 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...

Page 8: ...vii...

Page 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...

Page 10: ...MotionBASICTM Error Handler Welcome THIS PAGE INTENTIONALLY LEFT BLANK page 2 GN3 ERRb...

Page 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...

Page 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...

Page 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...

Page 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...

Page 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...

Page 16: ...MotionBASICTM Error Handler Configuring The Module THIS PAGE INTENTIONALLY LEFT BLANK page 8 GN3 ERRb...

Page 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...

Page 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...

Page 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...

Page 20: ...MotionBASICTM Error Handler Loading The Module THIS PAGE INTENTIONALLY LEFT BLANK page 12 GN3 ERRb...

Page 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...

Page 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...

Page 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...

Page 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...

Page 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...

Page 26: ...MotionBASICTM Error Handler Modifying Your Program THIS PAGE INTENTIONALLY LEFT BLANK page 18 GN3 ERRb...

Page 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...

Page 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...

Page 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...

Page 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...

Page 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...

Page 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...

Page 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...

Page 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...

Page 35: ...MotionBASICTM Error Handler Source Code Overview THIS PAGE INTENTIONALLY LEFT BLANK GN3 ERRb page 27...

Page 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...

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 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...

Page 40: ...MotionBASICTM Error Handler Appendix A2 THIS PAGE INTENTIONALLY LEFT BLANK page 32 GN3 ERRb...

Page 41: ...MotionBASICTM Error Handler Appendix A3 Appendix A3 Complete Program Listings A3 Complete Program Listings GN3 ERRb page 33...

Reviews: