beautypg.com

Example – Rockwell Automation 1746-BAS BASIC LANGUAGE User Manual

Page 109

background image

Publication 1746-RM001A-US-P

Execution Control and Interrupt Support Functions 8-13

Example

>1

REM EXAMPLE PROGRAM

>10

ONERR 500

>20

FOR I = 5 TO 0 STEP -1

>30

PRINT 1/I

>40

NEXT I

>50

END

>500 PRINT “ERROR CODE WAS ”,XBY(257)

>510 END

READY

>RUN

.2

.25

.33333333

.5

1

ERROR CODE WAS 10

READY

>

A GOTO statement can replace the END statement in this example to provide a
method of user programmed error recovery.