![Rabbit Rabbit 4000 User Manual Download Page 245](http://html1.mh-extra.com/html/rabbit/rabbit-4000/rabbit-4000_user-manual_3116714245.webp)
235
22.3 Operation
The following steps explain how to set up a Quadrature Decoder channel.
1. Configure Timer A10 via TAT10R to provide the desired Quadrature Decoder clock
speed.
2. Configure QDCR to select the input pins for the two channels.
3. Reset the counters by writing to QDCSR.
22.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 QDCR to select the interrupt priority (note that interrupts will be enabled
once this value is set).
The following actions occur within the interrupt service routine.
•
Since a Quadrature Decoder interrupt occurs when the counter rolls over, determine
exactly why the interrupt occurred by reading the status bits in QDCSR and adjust any
software counters accordingly. This will also clear the interrupt request.
•
The current counter value can be read from QDCxR (and QDCxHR if the 10-bit
counter is enabled).
22.3.2 Example ISR
A sample interrupt handler is shown below.
qd_isr::
push af ; save used registers
ioi ld a, (QDCSR) ; clear the interrupt request and get status
; perform any necessary software counter adjustments here
; read current counter value(s)
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...