Brkpnt, Syntax, Example – Rockwell Automation 1771-DB BASIC MODULE User Manual

Page 132

Advertising
background image

Chapter
Commands

10

10 -2

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 using 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.

Syntax

BRKPNT

line number

Return

Example

>10 D=0 : SU=0 : AV=0

>20 REM GET 100 DATUM POINTS

>30 FOR I=1 TO 100

>40 REM GET ANOTHER DATUM

>50 GOSUB 140

>60 REM SUM THE DATA

>70 GOSUB 170

>80 NEXT I

>90 REM AVERAGE THE DATA

>100 GOSUB 200

>110 REM PRINT RESULT

>120 PRINT “THE AVERAGE VALUE IS ”,AV

>130 END

>140 REM THIS SUBROUTINE GENERATES RANDOM DATA

>150 D=RND

>160 RETURN

>170 REM THIS SUBROUTINE SUMS THE DATA

>180 SU=SU+D

>190 RETURN

>200 REM THIS SUBROUTINE AVERAGES THE DATA

>210 AV=SU/I

>220 RETURN

READY

>BRKPNT 160

Breakpoint enabled.

READY

>RUN

STOP – IN LINE 160

READY

BRKPNT

Advertising