![Rabbit Rabbit 4000 User Manual Download Page 135](http://html1.mh-extra.com/html/rabbit/rabbit-4000/rabbit-4000_user-manual_3116714135.webp)
125
15.3 Operation
The following steps explain how to set up a Timer C timer.
1. Select perclk/2, perclk/16, or countdown timer A1 in TCCR.
2. Load the desired upper limit for the counter into TCDLR and TCDHR. The overall
clock count per Timer C cycle will be the value loaded into the divider registers plus
one.
3. Load the desired set and reset values for the Timer C outputs into the set and reset
registers (TCSxLR, TCSxHR, TCRxLR, and TCRxHR).
4. If you intend to use DMA control of Timer C, use TCBAR to access the Timer C
register pointed to by TCBPR.
5. Enable the desired output pins for Timer C by writing to the appropriate parallel port
function and alternate output registers.
6. Enable Timer C by writing a 1 to bit 0 of TCCSR.
15.3.1 Handling Interrupts
The following steps explain how an interrupt is used.
1. Write the vector to the interrupt service routine to the internal interrupt table.
2. Configure TCCR to select the interrupt priority (note that interrupts will be enabled
once this value is set).
The interrupt request is cleared by reading from TCCSR.
15.3.2 Example ISR
A sample interrupt handler is shown below.
timerC_isr::
push af ; save used registers
ioi ld a, (TCCSR) ; clear the interrupt request and get status
; handle all interrupts flagged in TCCSR here
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...