Debug a program, What’s next – Rockwell Automation 1771-DB BASIC MODULE User Manual

Page 90

Advertising
background image

Chapter
Editing and Debugging a BASIC Program

6

6 -4

The BRKPNT (page 10 -2) command and SNGLSTP command (page
10 -20), along with the STOP statement (page 11 -36) help you to debug
your program.

Set Break Points

Use the BRKPNT command to set a program break point at the line
number you specify with this command. Program execution stops just
before the line number you specified. If the line number is zero, the break
point is disabled. After the break point is reached, you can examine
variables by using PRINT statements. You can also modify the variables
by assignment statements. Continue from the break point by using the
CONT command (page 10 -3.) Once the break point is reached, it is
disabled. To stop at the same place twice, set the break point twice. The
BRKPNT command works only on programs executing from RAM. It
does not stop a program executing from ROM.

Initiate Single Step Execution

Use the SNGLSTP command to initiate single-step program execution.
If the number you specify with this command is zero, single-step execution
is disabled. If the number is not zero, a break point is set before each line
in the program. Start the program with the RUN command (page 10 -19).
After each stop, type CONT (page 10 -3) to execute the next line.
You can inspect variables or assign variables at each break point.
SNGLSTP works only on programs executing from RAM.
It does not stop a program executing from ROM.

Stop Program Execution at a Specific Point

Use the STOP statement to break program execution at specific points in a
program. After a program is stopped you can display or modify variables.
You can resume program execution with a CONT command (page 10 -3).

Note that the line number printed out after execution of the STOP
statement is the line number following the STOP statement, not the line
number that contains the STOP statement.

Using BASIC
Module
Statements

7

Debug a Program

What’s Next?

Advertising