2
\$\begingroup\$

I hope someone can help me out!

A bit of background info: I have created a DDS based signal generator (Using PIC MCU to drive a AD9833 for DDS output). The generator is capable to produce sine, triangle and square waves up to 12.5Mhz. However the output at higher (more than 2 Mhz) frequencies is far from perfect (nowhere near the desired wave forms). Anyway, currently I don't need more than 2MHz. I have added a 7-th order elliptic filter to smooth the sine output from the DDS. After th? filter I use a Schmitt trigger in order to obtain a rectangular wave forms (I can adjust the duty circle as well). The problem is I don't know how I can create sawtooth/ramp or a triangular wave forms based on the DDS signal as a reference clock source (either rectangular or the filtered sine). My most important requirement is for a sawtooth waveform, with adjustable frequency and a constant amplitude in the frequency range from 1Hz to 2MHz.

My query is: Is there a cheap, easy for implementation solution, which could generate sawtooth/ramp waveforms (triangle as an extra is welcome too) with linear slope (without aliasing or discretization artifacts), adjustable frequency and fixed amplitude in wide frequency range?

Unfortunately I'm not able to find decent solution to that problem. The only thing that I have found was a post in a forum: http://www.eevblog.com/forum/blog/eevblog-483-microcontroller-voltage-inverter-tutorial/msg247080/#msg247080, which suggests usage of 4046 PLL chip, that generates a higher frequency square wave, which tracks the input and a 4024 binary counter, which is then fed into a cheapo r2r DAC consisting only of a resistor ladder. Incorporating that, possibly I could generate arbitrary frequency sawtooth with fixed amplitude. However the frequency range that I could get from 4046 PLL will not cover requirements (this is my opinion based on the formulas given in 4046 datasheet, that specify the frequency range), also there will be staircase artifacts because of the ADC conversion.

It will be best if I could cover the range from 1Hz to 2MHz.

Can anyone recommend something, which could do thе things properly?

Sorry for the long post, I hope that I managed to explain the problem (excuse me for my English, as it's not my native language).

Thanks, Osvaldo

\$\endgroup\$
  • \$\begingroup\$ What about a capacitor with a CCS? \$\endgroup\$ – Ignacio Vazquez-Abrams Aug 1 '13 at 14:24
5
\$\begingroup\$

Any waveform other than a sine at 12.5 MHz will be composed of the fundamental frequency 12.5 MHz, plus harmonics above that. For ideal waveforms with sharp edges, the harmonics extend to infinity.

It sounds like you have added a filter with a cutoff frequency around 12.5 MHz, so this is why your non-sinusoidal outputs don't look like they should -- your filter is stripping off the harmonics which give those waves their non-sinusoidal identity.

To illustrate, here are a few animations from Wikipedia which show various non-sinusoidal waveforms as harmonics are added/removed:

sawtooth harmonics

square-wave harmonics

What your filter should be doing is stripping off the harmonics generated by the impulses at each sample output by your DAC. This is called an anti-aliasing filter, and ideally it's a brick-wall low-pass filter with a cutoff equal to half your sampling frequency. Given that true brick-wall filters aren't realizable, the cutoff is usually a bit below half the sampling frequency, and the roll-off is made as steep as feasible. If you can sample significantly more than twice the highest frequency of interest, then the filter design isn't as critical.

It also follows that if you want to synthesize a 12.5 MHz square (or triangle, or sawtooth...) wave, you need a DAC sampling fast enough to also synthesize the higher harmonics in that wave. How much higher depends on how closely you want to approach an ideal square/triangle/sawtooth wave.

\$\endgroup\$
0
\$\begingroup\$

My query is: Is there a cheap, easy for implementation solution, which could generate sawtooth/ramp waveforms (triangle as an extra is welcome too) with linear slope (without aliasing or discretization artifacts), adjustable frequency and fixed amplitude in wide frequency range?

The key part of this query is "without aliasing or discretization artifacts" because this points to using an analogue circuit like this: -

enter image description here

I said "like this" because I'm fully aware that the TL082 isn't butch enough to keep a good ramp shape at 2MHz but there are plenty of op-amps that can.

But what about the title of the question - it implies the saw should be derived from a clock source (sine or square) and I'd like to point out that the output (at pin 7) shown above could indeed be the clock source.

Does the OP actually mean a clock source of his own production such as from an IO pin of an MCU? If the answer is "yes" then you may well be facing using a PLL and counter BUT using this method means you will have discretization artifacts and won't give you the required 1Hz to 2MHz range.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.