Searching \ for '[EE]: Frequency stability of a PIC' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/microchip/devices.htm?key=pic
Search entire site for: 'Frequency stability of a PIC'.

Exact match. Not showing close matches.
PICList Thread
'[EE]: Frequency stability of a PIC'
2002\06\04@041356 by Joe Farr

flavicon
face
Hello all.

A general question that I hope some of you more 'seasoned' PIC people can answer.

I need to construct a variable frequency generator. Capable of producing frequencies from a couple of Hz up to around say 1 or 2 Mhz.
The accuracy has to be spot on and I mean spot on. If the display say 154Hz then it must be 154Hz and be capable of this for about 10 mins at a time. No glitches whist the PIC runs off to service some interrupt or other housekeeping task.

In theory, the code 'feels' quite simple to write.

However, do you believe that the PIC hardware is up to the task

Don't really have any preference of which PIC to use. I'm a 16F877 man, so would probably opt for this unless you feel a different choice would be best.

Any insights would be very helpful.

Thanks,
Joe.

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email spam_OUTlistservTakeThisOuTspammitvma.mit.edu with SET PICList DIGEST in the body


2002\06\04@065523 by Vasile Surducan

flavicon
face
search the net for DDS AD9832 or AD9835; PIC projects available
Vasile

On Tue, 4 Jun 2002, Joe Farr wrote:

{Quote hidden}

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email listservspamKILLspammitvma.mit.edu with SET PICList DIGEST in the body


2002\06\04@072925 by Jinx

face picon face
> > The accuracy has to be spot on and I mean spot on

The PIC will stay spot on at whatever frequency you choose for
10 minutes. At higher frequencies though you'll be limited. If you
stay with the 877 then the resolution will be 400ns at 20MHz, ie
200ns on, 200ns off, = 2.5MHz at best. And you won't be able to
produce any frequency that isn't a multiple of 200ns. The highest
frequency will depend on the complexity of the pulse output loop,
but assuming a 16-bit counter, perhaps 4-5us execution, and
probably not exactly 50%. Top whack for PWM is 208kHz at 5.5
bits resolution

How are you planning to change the frequency ? That will have
to be built into the loop too. You could change the frequency via
switches (that is, dial it up) during power-up after a reset, meaning
the pulse routine could be shorter, but that's not going to work if
you want a continuously variable output, and it still won't get you
anywhere near 1MHz

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email .....listservKILLspamspam.....mitvma.mit.edu with SET PICList DIGEST in the body


2002\06\04@073546 by Olin Lathrop

face picon face
>>
I need to construct a variable frequency generator. Capable of producing
frequencies from a couple of Hz up to around say 1 or 2 Mhz.
The accuracy has to be spot on and I mean spot on.
If the display say 154Hz then it must be 154Hz and be capable of this for
about 10 mins at a time. No glitches whist the PIC runs off to service some
interrupt or other housekeeping task.
<<

The accuracy of frequencies produced by a PIC is the accuracy of its
oscillator.  Specifications like "spot on" are completely useless, because
that obviously can't be achieved.  You also didn't say what kind of
precision you need.

Most likely you can't do what you want with a PIC.  The PIC can only divide
its oscillator value by certain integers to make an output frequency,
assuming you can't tolerate any jitter.  That gives you very few choices of
output frequencies at the high end.

To make an accurate and flexible variable frequency generator, you first
have to start with a good frequency reference.  After that you use a
combination of counters to divide the frequency and phase lock loops to
multiply the frequency to get the desired output.  Another possibility is to
use an analog oscillator and a digital circuit with a frequency reference to
measure whatever happens to be coming out of the analog oscillator.

You really need to be more specific about the requirements.


*****************************************************************
Embed Inc, embedded system specialists in Littleton Massachusetts
(978) 742-9014, http://www.embedinc.com

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email EraseMElistservspam_OUTspamTakeThisOuTmitvma.mit.edu with SET PICList DIGEST in the body


2002\06\04@085308 by Mark J. Dulcey
flavicon
face
Olin Lathrop wrote:
{Quote hidden}

There is another way: DDS (direct digital synthesis). Another term for
the same concept is wavetable synthesis, as used in computer sound cards
and software. (A DDS chip uses a sinewave table; the wavetables in sound
cards can represent various complex waveforms, as well as sine waves.)

The way it works: the synthesizer has a fixed clock; the maximum
possible output frequency is half the clock rate. (In practical terms,
the maximum is even lower, because you need a post-DDS filter to remove
the alias signals that appear above the clock rate.) Each clock tick,
you look up a signal value from a table that represents values of a
waveform, and feed that value to a DAC. You decide which value to look
up by using a phase accumulator; each clock tick, you add some constant
value to the accumulator. The value that you add determines the
frequency of the output.

The size of data that you use for the lookup table and for the phase
accumulator affect the quality of the result you get. A longer lookup
table, coupled with a DAC with more bits, gives you a higher quality
output waveform. A longer phase accumulator gives you finer frequency
resolution.

That said, doing DDS in a PIC isn't going to work very well, and
certainly not at frequencies above the audio range. Limitations are the
basic speed of the CPU and the lack of arithmetic capabilities wider
than 8 bits. Getting the DDS loop to run as fast as 50 KHz (100
instructions on a 20 MHz processor) would be a major accomplishment (and
not leave many cycles to do anything else); that would limit your output
frequency to about 20 KHz. If I were writing such a thing, I'd do all
the DDS work in the interrupt handler, assuring that the timing would be
accurate, and do the user interface in the main routine.

On the other hand, using a PIC to control a DDS chip is a fine idea, and
has been done. You can get accurate output frequencies of 20 MHz or more
that way. Here's a link to one design:
http://www.njqrp.org/digitalhomebrewing/wb2v_dds_vfo/wb2v_dds_vfo.html

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email listservspamspam_OUTmitvma.mit.edu with SET PICList DIGEST in the body


2002\06\04@132850 by Tal (Zapta)

flavicon
face
You can do that using a 'phase accumulator' techniques. Basically it
simulate the values that you would get from sampling a sine wave of the
desired frequency using a fixed sampling rate.

The samplings are generated using a single variable called Phase and a value
dPhase that represents the delta in the signal phase between two sampling.
On each sampling slot, you add the dPHase to Phase and then output a
sampling value of Sin(Phase) (probably using a lookup table).

To have cleaner signal, you want your Phase variable to have enough bits
such that the accumulated error is small enough. When you generate the
sampling, you can take only the high end bits of Phase.

If the dynamic range of your generator is too wide, you can modify the
sampling rate for each range. I think that in general you want your sampling
rate at least twice the signal frequency but the higher you go, the better.

This technique works very well especially for low frequency.

As for the PIC, if you fine tune your main loop to be of fixed machine
cycles and you use a stable clock, your signal will be stable.

Tal

> {Original Message removed}

More... (looser matching)
- Last day of these posts
- In 2002 , 2003 only
- Today
- New search...