Searching \ for 'PIC based Phase-Locked-Loop?' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: massmind.org/techref/microchip/devices.htm?key=pic
Search entire site for: 'PIC based Phase-Locked-Loop?'.

Truncated match.
PICList Thread
'PIC based Phase-Locked-Loop?'
2000\01\15@131918 by adastra

flavicon
face
I have an application where I need to monitor a signal line for an
occasional burst of a periodic logic-level signal.  When the signal of
interest is not present, there may be random noise on the line.  When the
signal of interest is present, it will be anywhere in the range of 300 Hz to
5000 Hz.  The tricky bit is that it is only present for 200 cycles, whatever
it's frequency happens to be.  During this period (which at the highest
frequency is only 40 mS:  ie, 1/5000 * 200), I must determine that it is a
valid in-band signal (not noise), then store a number representing the
frequency or period for further processing.  I would like the resolution of
the stored period to be about 4 uS.

My first thought was to use an analog PLL and somehow lash it up to a PIC
for further processing.  However, I would really like to do the whole thing
in the PIC if possible.

We use the 16C558 in some other applications, so that would be my first
choice.

Any tips, suggestions, or pointers to a better solution would be very much
appreciated.

Thanks,  Foster

2000\01\15@133825 by David Covick

flavicon
face
Foster,

I did something similar in a digital 1 kW class-d power amplifier.  The
input was 2 MHz digital, so I used a 4020 ripple counter to increase the
pulse width to the PIC.  The PIC measured the pulse width and from there I
used the software to determine if the width was too high or low.  If the
high or low was exceeded then the PIC would shut-down the amplifier until an
in-band signal was received.
Not quite what you are attempting, but maybe this give you an idea.

David


{Original Message removed}

2000\01\15@142023 by Thomas C. Sefranek

face picon face
adastra wrote:

> I have an application where I need to monitor a signal line for an
> occasional burst of a periodic logic-level signal.  When the signal of
> interest is not present, there may be random noise on the line.  When the
> signal of interest is present, it will be anywhere in the range of 300 Hz to
> 5000 Hz.  The tricky bit is that it is only present for 200 cycles, whatever
> it's frequency happens to be.  During this period (which at the highest
> frequency is only 40 mS:  ie, 1/5000 * 200), I must determine that it is a
> valid in-band signal (not noise), then store a number representing the
> frequency or period for further processing.  I would like the resolution of
> the stored period to be about 4 uS.

What is the signal to noise ratio?

It seems to me that you could do this with JUST the PIC,
operating as a pulse width counter.

{Quote hidden}

--
Thomas C. Sefranek  WA1RHP
ARRL Instructor, Technical Specialist, VE Contact.
http://www.harvardrepeater.org
http://hamradio.cmcorp.com/inventory/Inventory.html

2000\01\15@181612 by Wagner Lipnharski

flavicon
face
This sounds to work like a Doppler Radar Receiver. If it is the case, it
means that the period of the first pulses could be slightly different
from the last pulses (1st.... 200th).  In any case the first 10 (or 20
pulses) should have a very close period.

If this functions as a Doppler Radar, you really don't need to receive
all the 200 pulses, but just identify that what you are receiving is in
fact the expected signal and measure its period, so frequency, so
whatever you want.

In any case you should just identify one complete wave form (positive
and negative peak) with the same period, and then trigger the compare
function that will try to identify the second coincidental pulse and so
on, until your processor will make sure at least 20, 30 or 50 pulses in
sequence and in phase.  If this happens, then you could wait for the end
of the carrier since you already have the pulse period.

Of course you can be receiving a repetitive noise in the same frequency
range, then to filter it out, you should expect to receive at least 200
- X, while X is the required pulses to trigger the "compare" circuit.
So, lets say that your software (or hardware) requires an average of 50
pulses to finally make sure it is the right signal, then your software
should account for some extra 130 to 150 pulses and then noise, to make
sure it was your 200 pulses carrier.

If you are thinking to do everything in PIC, hmmm... you want a
resolution of 4µs, it is a good challenge.

Perhaps the carrier identifier could be done with a phase canceling
circuit, like this:

a) Some carrier should be present.
b) An analog polarity adder (simple bipolar integrator) would add both
sides of the signal
c) If the result is close to zero, the incoming signal is (somehow) a
symmetrical wave form, not noise (*).
d) Trigger software routine to measure and count.

(*) Noise is never symmetrical (beware of Murphy's law), so it should
never generate a zero level at the bipolar integrator output. Final
decision should be made by your software routine to vote for valid
signal or not.

notes:
a) If this is not a Doppler Radar Receiver, even so it could be a good
reference literature for your application.
b) If *it is* a Doppler Radar, then you can have a clue "when" the
signal will come back, since your own circuit sent the signal to be
bounced.

Wagner Lipnharski - UST Research Inc.
Orlando, Florida  - http://www.ustr.net
---------------------------------------

adastra wrote:
{Quote hidden}

2000\01\16@181730 by Scott Dattalo
face
flavicon
face
On Sat, 15 Jan 2000, adastra wrote:

{Quote hidden}

The phase accumulator PLL I posted the other day could be designed to give
you about 4us edge capture resolution. However, with only 200 cycles, it
would be very difficult to maintain stability while servo-ing in on the
correct frequency. Here's the old post:

http://www.infosite.com/%7Ejkeyzer/piclist/2000/Jan/0003.html

It probably be easier to measure the time between edges and take the
average of the 200 cycles. Since you're wanting to use a '558, you'll have
to resort to polling an I/O pin to make this measurement. With a 20Mhz
crystal, you can get 20 cycles in 4 us (the desired resolution). The 300
Hz waveform has a period of 3.3 milliseconds and has about 833 4uS ticks.
So at least 10 bits will be required to measure the period ( unless you
want to average the time between every edge, which occurs at twice the
rate of the square wave [one rising and one falling for every cycle]). You
might as well use 16 bits.

Doing the averaging processing could be challenging in 20us. I think it'd
be better to spread this processing over several sample intervals and make
the assumption that whenever an edged is detected, another will not be
forth-coming until at least 1/5000/2 = 100uS. If this assumption is
correct, then you make take it to the extreme and increase the edge
capture resolution to 600ns (the instruction cycles). The algorithm would
go like this:


1) While waiting for the first edge, go to (1)

2) The first edge has been captured.
 2a) delay a fixed amount equivalent to the time required
     to process one sample (i.e. average)

3) With 3-tcyc resoloution sampling code, search for the next edge.
   (that was posted a long time ago).

4) Next edge has just been found. Compute the time since
   the last edge has occurred by adding the time captured
   in step 3 to the fixed (constant) amount of time to
   process one sample ( which is the time being consumed
   right now).

5) Average this time using a running average. E.g.:
   avg = (M*avg + N*current_sample_time)/(M+N)

6) If there are more edges to be caught, go to (3)


at this point 'avg' will have the average amount of time between every
edge. This is half of the desired period. So the frequency is:

f = 1/avg/2

You may wish to pre-adjust the avg to be somewhere of the middle of the
expect value. (Maybe just use the results of the previous run to
initialize the next run).

Scott

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