IP2022 Users ManualInstruction Set Architecture
www.ubicom.com
197
Example:
org 0
;set address to 0x000
...
;ISR code goes here
reti #0x4 ;return from interrupt
This is an example of an interrupt service routine.
When an interrupt occurs, the CPU registers are
saved into a set of shadow registers. The
program then jumps to the interrupt service
routine, which starts at a default address of 0x000
(software can change this address by loading a
new interrupt vector into the INTVECH and
INTVECL register pair). The interrupt service
routine should determine the cause of the
interrupt, clear the interrupt flag bit for the event
that raised the interrupt, perform any required
service for that event, and end with the reti
instruction.
The reti instruction restores the contents of the
program counter from the shadow registers. This
causes the IP2022 to continue program execution
from the point at which the program was
interrupted.
In this example, the immediate operand specifies
restoration of the pre-interrupt speed, but no
modification is made to the interrupt vector or the
T0TMR register.