Reply by Erik Limpaecher September 10, 20032003-09-10
I'm trying to get speed measurement working with the 56F807 timers,
at both low speeds where there is a long time between encoder
quadrature edges and at high speeds where very accurate measurement
of pulse width is necessary. Pages 95-99 of the following designer
reference manual describe exactly what I want to do, but I'm having
trouble configuring the timer & decoder control & status registers
in a way to implement what is described:
http://e-
www.motorola.com/files/microcontrollers/doc/ref_manual/DRM023.pdf

I can't get Timer A1 & A2 to capture on the PHASEA edges, and the
quad counter

Here's a summary of my register configuration:

Decoder0.ControlReg
- set to use Mode2 (b'10), also tried in Mode1 (b'01)
- Everything else is set to 0

TIMER A0 IS SET UP AS A QUADRATURE COUNTER, USING THE ENCODER PHASE
A & PHASE B INPUT SIGNALS
TimerA.Channel0.ControlReg
- quadrature count mode (b'100)
- primary count source = counter 0 input pin (b'0000)
- secondary count source = counter 1 input pin (b'01)
- OFLAG: gated clock output while counter is active (b'111)

TimerA.Channel0.StatusReg
- output is enabled
- everything else is 0

TIMER A1 IS SET UP TO COUNT TIMER A0 TICKS
TimerA.Channel1.ControlReg
- cascaded counter mode (b'111)
- primary count source = counter 0 output ('b0100)
- secondary count source = counter 0 input (b'00)

TimerA.Channel1.StatusReg
- input capture mode = capture on both edges (b'11)
- input edge flag bit is set to 0 in an interrupt routine (but
capture doesn't happen!! why?)

TIMER A2 IS SET UP TO COUNT TIME BETWEEN PHASEA & PHASEB EDGES
TimerA.Channel2.ControlReg
- timer counts primary inputs (b'001)
- primary count source = IPbus/1 (b'1000)

TimerA.Channel2.StatusReg
- input capture mode = capture on both edges (b'11)
- input edge flag bit is set to 0 in an interrupt routine (but
capture doesn't happen when decoder is set to Mode1)

Thanks for any insight you can provide.

Erik