Figure 21-25 shows how the interrupt mechanism works in the eQEP module.
Eleven interrupt events (PCE, PHE, QDC, WTO, PCU, PCO, PCR, PCM, SEL, IEL and UTO) can be generated. The interrupt control register (QEINT) is used to enable/disable individual interrupt event sources. The interrupt flag register (QFLG) indicates if any interrupt event has been latched and contains the global interrupt flag bit (INT).
An interrupt pulse is generated to PIE when:
- Interrupt is enabled for eQEP event inside QEINT
register
- Interrupt flag for eQEP event inside QFLG register is set,
and
- Global interrupt status flag bit QFLG[INT] had been cleared
for previously generated interrupt event. The interrupt service routine
needs to clear the global interrupt flag bit and the serviced event, by way
of the interrupt clear register (QCLR), before any other interrupt pulses
are generated. If either flags inside the QFLG register are not cleared,
further interrupt events do not generate an interrupt to PIE. You can
force an interrupt event by way of the interrupt force register (QFRC),
which is useful for test purposes.