Searching \ for '[EE]: Rounding the square wave' 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/index.htm?key=rounding+square
Search entire site for: 'Rounding the square wave'.

Exact match. Not showing close matches.
PICList Thread
'[EE]: Rounding the square wave'
2003\02\12@110209 by Timothy Box

flavicon
face
Hi all

I need to be able to round off the square wave coming from the HWPM on my
PIC. The HPWM output is being used to generate sound. I am currently using
the standard 2 Rs + 2 caps which works in a fashion but is still rather
harsh. The freq range is potentionaly from 247 hz up to 12.5 kHz so an
active filter is needed (I think). Can any body point me in the right
direction?


In return for the favour I can post a rather neat interrupt routine for the
PIC 18 series that will take a series of MIDI codes and time statements in a
DB list and turn that in to a tune on RC2. Just give it a tune no, set the
start flag and away it goes all by it's self. It includes sub looping!


Many thanks


Tim

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics

2003\02\12@112047 by Sid Weaver

picon face
In a message dated 02/12/2003 11:03:57 Eastern Standard Time,
spam_OUTTimTakeThisOuTspamTJBSYSTEMS.COM writes:


> The freq range is potentionaly from 247 hz up to 12.5 kHz so an
> active filter is needed (I think). Can any body point me in the right
> direction?
>

With a 20mHz resonator, the lowest frequency that can be generated with HPWM
is about 1220 Hz.  If you just want to round off the square wave, try just a
cap on the output - no resistor.  Since the "rounding off" effectiveness will
vary with frequency you might have to sort of compromise with a median value
of capacitance.  I would start with .1uf.

Sid

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics

2003\02\12@112253 by hael Rigby-Jones

picon face
> -----Original Message-----
> From: Timothy Box [SMTP:.....TimKILLspamspam@spam@TJBSYSTEMS.COM]
> Sent: Wednesday, February 12, 2003 3:53 PM
> To:   PICLISTspamKILLspamMITVMA.MIT.EDU
> Subject:      Re: [EE]: Rounding the square wave
>
> Hi all
>
> I need to be able to round off the square wave coming from the HWPM on my
> PIC. The HPWM output is being used to generate sound. I am currently using
> the standard 2 Rs + 2 caps which works in a fashion but is still rather
> harsh. The freq range is potentionaly from 247 hz up to 12.5 kHz so an
> active filter is needed (I think). Can any body point me in the right
> direction?
>
Is this the frequency range of the signal you are sending on top of the PWM?
What is the PWM frequency?

Mike

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics

2003\02\12@112917 by hael Rigby-Jones

picon face
{Quote hidden}

This isn't really a good idea, the PWM output will be driving a virtual
short circuit on the edges which will lead to supply glitches tec.
By ditching the resistor you have removed an integral (and essential) part
of the low pass filter, relying only on the output impedance of the PIC.

Mike

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics

2003\02\12@112924 by Alan B. Pearce

face picon face
> The freq range is potentionaly from 247 hz up to 12.5 kHz so an
> active filter is needed (I think). Can any body point me in the right
> direction?

Are you generating the frequency by adjusting the PWM of the output,
or the frequency of the PWM generator with a constant 50% square wave?

If doing the first then the frequency to consider is the PWM frequency
as being the frequency to filter. If doing the second you will need a
tracking filter as your lowest frequency is less than 1/3 the highest
frequency (check harmonics of a square wave for the reason why).

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics

2003\02\12@114403 by Timothy Box

flavicon
face
Hi

With the OSC at 4mhz the PWM freq is 247 hz midi note 59 (247 is about the
lowest freq at 4mhz) to 12.5 kHz midi note 127 (approx)


Thanks Tim

{Original Message removed}

2003\02\12@114951 by Timothy Box

flavicon
face
Hi all freqs are at 50% duty


Thanks Tim

-----Original Message-----
From: pic microcontroller discussion list
[@spam@PICLISTKILLspamspamMITVMA.MIT.EDU]On Behalf Of Alan B. Pearce
Sent: Wednesday, February 12, 2003 4:29 PM
To: KILLspamPICLISTKILLspamspamMITVMA.MIT.EDU
Subject: Re: [EE]: Rounding the square wave


> The freq range is potentionaly from 247 hz up to 12.5 kHz so an
> active filter is needed (I think). Can any body point me in the right
> direction?

Are you generating the frequency by adjusting the PWM of the output,
or the frequency of the PWM generator with a constant 50% square wave?

