Searching \ for '[PIC]: Synchronised dual freq generator' 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: 'Synchronised dual freq generator'.

Exact match. Not showing close matches.
PICList Thread
'[PIC]: Synchronised dual freq generator'
2001\10\12@062527 by SkinTech

flavicon
face
Hi all,

My current project involves generating a signal between 10 and 1000 Hz, both
square wave and sine (possibly also triangle). What I want to do for min
parts count is use one CCP module to generate say a 50kHz square wave and
use that as the clock signal to a LP filter with a 50:1 clock-to-Fcorner
ratio. The same signal is used as input to a timer/counter, to divide it by
50. The result of that (1kHz) can be used as is (square wave), or run
through the filter to get a sine wave. Problem I have is getting the div by
50 signal at a PIC output pin. As far as I can see, I can use the 'special
event' of the 2nd CCP, but I can only either set, clear or leave alone the
output pin. There apparently is no way to toggle the output pin. Or am I
overlooking something?

Thanks for any advice,

Jan Didden

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


2001\10\12@083556 by Bob Ammerman

picon face
Why not just generate your signal using wavetable synthesis?

A PIC can handle your frequency range with ease.

Bob Ammerman
RAm Systems
(contract development of high performance, high function, low-level
software)

{Original Message removed}

2001\10\12@123117 by Robert Rolf

picon face
Use the CCP2 interrupt to change the polarity of the NEXT CCP2 event.
You have plenty of time between edges to set this up and latency
won't cause jitter since the edge change is done with the hardware
timing.

SkinTech 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


2001\10\12@174608 by Brent Brown

picon face
Hi Jan,

I have just been working on some code that uses a 50:1 clock to
cutoff ratio chip and I had to produce a 750Hz - 50000Hz clock to
give a cut-off frequency range of 15 - 1000Hz. Very similar to what
you want but without the divided by 50 output.

I looked at using the CCP module to produce the square wave, as
Robert Rolf suggested each CCP interrupt changes the polarity of
the next CCP event so the output pin toggles state each time. The
problem in my case was I had too much other stuff going on with
interrupts and it was going to get all messed up especially at the
higher frequencies. I suggest it is probably a very good method if
you have no other interrupts enabled. Oh for a multi level interrupts!

In the end I used the PWM mode to generate my square wave,
switching the prescaler between 1:1, 1:4 and 1:16 to get the best
resolution over the full range.

Anyway, once you have produced your 500 - 50,000Hz square
wave using the CCP, it should be pretty easy in the interrupt routine
to increment a variable and when it gets to 50 toggle the state of an
output. Hey presto a divided by 50 output.

Brent Brown
Electronic Design Solutions
16 English Street
Hamilton, New Zealand
Ph/fax: +64 7 849 0069
Mobile/text: 025 334 069
eMail:  .....brent.brownKILLspamspam.....clear.net.nz

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


2001\10\13@072847 by SkinTech

flavicon
face
Bob,

I've thought about that, but I would need an external DAC and some post-DAC
filtering, right?

Jan Didden

{Original Message removed}

2001\10\13@102345 by Herbert Graf

flavicon
face
If you use pwm you could drop the use of a dac, although you would need a
filter (probably you could get away with a very simply passive filter). TTYL


> {Original Message removed}

2001\10\13@163819 by Bob Ammerman

picon face
No DAC needed. Just use the internal PWM at up to 76KHz sample rate at 8
bits per sample. Since your highest frequency is 1Khz you wouldn't need a
very steep filter on the output (perhaps just an simple RC).

Bob Ammerman
RAm Systems
(contract development of high performance, high function, low-level
software)

{Original Message removed}

2001\10\16@104101 by SkinTech

flavicon
face
Bob,

Thanks, yes I can see now how to approach this. Never used the CCP/PWM
before so will generate some cursing, oh well..
I probably can approximate the square wave with a trapezium, controlling the
rise times etc. Did I mention I need a way to offset the wave, so have to
add varying amounts of DC. I can see a lot of look-up tables in this.
Initially I thought that the filtering woyuld give problems due to the large
freq span (10Hz to 1KHz), but I guess  I will keep the pwm freq constant so
a single filter freq is needed.

Also thanks to other people that gave me valuable hints (Herbert, Brent,
Robert).

Jan Didden

{Original Message removed}

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