Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

variable frequency sine wave control from a mpc 1

Status
Not open for further replies.

gwarrrr

Electrical
Jul 1, 2003
1
0
0
AU
Hi Everyone!

I am trying to send a signal to an audio amp which is a sine wave.
I need to be able to change the frequency of this sine wave.

Can i use a microprocessor like a motorola HC11 to send a pulse width modulation signal to some device that changes the frequency of the sine wave based on the PWM signal? What would this device be? somthing like a wein bridge oscillator circuit?
I am thinking of frequencies from 1kHz to 10kHz.
Is there another way i can do this?
Thankyou.
marko



 
Replies continue below

Recommended for you

If you can generate variable frequency PWM in HC11, you can feed this signal to an RC to filter high frequency components. The output of RC filter will be sine wave, In fact this is the simplest DAC tecnique used in some microcontroller as you might aware.
 
Hello gwarrrr,

There is a number of ways how you can do this. Sinewave through PWM is the lowest cost option.
The sinewave you get is not very clean, the next harmonics are somewhat 35-40dB off (in your desired frequency range with a standard MCU), which makes it good enough for many applications. It's good enough that you can't tell the difference with a scope.

if you need better, than a chip like the ML2035 would be the better choice. Sinewave through D/A conversion with an R2R ladder or a real D/A converter would be better, too, but requires more components.

There is a number of application notes out there about generating sinewave through PWM with a micro, very often combined with DTMF generation. Try Atmel AVR, Microchip and Intel appnotes for "DTMF" and "Sinewave" keywords.

You can find a good one for 8051s with PCA here:

All you need is an output filter after the PWM output. That can be as simple as a simple RC filter, depending on your PWM frequency. Realistically, with a desired output of 10kHz and a PWM frequency of 30-60kHz (the performance of most MCUs won't allow much more, since you'll need an interrupt routine at that frequency), you will need a second or fourth order output filter.

In that case, make sure the used filter opAmp accepts an input voltage between 0 and your micro supply voltage. If it is supplied by the same voltage, use a rail-to-rail type, or use a voltage divider at the PWM output.
 


Since you have a PWM signal, it is easy to send a sinewave .
Maintain the PWM signal frequency accurate, modulate the duty cycle.
Lets say: you have a 100 KHZ PWM signal that is 50 % duty cycle.
Take the modulating sinewave to vary the duty cycle from 10 % to 90 %.

Down stream the receiver for the PWM signal will trigger a monostable that has a duty cycle of 50 % ( equal to the signal w/o modulation.

Compare the monostable pulse duty cycle with the PWM signal duty cycle, the difference either positive or negative is passed via an Active RC filter ( 18 to 36 DBs/Octave) to an amplifier, having a filtered sinewave represetning the modulated sinewave.

This I have done many years ago.

Regards

Nandos

 
One cute way of generating a sinewave, or a phase-locked group of sinewaves for, say, a 3-phase application, is as follows:

Use Excel or similar to scale a sinewave into a series of discrete samples from hex value 00 to hex value FF.

Load samples of the sinewave in the correct sequence into a memory IC. Connect the memory output lines to a D/A converter. By clocking the memory IC using a digital counter at a user-controllable frequency, the samples are reconstructed into a sinewave of reasonable quality.

Use 3 memory ICs for three phases and skew the counters by 1/3 of a counter cycle, or load the data into the three memory IC's with an addressing offset and use a common counter (easier).

Frequency can be set very accurately if required using a cystal clock, or with a bit more effort sync'd to an external source using a PLL or some DSP algorithms.
 
Suggestion: The modulation type of sine wave is also related to the power requirement the sine wave is linked to. This then determines type of hardware.
 
Status
Not open for further replies.
Back
Top