If doing the first then the frequency to consider is the PWM frequency
as being the frequency to filter. If doing the second you will need a
tracking filter as your lowest frequency is less than 1/3 the highest
frequency (check harmonics of a square wave for the reason why).

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics

2003\02\12@123227 by Philip Galanter

flavicon
face
At 3:52 PM +0000 2/12/03, Timothy Box wrote:
>Hi all
>
>I need to be able to round off the square wave coming from the HWPM on my
>PIC. The HPWM output is being used to generate sound. I am currently using
>the standard 2 Rs + 2 caps which works in a fashion but is still rather
>harsh. The freq range is potentionaly from 247 hz up to 12.5 kHz so an
>active filter is needed (I think). Can any body point me in the right
>direction?

Sounds like you might be a fellow synth player.

In any case you need a low pass filter (LPF) that can track the freq
setting of the HPWM.  You have more than a 5 octave range, so if you
adjust a non-tracking LPF to make the low notes sound right the high
notes will be barely (or not at all) audible, and if you adjust the
LPF to make the high notes sound good the low notes will still sound
"harsh".

One way to do this would be to find a filter circuit that uses a pot
to set the cutoff frequency, and then substitute a digital pot in the
circuit.  Then when the PIC changes it's HWPM Freq you have it also
set the digital pot to the corresponding LPF cutoff freq.

Since this is a music application you might also think about
modulating the pulse width with, say, a 1 cycle/sec triangle wave to
make the timbre dynamic and rich.  Also if you go the route above you
can modulate the LPF to give notes a timbre envelope (that synth
"WOW" sound).

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics

2003\02\12@130551 by Ned Konz

flavicon
face
On Wednesday 12 February 2003 07:52 am, you wrote:

> I need to be able to round off the square wave coming from the HWPM
> on my PIC. The HPWM output is being used to generate sound. I am
> currently using the standard 2 Rs + 2 caps which works in a fashion
> but is still rather harsh. The freq range is potentionaly from 247
> hz up to 12.5 kHz so an active filter is needed (I think). Can any
> body point me in the right direction?

Another strategy is to use a PIC that has two HW PWMs and use one to
drive the clock on a clock-programmable digital active filter IC
(like the Maxim MAX7490).

>
> In return for the favour I can post a rather neat interrupt routine
> for the PIC 18 series that will take a series of MIDI codes and
> time statements in a DB list and turn that in to a tune on RC2.
> Just give it a tune no, set the start flag and away it goes all by
> it's self. It includes sub looping!

I'd love to see it!

--
Ned Konz
http://bike-nomad.com
GPG key ID: BEEA7EFE

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics

2003\02\12@131631 by Olin Lathrop

face picon face
> I need to be able to round off the square wave coming from the HWPM on
my
> PIC. The HPWM output is being used to generate sound. I am currently
using
> the standard 2 Rs + 2 caps which works in a fashion but is still rather
> harsh. The freq range is potentionaly from 247 hz up to 12.5 kHz so an
> active filter is needed (I think). Can any body point me in the right
> direction?

You shouldn't need an active filter, at least with a 20MHz PIC.  In fact,
you probably don't need much filtering at all.  A 20MHz PIC can do 8 bit
resolution PWM at 78KHz.  That's over 6 times the highest frequency of
interest, and certainly higher than anyone can hear.  A passive two pole
filter with both poles at 17.7KHz (half octave above 12.5KHz) will
attenuate the PWM frequency by about 25dB.

Note that all the PWM frequencies are well above the audible range, so the
only reason for filtering is so that downstream active electronics doesn't
do strange things due to the high out of band frequency content.  Most
decent amplifiers will have a low pass filter right on the input anyway,
but I agree that filtering and buffering it yourself is a good idea.

The "quality" of the sound is much more a function of the PWM resolution
and the quality of the function to create the output samples.  Doing a
sine, for example, on the fly is too much for a simple PIC.  This is best
done with a lookup table.


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

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics

2003\02\12@133337 by Philip Galanter

flavicon
face
At 1:16 PM -0500 2/12/03, Olin Lathrop wrote:
{Quote hidden}

Ah, there are 2 kinds of filtering being talked about here...

First, in many/most PIC applications the HPWM output is low pass
filtered because the raw output is actually (to the best of my
understanding...please affirm or correct...) a train of very short
pulses.  In order to get the expected wave form those pulses have to
be integrated.

