Mouser - White Papers

Implementing Quadrature Encoders with Configurable Logic

Mouser Electronics White Papers

Issue link: https://resources.mouser.com/i/1534198

Contents of this Issue

Navigation

Page 4 of 5

Mouser Electronics White Paper Beyond the CLB, the PIC16F13145 family of MCUs includes several peripherals particularly valuable for quadrature encoder applications: • Multiple 8-bit and 16-bit timers that can be used for position counting • A configurable interrupt system for real- time responses to position changes • Communication interfaces like serial peripheral interface (SPI) for sharing encoder data with host systems Available in 8- to 20-pin packages with a bevy of power-saving features, the PIC16F13145 family of MCUs is well-suited to applications with tight cost, power, and space constraints. Inside the Quadrature Decoder Architecture The CLB can be configured to implement both the debouncing and decoding functions needed for quadrature signal processing. Figure 3 shows a block diagram of the complete quadrature decoder implementation, illustrating how the CLB interfaces with other peripherals to create an end-to-end solution. The quadrature decoder implementation uses the CLB's BLEs to perform two critical functions: debouncing the input signals and decoding the quadrature sequence. When valid rotation is detected, the decoder outputs a single-clock pulse on one of two dedicated lines—one for clockwise rotation and one for counterclockwise rotation. Two timer modules count these pulses: TMR0 for clockwise rotations and TMR1 for counterclockwise rotations. The encoder's current position can then be determined by calculating the difference between these timer values. Figure 4 shows the specific CLB configuration for this implementation. This timer-based approach provides significant advantages for battery-powered applications. Rather than requiring constant CPU monitoring of the decoder signals, the CPU can remain in sleep mode, waking only periodically to determine the current position. That position information can then be transmitted to a host system via the SPI interface, if needed. Figure 3: Block diagram showing the quadrature decoder implementation using the CLB and timer peripherals. (Source: Microchip Technology) Figure 4: CLB configuration showing the implementation of the quadrature decoder circuit. (Source: Microchip Technology)

Articles in this issue

view archives of Mouser - White Papers - Implementing Quadrature Encoders with Configurable Logic