9.1 Speed Measurement

QEI peripheral on PIC32MK consists of a 32-bit wide velocity counter, which increments or decrements based on the signal from the quadrature decoder logic. Reading this register (VELxCNT) resets the register. The velocity counter provides the distance traveled in position counts between consecutive reads of the VELxCNT register. Therefore, when read at a fixed known rate, the velocity counter (VELxCNT register), can provide the velocity of the motor. The index input or any of the modes specified by the PIMOD<2:0> bits (QEIxCON<12:10>) do not affect the operation of the velocity counter.

Note: The position and velocity information that is obtained from QEI registers is mechanical units and not electrical units.

Refer to the device data sheet and Family Reference Manual Section 43. Quadrature Encoder Interface (QEI) (DS60001346).

Figure 9-1. Block Diagram of QEI on PIC32MK MCU