Second, for sound applications (like music synthesizers) LPF's are
used to adjust the timber of the (above corrected) waveform by
subtracting upper harmonics.  (aka subtractive synthesis).

For the first a fixed LPF with a relatively high cutoff (as per Olin) will do.
For the second see my previous post.

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics

2003\02\12@172214 by Jake Anderson

flavicon
face
try looking at the PC Speaker control scheme
it is just a square wave output but (i think) it relies on the fact that the
speaker has mass and hence inertia
basically they modulate PWM duty cycle at (ie % on time) at the audio
frequency required
IE use your note input to change the duty cycle not the freq and set the
freq as high as possible

----- Original Message -----
From: "Timothy Box" <RemoveMETimTakeThisOuTspamTJBSYSTEMS.COM>
To: <spamBeGonePICLISTspamBeGonespamMITVMA.MIT.EDU>
Sent: Thursday, February 13, 2003 3:44 AM
Subject: Re: [EE]: Rounding the square wave


> Hi
>
> With the OSC at 4mhz the PWM freq is 247 hz midi note 59 (247 is about the
> lowest freq at 4mhz) to 12.5 kHz midi note 127 (approx)
>
>
> Thanks Tim
>
> {Original Message removed}

2003\02\12@175343 by Timothy Box

flavicon
face
Thanks

It sounds interesting, at what freq should I be altering the duty? I.E Do I
set up one freq and just alter the Duty or do I set up the period at the
Freq desired and then move the duty up and down to make a sign and if so how
often would I have to alter the duty to produce the wave. Or am I missing
the point?

A couple of limitations max int freq 200hz and only a 1 1/2 speaker max


Tim




try looking at the PC Speaker control scheme
it is just a square wave output but (i think) it relies on the fact that the
speaker has mass and hence inertia
basically they modulate PWM duty cycle at (ie % on time) at the audio
frequency required
IE use your note input to change the duty cycle not the freq and set the
freq as high as possible

----- Original Message -----
From: "Timothy Box" <TakeThisOuTTimEraseMEspamspam_OUTTJBSYSTEMS.COM>
To: <RemoveMEPICLISTspamTakeThisOuTMITVMA.MIT.EDU>
Sent: Thursday, February 13, 2003 3:44 AM
Subject: Re: [EE]: Rounding the square wave


> Hi
>
> With the OSC at 4mhz the PWM freq is 247 hz midi note 59 (247 is about the
> lowest freq at 4mhz) to 12.5 kHz midi note 127 (approx)
>
>
> Thanks Tim
>
> {Original Message removed}

2003\02\12@175348 by Timothy Box

flavicon
face
Thanks

Unfortunately I am not a synth player and although the idea feeding a
triangle wave in the out put sounds great it will be bit of over the top for
this application. What I want is to have a mobile phone style selection of
alarm tones. No HIFI needed. The 2r's and caps works reasonably well but is
rough around the edges. What I would ideally like is a simple AMP + 2 gang
Dig pot combination to provide an amplified output. One dig pot for volume
and the other for controlling the filter. Is this possible or should I use 1
opamp + 1 audio amp + 2 digi pots. Can any body point me to a URL or is it a
case of looking in an active filter book?

Regards

Tim



At 3:52 PM +0000 2/12/03, Timothy Box wrote:
>Hi all
>
>I need to be able to round off the square wave coming from the HWPM on my
>PIC. The HPWM output is being used to generate sound. I am currently using
>the standard 2 Rs + 2 caps which works in a fashion but is still rather
>harsh. The freq range is potentionaly from 247 hz up to 12.5 kHz so an
>active filter is needed (I think). Can any body point me in the right
>direction?

Sounds like you might be a fellow synth player.

In any case you need a low pass filter (LPF) that can track the freq
setting of the HPWM.  You have more than a 5 octave range, so if you
adjust a non-tracking LPF to make the low notes sound right the high
notes will be barely (or not at all) audible, and if you adjust the
LPF to make the high notes sound good the low notes will still sound
"harsh".

One way to do this would be to find a filter circuit that uses a pot
to set the cutoff frequency, and then substitute a digital pot in the
circuit.  Then when the PIC changes it's HWPM Freq you have it also
set the digital pot to the corresponding LPF cutoff freq.

