Line number -6 increment -6, Line number, Increment – Rockwell Automation 1747-PBASE BASIC Development Software Programming Manual User Manual

Page 78

Advertising
background image

Publication 1746-PM001A-US-P

6-6 Writing Programs Using the BASIC Development Language

Line Number

The Line Number directive allows you to specify a starting line number to be used
by the translator when it assigns line numbers to each program line. The line
number can be any number between the values of 1 and 65535.

Line Number directives can be placed anywhere in the program. The line following
the directive begins with the new number.

Syntax:

{$N [linenumber]}

Example:
Before translation:

After translation:

REM LINE NUMBERING

0 REM ...

{$N 500}

10 REM LINE NUMBERING

IF A>C THEN GOTO GET_C_VALUE

500 IF A>C THEN GOTO 800

A=55

510 A=55

{$L GET_C_VALUE}

800 C=107

{$N 800}

C=107

Increment

The Increment directive allows you to specify a numeric value to be used as an
increment between line numbers. The translator uses this increment when it
assigns line numbers during translation. The number must be between the values
of 1 and 100.

This directive can be used throughout the program as often as needed. The line
number immediately following this directive is numbered according to the previous
increment. Any lines after that are numbered according to the new increment.

Syntax:

{$S [number]}

Example:
Before translation:

After translation:

REM INCREMENT LINES BY 5’S

0 REM ...

{$S 5}

10 REM INCREMENT LINES BY 5’S

IF A>C THEN GOTO GET_C_VALUE

20 IF A>C THEN GOTO 35

A=55

25 A=55

REM INCREMENT LINES BY 10’S

30 REM INCREMENT LINES By 10’S

{$S 10}

35 C=107

{$L GET_C_VALUE}

45 END

C=107

END

Advertising