English
Language : 

W79E217A Datasheet, PDF (135/207 Pages) Winbond – 8-bit Microcontroller
Preliminary W79E217A Data Sheet
In QEI mode, IC1 and IC0 work as QEB and QEA inputs respectively. QEA and QEB accept the
outputs from a quadrature encoded source, such as incremental optical shaft encoder. Two channels,
A and B, nominally 90 degrees out of phase, are required.
IC0/QEA
IC1/QEB
IC2
Mode
Select bits
PCNT/
Capture 0 register
Noise
Filter
Noise
Filter
Noise
Filter
Direction
Clock
QEI
Control
Logic
PLSCNT/
Capture 1 register
Compare/Reload
Control Logic
MAXCNT/
Capture 2 register
Figure 15-10: QEI Block Diagram
Read access to
low byte of PCNT
The QEI control logic detects the relation of phase lead/lag between QEA and QEB to produce
direction index (DIR) and clock to control pulse counter. The comparator/reload logic compares the
pulse counter and maximum count and control the function of reloading pulse counter in compare-
counting mode. In Free-counting mode, the pulse counter will counts until the 65535 value. In
Compare-counting mode, the pulse counter will count to MAXCNT value. The value of the pulse
counter is not affected during QEI mode changes, nor when the QEI is disabled altogether.
In QEI mode, when IC2 edge (rising/falling edge is programmable through CAPCON0) has been
detected, CPTF2 will be set (if QEIEN=ICEN2=1 and DISIDX=0), and the only way to clear it is by
software.
- 135 -
Publication Release Date: December 14, 2007
Revision A3.0