Electronic Design

Single-Chip Quadrature Generator

A quadrature generator can be useful in a number of applications, such as motion control and signal processing. The idea presented here describes a very simple and inexpensive implementation of a quadrature generator using a single 8-pin IC, the Microchip PIC12C508 (see the figure).

This also represents one of the first published examples of proven assembler code for the new PIC12C508 microprocessor, and can be used as a basis for other programs (see the listing).

The algorithm for generating the quadrature signal is quite simple. The process is initiated by starting a free-running binary counter (COUNT) and by incrementing this register in an endless loop. Bits 1 and 2 (Bin 1 and Bin 2 in the Timing Diagram) of the 8-bit counter register are then used to directly generate the quadrature outputs.

Bin 2 of the counter is transferred directly to quadrature output Quad 2. Bin 1 and Bin 2 of the counter are then logically exclusive-OR’ed to generate the quadrature output, Quad 1. Quad 1 and Quad 2 are clocked to the output simultaneously to prevent the creation of any output glitches due to intermediate logic states.

The frequency of the quadrature outputs in this program is approximately 10 kHz, using the internal 4-MHz clock of the PIC12. The output frequency can be increased by utilizing bits 0 and 1 of the counter register. Decreasing output frequency involves either operating on the higher bits of the counter register or by adding firmware delays to the program’s counter loop. A sinusoidal output can be generated by adding a low-pass filter to each of the output signals.

Hide comments


  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.