Information

dsPIC33FJ12MC201/202
DS80461G-page 8 2010-2012 Microchip Technology Inc.
25. Module: QEI
The Quadrature Encoder Interface (QEI) module
does not generate an interrupt when MAXCNT is
set to 0xFFFF and the following events occur:
1. POSCNT underflows from 0x0000 to 0xFFFF.
2. POSCNT stops.
3. POSCNT overflows from 0xFFFF to 0x0000.
This sequence of events occurs when the motor is
running in one direction, which causes POSCNT to
underflow to 0xFFFF. Then, if the motor stops and
starts running in the opposite direction an overflow
from 0xFFFF to 0x0000 will be generated. The QEI
module does not generate an interrupt when this
condition occurs.
Work around
To prevent this condition from occurring, set
MAXCNT to 0x7FFF, which will cause an interrupt
to be generated by the QEI module.
In addition, a global variable could be used to
monitor bit 15, so that when an overflow or
underflow condition is present on POSCNT, the
variable will toggle bit 15. Example 1 shows the
code required for this global variable.
Affected Silicon Revisions
26. Module: UART
The UART module will not generate consecutive
break characters. Trying to perform a back-to-back
Break character transmission will cause the UART
module to transmit the dummy character used to
generate the first Break character instead of
transmitting the second Break character. Break
characters are generated correctly if they are
followed by non-Break character transmission.
Work around
None.
Affected Silicon Revisions
EXAMPLE 1:
A2 A3 A4 A5
XXX
X
A2 A3 A4 A5
XXX
X
unsigned int POSCNT_b15 = 0;
unsigned int Motor_Position = 0;
int main(void)
{
// ... User's code
MAXCNT = 0x7FFF; // Instead of 0xFFFF
Motor_Position = POSCNT_b15 + POSCNT;
// ... User's code
}
void __attribute__((__interrupt__)) _QEIInterrupt(void)
{
IFSxbits.QEIIF = 0; // Clear QEI interrupt flag
// x=2 for dsPIC30F
// x=3 for dsPIC33F
POSCNT_b15 ^= 0x8000; // Overflow or Underflow
}