PIC + DDS = Frequency Synthesizer?

"RussT" schreef in bericht news: snipped-for-privacy@posting.google.com...

Well, I gave the URL to that minidds, which you had found yourself also. That one uses an AVR microcontroller, so you have to rewrite/port the code, but the principles are the same. I am not going to write it for you ;)

Just another family of 8 bit microcontrollers, made by Atmel. Less variety compared to PIC's but faster, more effycient.

--
Thanks, Frank.
(remove 'x' and 'invalid' when replying by email)
Reply to
Frank Bemelman
Loading thread data ...

snipped-for-privacy@sotainstruments.com (RussT) wrote in news: snipped-for-privacy@posting.google.com:

You can generate squarewaves from a sinusoid. I think the next question, is how much phase jitter can your application tolerate?

Starting with a fast clock and dividing with programmable counters is not going to give you nice 1 Hz frequency steps. With a sinusoidal signal (DDS synthesis) you can generate exact frequencies but it will be important to have a low noise zero crossing detector and a good quality sinusoid if phase jitter needs to be minimal.

--
Al Clark
Danville Signal Processing, Inc.
--------------------------------------------------------------------
Purveyors of Fine DSP Hardware and other Cool Stuff
Available at http://www.danvillesignal.com
Reply to
Al Clark

The Sharp LZ87010 uC has two DACs, with 128 Byte WaveTable RAMS, so it would seem to be well suited to this.

Not sure how real this is: There is data, and also an errata, (which is promising) but no sign it has hit 'critical-mass'

- has anyone designed in the LZ87010 yet ?

-jg

Reply to
jim granville

***That should work. I will roll up my sleeves and see if I can get the DDS to accept some data.
***Yup. Sorry, but I got thinking that DDS opens the doors so much I felt I could get even higher frequencies without a problem. I originally thought 20kHz would be good, but when I see DDS chips generating far higher...I got hungry for more. It is more of a convenience thing to get the higher frequencies. The application is to pulse a bank of LEDs at high rates. The higher I can pulse them, the more experimentation can be done. The LEDs are going to be used in a study to determine cellular response (ATP production) of tissue cells when subjected to a pulsed monochromatic light source. I just want to be able to vary the frequency in 1Hz steps up as high as I can. 20kHz is great, but if I can get more that's even better.

***I will look into the different PICs available. Thanks.

***Yes, I may have gotten ahead of myself. A simple crystal souce should be fine. I really appreciate your suggestions and comments (as I do the others who have responded as well). Now, I'll see if I can put all this together. Again, thanks. Cheers! Russ :>)
Reply to
RussT

For signal purity, it's advisable to generate and filter a sine wave from a DDS and the square it. There is a Schmitt-trigger in the AD98xx series DDS chips for this purpose - see the data sheets from

Reply to
Tauno Voipio

Just use values for a square wave in the lookup table.

Leon

--
Leon Heller, G1HSM
Email: aqzf13@dsl.pipex.com
My low-cost Philips LPC210x ARM development system:
http://www.geocities.com/leon_heller/lpc2104.html
Reply to
Leon Heller

A few points:

- with the variable rate interrupt system, you can make a low-jitter square wave without loading the processor very much (see the previous thread)

- for the 20 kHz repetition rate, you'll have 200 clock cycles at 4 MHz clock. With a PIC this means 50 instructions, which should be just possible. With an AVR at the same clock, you'd have 200 cycles which would be certainly enough. Using a higher frequency or another processor would help (I know, studying a new processor takes some time and effort. It is usually worth it, though.)

- for your application: please note that LEDs are not strictly monochromatic. They have a wide bandwidth, and their wavelength varies on unit-to-unit basis and also as a function of temperature. If you need a narrower bandwidth, see laser diodes or RCLEDs might fit the bill

Good luck!

- Ville

--
Ville Voipio, Dr.Tech., M.Sc. (EE)
Reply to
Ville Voipio

