beautypg.com

Remote Processing RPC-210 User Manual

Page 42

background image

EXTERNAL INTERRUPTS

SECTION 9

Page 9-2

Line 10 sets up the operating system to process interrupt
0. Lines 20 and 30 increm ent a counter used by the
interrupt subroutine. W hen INT 0 goes low, code
starting at line 500 is executed as soon as the current
RPBASIC-52 statement is finished (usually in 1 mSec).

RETI is necessary to allow other interrupts. However,
if INT 0 remains low, the interrupt program will be re-
executed sta rting at line 50 0 as soon as R ETI is
executed. To pr event this, try to reset the cause of the
interr upt. If this is not possible, then execute

550 ONITR 0

This will disable INT0. Y ou can monitor this line by
tying it to a free input at J3 and use ON LIN E to detect
when it is high again.

Interrupt Priority
I N T 0 i s s e co n d o n ly to O N T IC K I f a n ON T I C K
progr am is exec uting, an ON ITR r outine is delayed until
ONT ICK is finished. ONIT R cannot be interrupt by any
other multi-tasking routine such as ON COM$, ON
LINE, etc.

APPLICATION PROGRAMS

Interrupts are part of the CP U process. For setup
example, review any of the programs below.

F i le n am e

Description

COUNT1.BAS

Quadrature encoder input. Counter
program generates INT 0 on 0
crossing.

COUNT2.BAS

Quadrature encoder input. Counter
program generates INT 0 when
preload count matches current
count.

COUNT3.BAS

Pulse input. Interrupt when count
goes through 0.

RTC-5.BAS

Interrupt at preset hour, m inute,
and/or second.