Microcontroller-based sine-wave generator has crystal accuracy

Dec. 14, 1998
Use the Maxim MAX292 switched-capacitor filter IC to round a square wave into a sine wave; the circuit's frequency range is between 5.2282 Hz and 8928.6 Hz when the microcontroller is operating at a 16-MHz clock frequency.

One way to generate a sine wave is to pass a square wave through a low-pass filter. The high-order harmonics will be filtered out, leaving only the fundamental. The higher the order of the filter, the purer the sine wave produced.

The MAX292 is an 8th-order Bessel low-pass switched-capacitor filter. Its -3-dB corner frequency is controlled by its clock frequency in a 1:100 ratio. Using a 1:64 input-signal/clock ratio will produce a very clean sine wave. If this ratio is kept constant across the entire input frequency range, the amplitude of the filter output will be independent to the frequency.

Here, a high-speed microcontroller (Atmel’s AT90S1200) is used to generate square-wave and clock signals (see the figure). Meanwhile, the microcontroller accepts 13-bit frequency-control signals. The 13 bits are divided into two parts—the lower eight bits (D7-D0) are named delay_1, and the upper five bits (D12-D8) are named delay_2. No matter what frequency is selected, the base square wave and the clock will maintain a 1:64 ratio. Thus, the circuit will generate both sine-wave and square-wave signals at the base frequency, as well as a higher (64x) frequency square wave.

The frequency of the sine wave is given by:

fOUT = fOSC / (98688 * (delay_2-1) + 384 * delay_1 + 1408)

where fOUT is the sine-wave frequency and fOSC is the clock frequency of the microcontroller.

To generate a specific frequency sine wave, the values of delay_1 and delay_2 can be calculated from the equation above. For instance, assume fOSC is 16 MHz and a 60-Hz sine wave is needed. By using this equation, you can determine that delay_1 and delay_2 should be 177 and 3, respectively. Plugging these numbers back into the equation, the calculated output frequency will be 59.98 Hz.

The useful frequency range that can generated by this circuit is between 5.2282 Hz and 8928.6 Hz when the microcontroller  is operating at a 16-MHz clock frequency.

See associated figure

Sponsored Recommendations

Comments

To join the conversation, and become an exclusive member of Electronic Design, create an account today!