Since this is a music application you might also think about
modulating the pulse width with, say, a 1 cycle/sec triangle wave to
make the timbre dynamic and rich.  Also if you go the route above you
can modulate the LPF to give notes a timbre envelope (that synth
"WOW" sound).

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics

2003\02\12@181144 by Jake Anderson

flavicon
face
you need to alter the duty cycle at the frequency you want to "sample" the
song
i think this might give you some idea though this is for PC speaker
http://www.gamedev.net/reference/articles/article442.asp

----- Original Message -----
From: "Timothy Box" <TimEraseMEspam.....TJBSYSTEMS.COM>
To: <EraseMEPICLISTspamMITVMA.MIT.EDU>
Sent: Thursday, February 13, 2003 9:53 AM
Subject: Re: [EE]: Rounding the square wave


> Thanks
>
> It sounds interesting, at what freq should I be altering the duty? I.E Do
I
> set up one freq and just alter the Duty or do I set up the period at the
> Freq desired and then move the duty up and down to make a sign and if so
how
{Quote hidden}

the
{Quote hidden}

the
> > lowest freq at 4mhz) to 12.5 kHz midi note 127 (approx)
> >
> >
> > Thanks Tim
> >
> > {Original Message removed}

2003\02\12@195812 by David Minkler

flavicon
face
Tim,

Microchip offers FilterLab.  Download it at:

http://www.microchip.com/1000/pline/tools/analog/software/flab/index.htm

TI/Burr-Brown offer FilterPro.  Download it at:

http://focus.ti.com/analog/docs/sampleutilities.tsp?path=templatedata/cm/utilities/data/filterpro&templateId=3&familyId=57&navigationId=9742

Sorry about the wrap!

The underlying problem is (as several people have tried to point out)
that because of the wide spread between your minimum frequency and your
maximum frequency, any FIXED low pass filter which will "round the
edges" of your minimum frequency will reduce the amplitude of your
maximum frequency signal tremendously.

The fix, if you want to use a fixed filter, is to modulate the pulse
width (on/off duty cycle) of a much higher frequency signal
"sinusoidally" at the frequency you want to appear at the output.

Dave

Timothy Box wrote:
> Can any body point me to a URL or is it a case of looking in an active filter book?

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics

2003\02\12@201651 by Russell McMahon

face
flavicon
face
I haven't even tried to think this through but you could probably implement
a simple switched capacitor lowpass filter in hardware whose cutoff
frequency moves with drive frequency AND use the PIC to supply the drive
frequency which is ratio locked to the PWM frame rate.

A really nasty alternative, which would have the advantage of actually
working :-) , would be to use a passive RC filter and switch selected
capacitors to ground in stages as frequency varied.



       RM

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics

2003\02\13@051930 by hael Rigby-Jones

picon face
{Quote hidden}

Olin, I jumped to the same conclusion as you initialy which is why I asked
the OP for some more information.  He is not using PWM to produce e.g. a
sine, but is simply setting the pulse width to 50% and using the CCP as a
simple square wave tone generator. The filter he requires is not there to
simply remove the PWM carrier, which would be trivial.  Unfortunately the
desired range spans several octaves which requires a tracking filter as
described by other people.

A possibility is to use a voltage controlled filter (VCF) and use another
(low pass filtered) PWM output as the control voltage.  This would also let
you have some nice swept filter effects if you wanted to.  Unfortunately
VCF's are not trivial to design, although I would expect there are some
dedictaed IC's. I'm sure any synth enthusiasts could give you more
information.

The idea of a switched capacitor filter is nice, apart from the fact that
the clock you must supply is a fairly high multiple of the filters corner
frequency, i.e. 50 or 100 times, so driving such a filter directly from the
CCP module is not possible, you'd need some way of upping the frequency e.g.
phase locked loop, and it all starts getting a bit complicated for a simple
project.

Regards

Mike

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.

2003\02\13@090737 by Olin Lathrop

face picon face
> Olin, I jumped to the same conclusion as you initialy which is why I
asked
> the OP for some more information.  He is not using PWM to produce e.g. a
> sine, but is simply setting the pulse width to 50% and using the CCP as
a
> simple square wave tone generator. The filter he requires is not there
to
> simply remove the PWM carrier, which would be trivial.  Unfortunately
the
> desired range spans several octaves which requires a tracking filter as
> described by other people.

Yeah, I saw this several posts after I sent my response.  Part of the
reason I assumed this was because it made sense, allows for arbitrary
waveforms, and gets around all the dynamic filter problems being
discussed.

