Brkpnt, Brkpnt -2, Purpose – Rockwell Automation 1746-BAS BASIC LANGUAGE User Manual

Page 42: Syntax, Example

Advertising
background image

Publication 1746-RM001A-US-P

4-2 BASIC Commands

BRKPNT

Purpose

Use the BRKPNT command to set a program break point at the line number
specified by this command. Program execution stops just before the line number
specified by the BRKPNT command. If the line number is zero, the break point is
disabled. After the break point is reached, you can examine variables by using
assignment statements. Continue from the break point by using the CONT
command. 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[ln num]

Example

>1

REM EXAMPLE PROGRAM

>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

Advertising