Rockwell Automation 1747-PBASE BASIC Development Software Programming Manual User Manual

Page 96

Advertising
background image

Publication 1746-PM001A-US-P

8-2 Translating Your Program

The software checks the extension of the file in the active edit window and prompts
you to select a translator/compiler.

The file in the active edit window is always saved prior to translating. Other open,
altered files may be saved if the translator is configured to save all files as discussed
in the last section of this chapter.

Once selected, the translator/compiler translates the source code you have written
in the BASIC Development Language into BASIC. The translator:

removes comments

adds BASIC line numbers

replaces labels with line numbers

brings in include files

expands programming macros

checks for syntax errors

For example, the translator will accomplish these tasks in the following program:

Figure 8.1 Second Program, Before Translation (SECOND.BDL)

REM SECOND PROGRAM

{will print screen below, then check operator number}

{$I Include.bdl}

{screen setup}

background_Black( )

High_Intensity ( )

foreground_Yellow ( )

cls ( )

{print statements}

print

P.tab(10),”

P.tab(10),”WARNING

P.tab(10),”Use of this machine is restricted“

P.tab(10),”

hit_any_key( )

{pause and wait for keystroke}

cls ( )

{$L loop1}

Print “Enter your Operator Number”

{pause and wait for input}

get_key (op)

{check for input of 49 or 50 which are ASCII decimal for 1 or 2}

if op=49 then goto op1setup

if op=50 then goto op2setup

{print error and loop back for another entry}

cls ( )

print “Invalid Entry . . Operator number not recognized”

goto loop1

{$L op1setup}

IMPORTANT

The 1747-PBASE Translator expects your filename to have a
.BDL extension. If it does not, you get an error.

Advertising