The quadrature decoder generates the direction and clock to the position counter in quadrature count mode.
Direction DecodingThe direction decoding logic of the eQEP circuit determines which one of the sequences (QEPA,
QEPB) is the leading sequence and accordingly updates the direction information in the
QEPSTS[QDF] bit. Table 23-3 and Figure 23-7 show the direction decoding logic in truth table and state machine form. Both edges
of the QEPA and QEPB signals are sensed to generate count pulses for the position
counter. Therefore, the frequency of the clock generated by the eQEP logic is four times
that of each input sequence. Figure 23-8 shows the direction decoding and clock generation from the eQEP input signals.
Table 23-3 Quadrature Decoder Truth Table
Previous Edge |
Present Edge |
QDIR |
QPOSCNT |
QA↑ |
QB↑ |
UP |
Increment |
QB↓ |
DOWN |
Decrement |
QA↓ |
TOGGLE |
Increment or Decrement |
QA↓ |
QB↓ |
UP |
Increment |
QB↑ |
DOWN |
Decrement |
QA↑ |
TOGGLE |
Increment or Decrement |
QB↑ |
QA↑ |
DOWN |
Decrement |
QA↓ |
UP |
Increment |
QB↓ |
TOGGLE |
Increment or Decrement |
QB↓ |
QA↓ |
DOWN |
Decrement |
QA↑ |
UP |
Increment |
QB↑ |
TOGGLE |
Increment or Decrement |
Phase Error FlagIn normal operating conditions, quadrature inputs QEPA and QEPB is 90 degrees out of phase. The
phase error flag (PHE) is set in the QFLG register and the QPOSCNT value can be
incorrect and offset by multiples of 1 or 3. That is, when edge transition is detected
simultaneously on the QEPA and QEPB signals to optionally generate interrupts. State
transitions marked by dashed lines in Figure 23-7 are invalid transitions that generate a phase error.
Count MultiplicationThe eQEP position counter provides 4x times the resolution of an input clock by generating a
quadrature-clock (QCLK) on the rising/falling edges of both eQEP input clocks (QEPA and
QEPB) as shown in Figure 23-8.
Reverse CountIn normal quadrature count operation, QEPA input is applied to the QA input of the quadrature
decoder and the QEPB input is applied to the QB input of the quadrature decoder. Reverse
counting is enabled by setting the SWAP bit in the QDECCTL register. This swaps the
input to the quadrature decoder; thereby, reversing the counting direction.