beautypg.com

ProSoft Technology MVI56-BAS User Manual

Page 65

background image

MVI56-BAS ♦ ControlLogix Platform

Using the Program Port (PRT1)

BASIC Module (DB/BAS Compatible)

User Manual

ProSoft Technology, Inc.

Page 65 of 234

December 13, 2011

5.10 Debugging a BASIC Program

This section describes the BASIC commands that help the user debug BASIC

code.
The

BRKPNT

command sets a program break point at the specified line. This

means that the BASIC program exits, allowing the user to check all variables.
Enter

BRKPNT

before running a program in order to enable the break point

command.
To continue program execution, use the

CONT

command.

Syntax:

BRKPNT [line number]

If the line number selected is zero, the

BRKPNT

command will be disabled.

The

SNGLSTP

command allows the program to exit at all lines. The program will

stop first at the initial line number defined in the

SNGLSTP

command.

To continue program execution, use the

CONT

command.

Syntax:

SNGLSTP [initial line number]

Error Recovery
Use the

ONERR

command to recover from an error during program execution.

When an error occurs the program execution will skip to the line specified by the

ONERR

command. Each error has an associated code which can be retrieved by

using the

ERRCODE

operator or the

XBY

function.

Definition of error codes generated with the

ONERR

command:

1 Missing "=" sign.
2 Bad or missing expression.
3 NOT USED.
4 Variable name too long.
5 Expected a variable, but did not find one.
6 Exceeded maximum number of variables.
7 Missing ")".
8 Missing "(".
9 Bad variable element number.
10 NOT USED.
11 Argument stack error.
12 Bad or missing operator in expression.
13 Too many operators in expression.
14 ELSE token found without prior IF token.
15 Invalid syntax.
16 Missing variable after "LET" token.
17 Missing quote.
18 Statement not terminated correctly.
19 Bad or missing line number
20 No line to return to after GOSUB.
21 Tried executing RUN while already in RUN mode.