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

Page 97

Advertising
background image

Publication 1746-PM001A-US-P

Translating Your Program 8-3

get_time (d1,m1,y1)

{setup for operator #1}

goto acknowledge

{$L op2setup}

get_time (d2,m2,y2)

{setup for operator #2}

{$L acknowledge}

cls ( )

cursor_down(11)

print_time ( )

print “Operator #”,op-48.” acknowledged”

end

If no syntax errors are encountered during the translation, the translator creates a
native BASIC program (with the .BAS extension) ready for downloading to the
module:

Figure 8.2 Second Program, After Translation (SECOND.BAS)

0

REM . . .

10

REM SECOND PROGRAM

20

P. CHR(27),”[40M”,

30

P. CHR(27),”[1M”,

40

P. CHR(27),”[33M”,

50

P. CHR(27),”[2J”,

60

P.

70

P. TAB(10),”

80

P. TAB(10),”

WARNING

90

P. TAB(10),”

Use of this machine is restricted

100

P. TAB(10),”

110

P.

120

P. “Hit any key to continue . . .”,

130

If (EOF) THEN GOTO 130

140

PUSH A

150

A=GET

160

POP A

170

P.

180

P. CHR(27),”[2J”,

190

P. “Enter your Operator Number”

200

IF (EOF) THEN GOTO 200

210

OP=GET

220

IF OP=49 THEN GOTO 270

230

IF OP=50 THEN GOTO 320

240

P. CHR(27), “[2J”,

250

P. “Invalid Entry . .

Operator number not recognized”

260

GOTO 190

270

CALL 46

280

POP D1

290

POP M1

300

POP Y1

310

GOTO 360

320

CALL 46

330

POP D2

340

POP M2

350

POP Y2

360

P. CHR(27),”[2J”,

370

P. CHR(27),”[11B”,

380

PUSH A

Advertising