I think (I don't know the application) that 1Hz resolution at 20 Khz would be overkill. Maybe if you specified the resolution in terms of percentage of the actual frequency (say 1%, ie 200Hz at 20Khz) then it would be fairly easy to code using the PWM generator or even in interrupts. If the PIC is running at 20MHz then you have 5 mips or so or a 100 counts on one of the timers at the rate of 50 K timeouts per second. It would be easy to get 25KHz with a resolution of on percent.

Regards Robert

Reply to
Robert Gush

You can also implement a DDS in CPLD when the output is to be rectangular. Going analog is not necessary.

Rene

--
Ing.Buero R.Tschaggelar - http://www.ibrtses.com
& commercial newsgroups - http://www.talkto.net
Reply to
Rene Tschaggelar

Rene Tschaggelar wrote in news: snipped-for-privacy@news.teranews.com:

I 've never considered a DDS with values of just 1 & 0 before, but it seems to me that you are essentially creating a table with values of 0 from 0 to almost PI & 1 from PI to almost 2 PI. This would be very easy to implement in a PLD if the sample rate is 2^n x resolution.

For example, to get 40k at 1 Hz resolution, clock at 131072 Hz. This creates a programmable DDS that can go up to 65535 Hz in 1 Hz steps. You just need an adder (add 40000 to a 17 bit accumulator) and use the most significant bit as your output.

The results should look fine to a frequency counter but be aware that the phase jitter will be excessive! If you make the clock much higher, perhaps 2^25 or 2^24, the phase jitter will be much smaller.

This is why a sine derived DDS and a squaring circuit might be better. Also be aware that most DDS chips have long accumulators but much shorter DACs. This also contributes to phase jitter. A DDS designed with a higher resolution DAC will have less phase jitter (and usually less frequency range). This may be a reason to use a sigma delta digital audio DAC and some kind of DSP or microcontroller based DDS.

--
Al Clark
Danville Signal Processing, Inc.
--------------------------------------------------------------------
Purveyors of Fine DSP Hardware and other Cool Stuff
Available at http://www.danvillesignal.com
Reply to
Al Clark

not

Assuming a serial loaded 32 bit adder value, and a 32 bit accumulator, with 12 MSB output, what speeds can be achieved? What would your (wild) guess be?

I'm impressed by the 180MHz DDS chips from Analog, but would like to play with something that can be hooked up to an external LUT, stored in fast ram.

--
Thanks, Frank.
(remove 'x' and 'invalid' when replying by email)
Reply to
Frank Bemelman

Knowing that, why don't you use a PLL? Like CY22393 from Cypress (5 bucks at DigiKey), though for your frequency range that's an overkill. You can program it using the I2C bus, clock it from a crystal, and your PIC is free to do all the UI and stuff.

regards, Andras Tantos

Reply to
Andras Tantos

"Andras Tantos" wrote in news:XACJb.44397$ snipped-for-privacy@nwrddc02.gnilink.net:

The CY22393 is a programmable clock that uses internal flash to store changes. The flash has a maximum write count of about 1000. It does an excellent job of generating ref frequencies for frequencies where a xtal is not easily obtained or in cases where the clock needs to be over 25-30 MHz.

--
Al Clark
Danville Signal Processing, Inc.
--------------------------------------------------------------------
Purveyors of Fine DSP Hardware and other Cool Stuff
Available at http://www.danvillesignal.com
Reply to
Al Clark

That may depend on the FPGA family, I guess. I made 27bit synchroneous counters running in excess of 120MHz in an ACEX chip. So I'd assume somewhere between 150MHz and 250MHz clocking rate should be doable with an average fast family.

I'm indeed impress by these parts too. I'm thinking along that line too. The external RAM is far too slow. I had a look at the Cypress static RAMs, they achieve 10ns. The internal RAM of FPGAs is much faster, I guess somewhere between 150 and 200MHz should be doable. The DAC isn't going to be easy, too.

Rene

--
Ing.Buero R.Tschaggelar - http://www.ibrtses.com
& commercial newsgroups - http://www.talkto.net
Reply to
Rene Tschaggelar

question,

Yes, a counter. But an adder, with all the carry stuff?

No, not easy. It's interesting to see that professional DDS based function generators don't go much above 100KHz, when generating triangle waves and sawtooth waves. Sine waves are easier, allowing steep alias filters.

--
Thanks, Frank.
(remove 'x' and 'invalid' when replying by email)
Reply to
Frank Bemelman

Given the actual usage, you should allow for control of pulse width (LED On Time) as well as repetition rate. (not quite DDS anymore) Also, since the tissue is likely to be time-based, not frequency based, you might like to think in TIME rather than frequency. I would imagine 1Hz steps would be getting coarse, for slower tissue reactions - you are going to get 1000ms/500ms/250ms/125ms - better might be to run > 10Mhz, and define to 100ns (jitter free) ON time, and OFF time for your LEDS. Also LEDs have thermal effects, and some time-degrade, so depending on your target precision, you might like to add a (fast) light-sensor, to confirm the actual exposure given. Most uC can use capture/compare channels, to give 15-16 bits of time step. The better ones include prescalers on the capt/comp to allow very wide set ranges, close to 32 bits, but still with one part in 2^15-2^16 region. If you need finer resolution than 2^15-2^16 region, or >> 10MHz then you are moving into CPLD/FPGA solutions. CPLD/FPGA could be designed for decimal setpoints, even from thumbwheels, if you want a PC-free setup :)

