background image

MotionBASIC

TM

Error Handler

Source Code Overview

Chapter 6
Source Code
Overview

6. Source Code Overview

The source code for all MBTools Modules is written to conform with ORMEC
standards for MotionBASIC

TM

software, these standards are:

1.

All labels within a modules start with a character sequence identifying
the module to which they belong, i.e. ERR.MENU, ERR.FLTS, etc.

2.

All application specific subroutines that include code that you must
modify or create in order to use a module are prefixed with APPL. For
example: APPL.ESTOP and APPL.RESTART.

3.

The optional 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 used wherever possible.

6.

A .TMP suffix is used for temporary variables that are only required
within a single subroutine.

7.

Flags are set TRUE or FALSE, I/O points are set ON or OFF. This is
preferred over setting them to 1, 0 or -1.

8.

Conditional statements are always written using the block IF-THEN-
ELSEIF-ENDIF format, except where the in-line IF-THEN-ELSE format
adds clarity.

9.

Only one statement on each line, except where multi-statement lines
using a colon separator

add to clarity.

10.

GOTO is only used when no other alternative will work.

GN3-ERRb

page 19

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: