Microchip Technology MA330028 Data Sheet

Page of 26
dsPIC33EPXXXGP50X, dsPIC33EPXXXMC20X/50X and PIC24EPXXXGP/MC20X
DS80000533H-page  18
 2011-2014 Microchip Technology Inc.
33. Module: QEI
When index count position capture is being used 
(QEIxIOC.QCAPEN = 1), the position count may 
be one more or one less than the correct value, 
depending on the direction of the count.
This is only observed when the leading edge of the 
index pulse occurs prior to the leading edge of the 
index match event. When the index pulse starts 
after the leading edge of the index match event, 
the position count is captured correctly.
 shows how this occurs. In these cases, 
Encoder Signals A, B and (index) Z are shown, 
with the module being configured for index match 
when A and B are ‘0’. The effects of a correct and 
incorrect capture are shown side by side (shaded
area indicates the index match event); the position 
count is shown along the bottom.
FIGURE 3:
CORRECT AND INCORRECT 
POSITION COUNT 
CAPTURES
Work around 
There are two different work arounds depending 
on the encoder type.
For encoder signals with timing that ensures the 
index pulse always starts prior to the start of the 
index match event (i.e., encoders with a non-gated 
index pulse), measure the direction of the encoder 
motion. If the encoder is counting up, add one to 
the captured position count; if the encoder is 
counting down, subtract one from the captured 
position count.
For encoder signals where the index pulse leading 
edge approximately coincides with the start of the 
index match event (i.e., encoders with a gated 
index pulse), a small delay can be added to the 
index pulse, for instance, by using a simple R-C 
filter.
If the encoder does not meet either of these 
criteria, no work around is available.
Affected Families and Silicon Revisions
34. Module: QEI
When QEIxIOC.QCAPEN is enabled, the position 
count is captured at the rising edge of the HOME 
signal, instead of the index match event as 
indicated by the data sheet.
Work around
None.
Affected Families and Silicon Revisions
A
B
Z
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
A
B
Z
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
Incorrect Position Count Capture
Correct Position Count Capture
dsPIC33/PIC24EP32 devices
dsPIC33/PIC24EP64 devices
dsPIC33/PIC24EP128 devices
dsPIC33/PIC24EP256 devices
dsPIC33/PIC24EP512 devices
A7
dsPIC33/PIC24EP32 devices
A3
dsPIC33/PIC24EP64 devices
A2, A3
dsPIC33/PIC24EP128 devices
A3
dsPIC33/PIC24EP256 devices
A3
dsPIC33/PIC24EP512 devices