3.1 Position Decoder
The Position Decoder on the PIC32CM JH01 family of devices is a versatile peripheral designed to decode signals from position sensors, such as Quadrature Encoders and Hall sensors. It is used to determine the position, speed, and direction of rotating devices, making it ideal for motor control and other motion-control applications. It consists of a Quadrature or Hall decoder followed by a counter with two compare channels. The counter can be split into two parts to report the angular position and the number of revolutions. If the Quadrature Decoder feature is not suitable for specific applications, the PDEC module can be used as an additional time base.
The following are the key features of PDEC on the PIC32CM JH01 family of devices:
- Quadrature Decoder mode: Decodes signals from quadrature encoders, which provide two signals (A and B) that are 90 degrees out of phase. This mode allows the PDEC to determine the direction and amount of movement by analyzing the phase relationship between the signals.
- Index signal support: Handles an optional index signal (Z), which provides a reference position for each full rotation. This signal can be used to reset the position counter or provide an absolute reference point.
- Position and speed measurement: Continuously updates the position count based on the incoming pulses from the encoder signals. It can calculate the speed of movement by measuring the time between pulses.
- Error detection: Includes error detection features to identify issues, such as missed pulses or incorrect direction. This ensures reliable and accurate position measurements.
- Interrupts and events: Generates interrupts or events based on specific conditions, such as reaching a certain position, detecting a change in direction, or receiving an index pulse. These interrupts can be used to trigger other actions in the microcontroller.