Reti, Return, Reti -18 return -18 – Rockwell Automation 1746-BAS BASIC LANGUAGE User Manual

Page 114: Purpose, Syntax, Example

Advertising
background image

Publication 1746-RM001A-US-P

8-18 Execution Control and Interrupt Support Functions

RETI

Purpose

Use the RETI statement to exit from an interrupt (ONTIME, CALL 16, or CALL
20) that is processed in a module program. The RETI statement functions the
same as the RETURN statement except that it also clears a software interrupt flag
so interrupts can again be acknowledged. If you fail to execute the RETI statement
in the interrupt procedure, all future interrupts are ignored.

Syntax

RETI

Example

>1

REM EXAMPLE PROGRAM

>10

TIME=0 : CLOCK1 : ONTIME 2, 100 : DO

>20

WHILE TIME<10 : END

>100 PRINT “TIMER INTERRUPT AT –”, TIME,“ SECONDS”

>110 ONTIME TIME+2, 100 : RETI

>RUN

TIMER INTERRUPT AT – 2.045 SECONDS

TIMER INTERRUPT AT – 4.045 SECONDS

TIMER INTERRUPT AT – 6.045 SECONDS

TIMER INTERRUPT AT – 8.045 SECONDS

TIMER INTERRUPT AT – 10.045 SECONDS

READY

RETURN

Purpose

Use the RETURN statement to return control to the statement following the most
recently executed GOSUB STATEMENT. Use one return for each GOSUB to
avoid overflowing the control stack. This means that a subroutine called by the
GOSUB statement can call another subroutine with another GOSUB statement.

Syntax

RETURN

Advertising