
Semtech 2006
www.semtech.com
8-6
XE8802 Sensing Machine Data Acquisition MCU
with ZoomingADC and LCD driver
First of all, the jump addresses are defined at the beginning of the crt0.s file. In our case, all three interrupt levels
jump to the same place (defined by the _interrupt label), but this can be changed if required.
########################################################################
## Reset & interrupt vectors
########################################################################
_start:
jump
main_init
; reset
jump
_interrupt
; IN1
jump
_interrupt
; IN2
jump
_interrupt
; IN0
The first thing to do when an interrupt is activated is to save the context. You have to start with saving the contents
of the accumulator, then the flags and finally the internal CPU registers. You will find this part of the code in the
IRQComon_xx.s file.
_interrupt:
########################################################################
## Save all registers and flags
########################################################################
move
-(i3), a
move
a, r0
sflag
move
-(i3), a
move
-(i3), ipl
move
-(i3), iph
move
-(i3), i0l
move
-(i3), i0h
move
-(i3), i1l
move
-(i3), i1h
move
-(i3), i2l
move
-(i3), i2h
move
-(i3), r0
move
-(i3), r1
move
-(i3), r2
move
-(i3), r3
Next step is to determine which interrupt is activated. In this case, we use the value in the RegIrqPriority register
to determine the highest priority interrupt that was activated. Other ways can be used, especially when the priority
order fixed in the hardware needs to be changed. You will find this part of the code in the IRQComon_xx.s file. In
this example, the labels are used as defined for the XE8802.
########################################################################
## The following lines enables the adress calculation of the interrupt
## table. Where RegIrqPriority is the addres offset for the table.
## The RegIrqPriority valid values are between 0x00 until 0x017. The
## 0xFF value should never exist.
########################################################################
move
r0,RegIrqPriority
calls _interrupttab
; save pc+1 in ip
_interrupttab:
add
ipl,#0x05
; add the offset, nb instr. before table
addc
iph,#0x00
; propagate carry
add
ipl,r0
; add the offset of the regirqpriority
addc
iph,#0x00
; propagate carry
rets
; put ip in pc
; interrupt table
jump
ret_int
;
RegIrqPriority = 0x00
jump
ret_int
;
RegIrqPriority = 0x01
jump
Irq_Pa2
;
RegIrqPriority = 0x02
jump
Irq_Pa3
;
RegIrqPriority = 0x03
jump
Irq_CntD
;
RegIrqPriority = 0x04
jump
Irq_CntB
;
RegIrqPriority = 0x05
jump
Irq_Pa6
;
RegIrqPriority = 0x06
jump
Irq_Pa7
;
RegIrqPriority = 0x07
jump
Irq_Pa0
;
RegIrqPriority = 0x08
Not
Recommended
for
New
Designs