> The idea of a switched capacitor filter is nice, apart from the fact
that
> the clock you must supply is a fairly high multiple of the filters
corner
> frequency, i.e. 50 or 100 times, so driving such a filter directly from
the
> CCP module is not possible, you'd need some way of upping the frequency
e.g.
> phase locked loop, and it all starts getting a bit complicated for a
simple
> project.

A switched capacitor filter just switches in/out elements of cascaded R/C
lowpass filters.  You only switch it to change the rolloff frequency.  It
is a passive filter in any one configuration, and does not require a
clock.  You have a chain of resistors in series with capacitors to ground
thru a FET between them.  Turning on a FET enables that R/C filter
section.

Another possibility is to have a chain of such R/C filters at successively
lower cutoff frequencies.  These are unswitched fixed passive filters.
Every two stages or so tap off the output into an analog mux.  Select the
mux output based on frequency so that the harmonics are sufficiently
attenuated without the fundamental being attenuated too much.  Since he's
using square waves, he's got a factor of 3 in frequency between the
fundamental and the first harmonic content.

However, I would seriously investigate doing it the way I assumed he did
it in the first place.  It will greatly simplify the analog electronics,
although you have to wake up and think about the software a bit more.  I
have used this scheme to generate various wave shapes before.  In one case
the wave shapes were all the same, so I had one lookup table with more
resolution than I really needed.  This allowed using the "pick nearest"
method without interpolation being required at the expense of extra table
space.  The frequency was controlled by how much was added to the table
offset each PWM interrupt.  I kept 16 fraction bits to avoid creep when
rounding to a particular table entry.  And yes, it worked quite well.


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

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.

2003\02\13@093519 by Timothy Box

flavicon
face
Many thanks for all the replies

The solution is not as simple as I had hoped. Still I know now what I have
to look for. I might reduce the freq. range to 250hz to 3khz which will make
things a lot easier. I will try the active filter route and may be the
passive with switched in caps.

Cheers


Tim

{Original Message removed}

2003\02\13@093853 by Nigel Orr

flavicon
face
Olin Lathrop wrote on Thursday, February 13, 2003 2:06 PM:

> A switched capacitor filter just switches in/out elements of cascaded
> R/C lowpass filters.

No it doesn't, have a look at a basic electronics textbook and it will
explain what they do and how they work (clue: it's not a set of RC
filters).

>  You only switch it to change the rolloff
> frequency.

No, you apply a signal to control an internal switches, for example have a
look at Horowitz & Hill 2nd Ed, pg 282.

>  It is a passive filter in any one configuration, and does
> not require a clock.

No, it does require a clock, and is usually considered an active filter.

>  You have a chain of resistors in series with
> capacitors to ground thru a FET between them.  Turning on a FET
> enables that R/C filter section.

No, it doesn't.

Sorry Olin, back to electronics 101, as I believe it is called 'over
there'...

:-) :-)

Nigel

--
Nigel Orr, Design Engineer                 RemoveMEnigelKILLspamspamaxoninstruments.co.uk
Axon Instruments Ltd., Wardes Road,Inverurie,Aberdeenshire,UK,AB51 3TT
              Tel:+44 1467 622332 Fax:+44 1467 625235
                  http://www.axoninstruments.co.uk

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.

2003\02\13@103149 by Dave Tweed

face
flavicon
face
Olin Lathrop <olin_piclistSTOPspamspamspam_OUTEMBEDINC.COM> wrote:
> A switched capacitor filter just switches in/out elements of cascaded R/C
> lowpass filters.

No, Olin, a switched-capacitor filter replaces each resistor in a filter
network (and not just low-pass configurations) with a capacitor and two
switches. Since the capacitor transfers a fixed amount of charge between
two circuit nodes on each cycle of the clock, it functions as a precise
amount of conductance that's directly proprotional to the clock frequency.
(Or think of it as a resistance that's inversely proportional to the clock
frequency.) Multiple such elements within a network track very closely,
making it possible to build high-order filters that maintain their
performance over a wide range.

The big advantage is that these are easy to build on an IC, as it is very
difficult to make precise large-value resistors in silicon, but very easy
to make precise (and well-matched) small-value capacitors.

Their biggest drawback is that they are discrete-time, so you do need to
think about sampling issues such as aliasing, etc. However, these issues
tend to be minimized by the fact that the clock frequency is usually
several hundred times the signal frequencies of interest.

