Breakpoint -7 debug on debug off -7, Breakpoint, Debug on debug off – Rockwell Automation 1747-PBASE BASIC Development Software Programming Manual User Manual

Page 79

Advertising
background image

Publication 1746-PM001A-US-P

Writing Programs Using the BASIC Development Language 6-7

Breakpoint

The Breakpoint directive inserts a STOP statement into the program when it is
translated. The STOP statement is inserted only if the Debug directive is turned on
{$D+}. When downloaded to the module and executed, program execution halts
when the STOP is encountered. Entering the command CONT (for CONTinue)
resumes execution from where it stopped.

Breakpoints can be used as debugging aids or to allow you to display or modify
variables.

Syntax:

{$B}

Example:
Refer to the example for Debug.

Debug on
Debug off

When the Debug directive is programmed on {$D+}, STOP statements are inserted
at all the Breakpoints {$B} during program translation. {$D+} inserted anywhere in
the program turns Debug on until {$D–} is encountered. The default is for Debug
to be turned off {$D–}.

Syntax:

{$D+} to turn debug on

{$D–} to turn debug off

Example:
Before translation:

After translation:

REM

DEBUGGING

0 REM ...

{$B}

10 REM DEBUGGING

{$D+}

20 IF A>C THEN GOTO 50

IF A>C THEN GOTO GET_C_VALUE

30 STOP

{$B}

40 A=55

A=55

50 STOP

{$L GET_C_VALUE}

60 C=107

{$B}

C=107

In the preceding example, the first breakpoint is not translated to a STOP. This is
because Debug has not been turned on at that point.

IMPORTANT

The Debug directive is not related to the Terminal mode
debugger in any way. In fact, if you use the Terminal mode
debugger (described in Chapter 9), you should not use the Debug
directive or the Breakpoint directive. The Debug and Breakpoint
directives are useful for debugging programs from Terminal mode
without using the Terminal mode debugger.

Advertising