Cygnal uC have very fast cores, and 25/50/100MHz clocks to the timers, so you could use those to push the uC solution.

-jg

Reply to
jim granville

***Upon looking at the APP Note, there is a output on AD9835 s pin 16 which toggles on the MSB change. A perfect squarewave output! I by-pass the DAC entirely. This is getting interesting... Russ :)
Reply to
RussT

***Thanks jg, you've made some very interesting points. The current research shows that at low enough frequencies from DC-5kHz, the effects of the pulsed LED light (660nm and 880nm wavelengths) vary quite a bit. DC seems to sedate, 73-584Hz appears to speed tissue regeneration, and 4-5kHz are good for pain relief. I wanted to see if there are other effects at much higher frequencies. Incidentally, there is evidence showing that the cells can become acclimatized to the stimulus. That might occur over time (dosage) or at certain higher frequencies whereby the cell can no longer respond and sees the stimulus as steady DC in a way. I built a prototype unit and treated a rotator-cuff injury I have nursed for over 3 years. It has really affected me - especially my golf swing! I tried 660nm at 584 Hz (a bank of 60 x 3,000 mcd LEDs) for an abitrary treatment time of 20 minutes. To my utter amazement, I had nearly completely cured my injury. I would say 95% positive effect. The range of motion is nearly back to normal and the pain has all but vanished. I even have a better golf swing. :>) Russ :>)
Reply to
RussT

I've learned it on the hard way (:-)). It *can* be programmed to store a configuration, but comes unconfigured out of the factory and needs a special programmer to update the stored configuration. However you can download and change it's 'runtime' configuration through the I2C interface any time and as many times as you whish. Of course that configuration cannot be stored and will be lost upon the next powerup.

Regards, Andras Tantos

Reply to
Andras Tantos

... snip ...

You might have described the application first, and you would have gotten to better recommendations much faster. I suggest you think in terms of pulse generators and repetition period, which are very easily implemented. A master counter recycles at some value, setting repetition period. At the recycle point you can set the output on, and at some other count you can set it off. Everything is calibrated directly in terms of time. Should you want sequences of pulses that is also easily implemented (say red, then yellow, then green leds, for example). Jim Granville has gotten to the heart of the matter.

No DDS needed. A PIC will probably be overkill. A simple control mechanism will allow you to increase/decrease period and pulse width, displaying values. Control may need one selector toggle switch, one up button, and one down button.

--
Chuck F (cbfalconer@yahoo.com) (cbfalconer@worldnet.att.net)
   Available for consulting/temporary embedded and systems.
     USE worldnet address!
Reply to
CBFalconer

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.