Creating a second program, Creating a second program -11, Entering the program -11 – Rockwell Automation 1747-PBASE BASIC Development Software Programming Manual User Manual

Page 83: Entering the program

Advertising
background image

Publication 1746-PM001A-US-P

Writing Programs Using the BASIC Development Language 6-11

Creating a Second
Program

In Chapter 2, you created a simple program. Following is a more complex program
to illustrate many of the programming features described. It includes using
programming macros, labels, and line-draw.

After you type in this BASIC development language program, translating,
downloading, and executing it on your BASIC or BASIC-T module is briefly
described.

Saving a file with a .BDL extension before you begin working on it causes the
attributes for that extension to be used while you edit. Features such as indent
style, tab spacing, right margin, word wrap, and language type are established for
you.

Entering the Program

1. Pull down the File menu.

2. Select

save file As.

The

SAVE FILE AS

dialog box appears on the screen.

3. Type:

SECOND.BDL

4. Press [Enter], or move the mouse cursor to

OK<ENTER>

and click the left mouse

button. The

SAVE FILE AS

dialog box disappears, and the message

C:\ABBASIC\BAS\SECOND.BDL Saved

appears in the message line.

5. Type the first two lines of the Second program:

REM SECOND PROGRAM

{will print screen below, then check operator number}

Note that they are comments because they are enclosed in

{ }

. Remember,

comments are not translated. If you want these lines in the translated BASIC
file, use

REM

instead of

{ }

. We have indented all comments in this example

by five spaces to make them stand out.

6. Type

{$I Include.bdl}

{$I Include.bdl}

is not a comment because the

{

is followed immediately

by a

$

.

$I

is the include translator directive requesting that a separate file

(

Include.bdl

in this case) be included during translation. Include.bdl is the

file available with the BASIC Development Software that contains
programming macros. As you become more familiar with the BASIC
Development Software, you may wish to create your own file,

mine.bdl

for

example, that contains your own programming macros. You could then
include it during translation by beginning your program with the command

{$I Mine.bdl}

.

Advertising