Call 38: expanded onerr restart, Call 38: expanded onerr restart tip – Rockwell Automation 1771-DB BASIC MODULE User Manual

Page 226

Advertising
background image

Chapter
Call Routines 0–68

12

12 -36

Use CALL 38 to expand the type of errors the ONERR statement (page
11 -23) traps and handles.

The ONERR statement only allows the BASIC module to jump to an error
handling routine when it encounters an arithmetic error (number too large,
number too small, bad argument or division by zero occurs). All other
errors cause the module to enter Command mode. When you initiate
CALL 38, you allow ONERR to service other errors (except hardware
errors–watchdog, time-out, RAM failure, etc.) the BASIC module
encounters instead of returning to Command mode.

If any error occurs that causes a restart, stacks are cleared. Variables and
ports, however, are not re-initialized. This call has no effect until you
execute the ONERR statement within the program. This call is reset when
the BASIC module returns to the Command mode. You must re-execute
CALL 38 every time you enter Run mode.

Use CALL 0 (page 12 -2) if you want to reset the module within the error
routine.

Input and Output Arguments

This routine has one input and no output arguments. The input argument
determines if the expanded ONERR function is enabled or disabled:

0 = disable the expanded ONERR restart
1 (or any other number) = enable the expanded restart

If you perform an XBY in the error routine, this a list of the status codes
you might receive.

Status code

Description

01

BASIC module attempted to call an illegal call number

02

port has been assigned an invalid parameter

03

string has not been dimensioned

04

defined string length is too small for operation

05

memory has not been allocated for this string

06

attempted to transfer to a RAM or ROM program that did not exist

07

command or call can only be executed from Command mode

08

user PROM has invalid checksum

09

this statement or call requires a user PROM; no user PROM is installed

10

divide by zero

11

DH-485 call executed and DH485 port not enabled

12

argument stack problem

13

syntax error

14

control stack problem

15

array size problem

16

internal processor stack problem

CALL 38: Expanded ONERR
Restart

Tip

Advertising