09.12.2012 Views

Basic Characteristics RAPID

Basic Characteristics RAPID

Basic Characteristics RAPID

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

errnum Error number<br />

Description<br />

Examples<br />

Errnum is used to describe all recoverable (non fatal) errors that occur during program<br />

execution, such as division by zero.<br />

If the robot detects an error during program execution, this can be dealt with in the error<br />

handler of the routine. Examples of such errors are values that are too high and division<br />

by zero. The system variable ERRNO, of type errnum, is thus assigned<br />

different values depending on the nature of an error. The error handler may be able to<br />

correct an error by reading this variable and then program execution can continue in<br />

the correct way.<br />

An error can also be created from within the program using the RAISE instruction.<br />

This particular type of error can be detected in the error handler by specifying an error<br />

number as an argument to RAISE.<br />

reg1 := reg2 / reg3;<br />

.<br />

ERROR<br />

IF ERRNO = ERR_DIVZERO THEN<br />

reg3 := 1;<br />

RETRY;<br />

ENDIF<br />

If reg3 = 0, the robot detects an error when division is taking place. This error,<br />

however, can be detected and corrected by assigning reg3 the value 1. Following<br />

this, the division can be performed again and program execution can continue.<br />

CONST errnum machine_error := 1;<br />

.<br />

IF di1=0 RAISE machine_error;<br />

.<br />

ERROR<br />

IF ERRNO=machine_error RAISE;<br />

An error occurs in a machine (detected by means of the input signal di1). A jump<br />

is made to the error handler in the routine which, in turn, calls the error handler<br />

of the calling routine where the error may possibly be corrected. The constant,<br />

machine_error, is used to let the error handler know exactly what type of error<br />

has occurred.<br />

<strong>RAPID</strong> Reference Manual 7-errnum-1

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!