NU32v2: Using the LS7183 Quadrature Clock Converter
The LS7183 quadrature clock converter is a chip used to convert quadrature signals from encoders into up and down counts that can be sent to a microchip.
Overview
Rotary encoders create quadrature signals on two channels (A and B) corresponding to the speed and direction of a motor. Some encoders produce up to a million counts per revolution. For very fast quadrature signals there is no way that a software quadrature decoder can avoid overrun errors. Instead we may use the LS7183 chip to translate the A and B quadrature signals into brief pulses indicating up-count or down-count. The up and down counts can be configured as external input signals to increment counters on the PIC32. By reading the counters on the PIC, we can determine the angle of the motor.
Details
The resistor bias is used to control the pulse width of the up and down counts. The mode (1X, 2X, 4X) is used to multiply the quadrature clock rate by 1, 2 or 4. The mode is selected by connecting MODE to
- VSS (GND) -> 1X
- VDD (3.3V) -> 2X
- Float (don't connect to anything) -> 4X
The UP and DOWN count pins should be connected to external counters on the PIC32.
Sample Code
The full code can be downloaded here. The code configures 2 external counters (see NU32v2: Counters and Timers:External Counter for discussion of external counters .