-- Dave Tweed

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.

2003\02\13@111945 by Jochen Feldhaar

flavicon
face
Dave Tweed wrote:

> Olin Lathrop <spamBeGoneolin_piclistSTOPspamspamEraseMEEMBEDINC.COM> wrote:
>
>>A switched capacitor filter just switches in/out elements of cascaded R/C
>>lowpass filters.
>>
>
> No, Olin, a switched-capacitor filter replaces each resistor in a filter
> network (and not just low-pass configurations) with a capacitor and two
> switches. Since the capacitor transfers a fixed amount of charge between
> two circuit nodes on each cycle of the clock, it functions as a precise
> amount of conductance that's directly proprotional to the clock frequency.
> (Or think of it as a resistance that's inversely proportional to the clock
> frequency.) Multiple such elements within a network track very closely,
> making it possible to build high-order filters that maintain their
> performance over a wide range.
>

< snippity>

But if you operate a SCF type filter, you have to know the desired
output frequency and adjust your filter accordingly....

Why not do it all backwards: An external sine wave oscillator is locked
to the 50% duty cycle PWN (aka reference frequency), and presto! here is
your sinewave. The phase detector could be a 4046 or something a bit
more sophisticated, and then a 8038 type ic can be used. Use the lock
detect pin to mute the audio - and there you are. Most industrial sine
wave sources (synthesizers) do it this way....

The only thing you will really have fun with is the loop filter ;-(

Greets
Jochen Feldhaar DH6FAZ

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.

2003\02\13@114831 by Vern Jones

flavicon
face
Hello,

Back in the days of the analog snyth., there was an SSM 2040 chip that
was designed as a tracking filter. I see these from time to time on
E-Bay.

A reference is Electronic Music Circuits by Berry Kline.

Vern Jones

Timothy Box wrote:
{Quote hidden}

> {Original Message removed}

2003\02\13@123045 by hael Rigby-Jones

picon face
> -----Original Message-----
> From: Russell McMahon [SMTP:KILLspamapptechspamBeGonespamPARADISE.NET.NZ]
> Sent: Thursday, February 13, 2003 1:08 AM
> To:   EraseMEPICLISTspamEraseMEMITVMA.MIT.EDU
> Subject:      Re: [EE]: Rounding the square wave
>
> I haven't even tried to think this through but you could probably
> implement
> a simple switched capacitor lowpass filter in hardware whose cutoff
> frequency moves with drive frequency AND use the PIC to supply the drive
> frequency which is ratio locked to the PWM frame rate.
>
Not really practical.  The two CCP outputs share the same timebase, so it
would have to be done in software.  Problem being, the OP's top fequency was
around 12kHz, you'd need at least 50 times that frequency i.e. 600kHz which
isn't going to be fun to do in software if you want it to do anything else.

Mike

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.

2003\02\13@141659 by Olin Lathrop

face picon face
> > A switched capacitor filter just switches in/out elements of cascaded
> > R/C lowpass filters.
>
> No it doesn't, have a look at a basic electronics textbook and it will
> explain what they do and how they work (clue: it's not a set of RC
> filters). ...

We must be talking about two different schemes, apparently both called
"switched capacitor" at various times and places.  Whatever you call it, a
scheme that "switches in" capacitors of R-C filters might still be a good
answer here.  What do you call such a topology?

--/\/\/---*---/\/\/-------
         |              |
         |              |
         _              _
         _              _
         |              |
         |              |
         o /            o /
          /              /
         o              o
         |              |
         *---------------
         |
         V


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

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.

2003\02\13@150531 by Timothy Box

flavicon
face
Thanks Olin


I knew what you meant. I will give it a try. I'm not looking for HiFi just
to take the roughness out of the sound I generate now.

Thanks again to all


Tim




> > A switched capacitor filter just switches in/out elements of cascaded
> > R/C lowpass filters.
>
> No it doesn't, have a look at a basic electronics textbook and it will
> explain what they do and how they work (clue: it's not a set of RC
> filters). ...

We must be talking about two different schemes, apparently both called
"switched capacitor" at various times and places.  Whatever you call it, a
scheme that "switches in" capacitors of R-C filters might still be a good
answer here.  What do you call such a topology?

--/\/\/---*---/\/\/-------
         |              |
         |              |
         _              _
         _              _
         |              |
         |              |
         o /            o /
          /              /
         o              o
         |              |
         *---------------
         |
         V


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

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.

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