Zibb

Design Idea

PC's serial port controls programmable sine-wave generator

Audio-frequency signal source uses few components.

Yongping Xia, Navcom Technology, Torrance, CA; Edited by Brad Thompson and Fran Granville -- EDN, 9/1/2006

This Design Idea describes a circuit that uses a PC's serial port to control a sine-wave generator that covers a frequency range of 2 Hz to 20 kHz in 1-Hz steps (Figure 1). The circuit's output voltage of approximately 2.2V p-p remains constant over the entire frequency range. The circuit's signal source, a Linear Technology LTC6904, IC1, consists of a digitally programmable square-wave oscillator that, without using a clock crystal, covers a frequency of approximately 1 kHz to 68 MHz at 0.1% resolution and a few percentage points of accuracy. The LTC6904 features an I2C serial-communications interface that controls the output frequency according to: OSCCLK=2a×2078 Hz/[2–(b/1024)]. The variables "a" and "b" represent 4- and 10-bit digital codes, respectively, and the equation's frequency unit, OSCCLK, is in hertz.

The OSCCLK output from IC1 at Pin 6 drives IC2, a 14-stage 74HC4020 binary counter whose outputs at Q4 and Q10 serve as the clock and input signals for IC3, a Maxim eighth-order, switched-capacitor MAX291 lowpass filter.

The –3-dB corner of the filter's frequency response occurs at one-one-hundredth of IC3's clock frequency. Fixed at one-sixty-fourth of the clock-signal frequency, only the input square wave's fundamental frequency can pass the filter without undergoing considerable attenuation. The filter's eighth-order response removes higher order harmonics, and the filter's output thus consists of a sine wave at the input's fundamental frequency. The filter's clock and input always occur in a 64-to-1 frequency ratio, and the sine wave's output amplitude thus remains constant over the entire frequency range.

To generate a 1-kHz sine wave, the circuit requires a filter clock at a frequency of 64 kHz, which sets the OSCCLK frequency 64 times higher, or 1.024 MHz. To satisfy the equation, the LTC6904 requires programming constants of a=09H and b=3d8H to generate an OSCCLK frequency of 1023.94 kHz and the nearest output frequency of 999.9 Hz.

Written for IBM-compatible PCs, the C-language program accompanying this Design Idea (Listing 1) accepts an output-frequency request, calculates the nearest values of programming codes "a" and "b," transmits the codes to IC1, and shows the calculated frequency on the PC's display. Although a PC's serial port delivers RS-232 signals, diodes D1 through D4 limit the voltages available at Pin 4, the data-terminal-ready pin, and Pin 7, the ready-to-send pin, to levels compatible with the I2C bus's SDI and SCK signals, respectively.



Reed Business Information Resource Center

Featured Company


Related Resources

ADVERTISEMENT

ADVERTISEMENT

Related Content

 

By This Author


ADVERTISEMENT

Knowledge Center



Technology Quick Links

EDN Marketplace


©1997-2009 Reed Business Information, a division of Reed Elsevier Inc. All rights reserved.
Use of this Web site is subject to its Terms of Use | Privacy Policy

Please visit these other Reed Business sites