![Rabbit Rabbit 4000 User Manual Download Page 127](http://html1.mh-extra.com/html/rabbit/rabbit-4000/rabbit-4000_user-manual_3116714127.webp)
117
14.3 Operation
The following steps explain how to set up a Timer B countdown timer.
1. Select perclk/2, perclk/16, or countdown timer A1 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.
14.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 registers 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.
14.3.2 Example ISR
A sample interrupt handler is shown below.
timerB_isr::
push af ; save used registers
ioi ld a, (TBCSR) ; clear the interrupt request and get status
; handle all interrupts flagged in TBCSR here
; reload match register(s) if necessary
pop af ; restore used registers
ipres
ret
Summary of Contents for Rabbit 4000
Page 1: ...Rabbit 4000 Microprocessor User s Manual 019 0152 070720 H...
Page 18: ...8 Rabbit 4000 Microprocessor User s Manual...
Page 40: ...30 Rabbit 4000 Microprocessor User s Manual...
Page 74: ...64 Rabbit 4000 Microprocessor User s Manual...
Page 82: ...72 Rabbit 4000 Microprocessor User s Manual...
Page 86: ...76 Rabbit 4000 Microprocessor User s Manual...
Page 96: ...86 Rabbit 4000 Microprocessor User s Manual...
Page 182: ...172 Rabbit 4000 Microprocessor User s Manual...
Page 240: ...230 Rabbit 4000 Microprocessor User s Manual...
Page 248: ...238 Rabbit 4000 Microprocessor User s Manual...
Page 256: ...246 Rabbit 4000 Microprocessor User s Manual...
Page 310: ...300 Rabbit 4000 Microprocessor User s Manual...
Page 330: ...320 Rabbit 4000 Microprocessor User s Manual...
Page 348: ...338 Rabbit 4000 Microprocessor User s Manual...