Difference between revisions of "NU32v2: Using the LS7183 Quadrature Clock Converter"

From Mech
Jump to navigationJump to search
Line 19: Line 19:
== Sample Code ==
== Sample Code ==


The full code can be downloaded [[Media:NU32v2_Encoder.c | here]]. The code configures 2 external counters (see [[NU32v2: Counters and Timers#External Counter|external counters]] for discussion).
The full code can be downloaded [[Media:NU32v2_Encoder.c | here]]. The code configures 2 external counters (see [[NU32v2: Counters and Timers#External Counter|Counters and Timers]] for discussion).

Revision as of 11:25, 9 February 2011

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

LS7183.png

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 Counters and Timers for discussion).