beautypg.com

Goto, Idle, Goto idle – Rockwell Automation 1771-DB BASIC MODULE User Manual

Page 166

background image

Chapter
Statements

11

11 -14

Use the GOTO statement to cause BASIC to transfer control to the line
number you specify. If line number you specify does not exist, the
message

ERROR: INVALID LINE NUMBER

is printed to the console device

and the BASIC module enters the Command mode.

Unlike the RUN command (page 10 -19), if you execute the GOTO
statement in the Command mode it does not clear the variable storage
space or interrupts. However, if you execute the GOTO statement is in the
Command mode after you edit a line, the module clears the variable
storage space and all BASIC evoked interrupts.

Syntax

GOTO

ln num

Example

>1 REM EXAMPLE PROGRAM

>50 GOTO 100

If line 100 exists, this statement causes execution of program to resume at
line 100.

Use the IDLE statement to force the BASIC module to wait until an
interrupt occurs (i.e., ONTIME, ONERR, etc.). Program execution halts
until an ONTIME condition is met. The ONTIME (page 11 -25) interrupt
must be enabled before executing the IDLE command or else the BASIC

module enters a wait forever mode.

Ctrl

+

C

(page 10 -4) exits the

IDLE command if

Ctrl

+

C

is enabled. (See CALL 18, page 12 -11).

Important: Do not use IDLE while executing background calls (page
7 -6). Background calls do not execute properly if IDLE is running.

Syntax

IDLE

Example

>10 TIME = 0

>20 CLOCK1

>30 ONTIME 2,70

>40 IDLE

>50 PRINT “END OF TEST!!!”

>60 END

>70 PRINT “TIMER INTERRUPT AT - ”,TIME,“SECONDS.”

>80 RETI

READY

>RUN

TIMER INTERRUPT AT - 2.005 SECONDS.

END OF TEST!!!

GOTO

IDLE