Table of Contents

Advertisement

17.2.4 Interrupts
A Timer B interrupt can be generated whenever the counter equals one of the match registers by enabling
the appropriate bit in TBCSR. The interrupt request is cleared when TBCSR is read.
17.3 Operation
The following steps explain how to set up a Timer B countdown timer.
1. Select perclk/2, perclk/16, Timer A1, or Timer A11 in TBCR.
2. Use TBCR to select whether countdown Timers B1–B2 operate normally with the match registers or
whether they use the step registers to calculate match values.
3. Enable Timer B by writing a 1 to bit 0 of TBCSR.
17.3.1 Handling Interrupts
The following steps explain how an interrupt is set up and used.
1. Write the vector to the interrupt service routine to the internal interrupt table.
2. Configure TBCSR to select which match register will generate an interrupt.
3. Configure TBCR to select the interrupt priority (note that interrupts will be enabled once this value
is set; this step should be done last).
The interrupt request is cleared by reading from TBCSR.

17.3.2 Example ISR

A sample interrupt handler is shown below.
timerB_isr::
push af
ioi ld a, (TBCSR)
; handle all interrupts flagged in TBCSR here
; reload match register(s) if necessary
pop af
ipres
ret
Rabbit 6000 User's Manual
; save used registers
; clear the interrupt request and get status
; restore used registers
digi.com
172

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the 6000 and is the answer not in the manual?

Table of Contents