Maker Pro
Maker Pro

Cheapest way 2 generate 22Khz clock?

M

Mark

Jan 1, 1970
0
Could somebody let me know the cheapest way to generate a stable,
reasonably accurate 22Khz, 5V logic level, clock. I'd prefer to use a
3 legged, "off-the-shelf" resonator as the source, if possible.
 
S

Spehro Pefhany

Jan 1, 1970
0
Could somebody let me know the cheapest way to generate a stable,
reasonably accurate 22Khz, 5V logic level, clock. I'd prefer to use a
3 legged, "off-the-shelf" resonator as the source, if possible.

You could use a 74HC4060, a couple of resistors and 5 1N4148s along
with an off-the-shelf 16MHz resonator. That would make an oscillator
and a divide-by-728.


Best regards,
Spehro Pefhany
 
J

Joerg

Jan 1, 1970
0
Hi Spehro, Hi Mrk,
You could use a 74HC4060, a couple of resistors and 5 1N4148s along
with an off-the-shelf 16MHz resonator. That would make an oscillator
and a divide-by-728.


Or, if you don't need the divider, use a 74HCU04. This is the unbuffered
version of the 74HC04. The 4060 also has an unbuffered oscillator
section which is great but with the HCU04 you'll get several uncommitted
inverters for other uses.

Regards, Joerg
 
F

Fritz Schlunder

Jan 1, 1970
0
Mark said:
Could somebody let me know the cheapest way to generate a stable,
reasonably accurate 22Khz, 5V logic level, clock. I'd prefer to use a
3 legged, "off-the-shelf" resonator as the source, if possible.

What does "stable" and "reasonably accurate" mean in quantitative terms?
The new PIC10F microcontrollers have built in 4MHz +/-1% RC oscillators, so
that translates to a 1us instruction cycle. This means you could make a
21.739kHz clock, or a 22.222kHz clock. If you wanted to get hardcore and
shoot for closer to your 22kHz you could play with tweaking the OSCCAL value
for optimal 22kHz. Over the full temperature and voltage range (2.0V-5.5V)
the intended frequency could be off by as much as +/-5%. These devices cost
less than $0.70 in single unit quantities from Mouser and are available in
SOT-23-6 or DIP8 packages.
 
M

mike

Jan 1, 1970
0
Fritz said:
What does "stable" and "reasonably accurate" mean in quantitative terms?
The new PIC10F microcontrollers have built in 4MHz +/-1% RC oscillators, so
that translates to a 1us instruction cycle. This means you could make a
21.739kHz clock, or a 22.222kHz clock. If you wanted to get hardcore and
shoot for closer to your 22kHz you could play with tweaking the OSCCAL value
for optimal 22kHz. Over the full temperature and voltage range (2.0V-5.5V)
the intended frequency could be off by as much as +/-5%. These devices cost
less than $0.70 in single unit quantities from Mouser and are available in
SOT-23-6 or DIP8 packages.

And you might be able to absorb a significant portion of your design
into the processor. So, the net cost could be less than zero.
mike

--
Return address is VALID.
500MHz Tek DSOscilloscope TDS540 $2200
http://nm7u.tripod.com/homepage/te.html
Wanted, 12.1" LCD for Gateway Solo 5300. Samsung LT121SU-121
Bunch of stuff For Sale and Wanted at the link below.
http://www.geocities.com/SiliconValley/Monitor/4710/
 
K

Ken Smith

Jan 1, 1970
0
You could use a 74HC4060, a couple of resistors and 5 1N4148s along
with an off-the-shelf 16MHz resonator. That would make an oscillator
and a divide-by-728.

I don't have a 4060 data sheet here, but I think there is a problem or two
with that idea.

The 4060 is a ripple counter. 728 = 512+128+64+16+8 so there are 3 delays
from the oscillator to the first bit of the decoder. You may be already
a cycle late by time the decode happens.

It seems to me that the reset pin of the 4060 effects to oscillator. As I
said I don't have the data book here.

If the OP can stand the error, the 11.0592MHz crystal divided by 512 is
21.6KHz.

Before anyone else says it "use a PIC"
 
M

Mark

Jan 1, 1970
0
I don't have a 4060 data sheet here, but I think there is a problem or two
with that idea.

The 4060 is a ripple counter. 728 = 512+128+64+16+8 so there are 3 delays
from the oscillator to the first bit of the decoder. You may be already
a cycle late by time the decode happens.

It seems to me that the reset pin of the 4060 effects to oscillator. As I
said I don't have the data book here.

If the OP can stand the error, the 11.0592MHz crystal divided by 512 is
21.6KHz.

Before anyone else says it "use a PIC"

--
OK so a PIC seems to rear its ugly head once again (there is already
one in another part of this design) which one should I use and is
there any pre-written code I can use, as my programming skills are in
the beginers stage.
 
L

Leon Heller

Jan 1, 1970
0
Mark said:
[deleted]


OK so a PIC seems to rear its ugly head once again (there is already
one in another part of this design) which one should I use and is
there any pre-written code I can use, as my programming skills are in
the beginers stage.

In that case, you might be able to use the existing PIC to generate the 22
kHz.

Leon
 
M

Mark

Jan 1, 1970
0
Mark said:
[deleted]


OK so a PIC seems to rear its ugly head once again (there is already
one in another part of this design) which one should I use and is
there any pre-written code I can use, as my programming skills are in
the beginers stage.

In that case, you might be able to use the existing PIC to generate the 22
kHz.

Leon

I think that may be too much for my programming skills, so I would
like to use a dedicated PIC on its own, any device/firmware
suggestions please?
 
R

Rich Grise

Jan 1, 1970
0
Mark said:
[deleted]


OK so a PIC seems to rear its ugly head once again (there is already
one in another part of this design) which one should I use and is there
any pre-written code I can use, as my programming skills are in the
beginers stage.

In that case, you might be able to use the existing PIC to generate the
22 kHz.

Leon

I think that may be too much for my programming skills, so I would like to
use a dedicated PIC on its own, any device/firmware suggestions please?

Yeah - learn enough PIC programming to make a 22 KHz clock come out of a
spare pin on the one you already have there.

Good Luck!
Rich
 
F

Frank Bemelman

Jan 1, 1970
0
Rich Grise said:
[deleted]


OK so a PIC seems to rear its ugly head once again (there is already
one in another part of this design) which one should I use and is there
any pre-written code I can use, as my programming skills are in the
beginers stage.

In that case, you might be able to use the existing PIC to generate the
22 kHz.

Leon

I think that may be too much for my programming skills, so I would like to
use a dedicated PIC on its own, any device/firmware suggestions please?

Yeah - learn enough PIC programming to make a 22 KHz clock come out of a
spare pin on the one you already have there.

That may be a problem even for an expert, depending on what is already
running on the little bugger.

But any pic will do. Just pick a pic.
 
M

Mark

Jan 1, 1970
0
[deleted]


OK so a PIC seems to rear its ugly head once again (there is already
one in another part of this design) which one should I use and is there
any pre-written code I can use, as my programming skills are in the
beginers stage.

In that case, you might be able to use the existing PIC to generate the
22 kHz.

Leon

I think that may be too much for my programming skills, so I would like to
use a dedicated PIC on its own, any device/firmware suggestions please?

Yeah - learn enough PIC programming to make a 22 KHz clock come out of a
spare pin on the one you already have there.

Good Luck!
Rich
Thanks Rich, most helpful.
 
K

Keith Wootten

Jan 1, 1970
0
But any pic will do. Just pick a pic.

Hi Frank

The new 6 pin types (PIC10Fxxx) can only run from their internal clock
(a great pity for just this type of problem), so if you're planning on
using an existing more accurate clock, an 8 pin PIC is the smallest.
PIC12F629 would be suitable.

Cheers
 
S

Spehro Pefhany

Jan 1, 1970
0
OK so a PIC seems to rear its ugly head once again (there is already
one in another part of this design) which one should I use and is
there any pre-written code I can use, as my programming skills are in
the beginers stage.

This code is the equivalent of a "hello world" program. Just
initialize the SFRs, toggle the output, delay and loop to repeat from
the toggle. A 16 or 8MHz resonator should give good results. Run it in
simulation (MPSIM) with stopwatch to make sure the delay is exactly
what it's supposed to be. Learn how to write the delays without using
all NOPs (but that would work too).

To do it as part of another program, you'd probably want to use
capture-compare hardware (set to automatically toggle an output pin on
match) and interrupts, with a high clock frequency if you want any
processor bandwidth left at the end of the day- it will require an
interrupt every 91 instructions at 16MHz, so keep the ISR short and
sweet- save the context, add a constant to the compare register and
return/restore the context. You'd probably have the equivalent of a 8
or 10MHz PIC left when this is running, with one less CCP module.


Best regards,
Spehro Pefhany
 
J

John Fields

Jan 1, 1970
0
OK so a PIC seems to rear its ugly head once again (there is already
one in another part of this design) which one should I use and is
there any pre-written code I can use, as my programming skills are in
the beginers stage.
 
R

Rich Grise

Jan 1, 1970
0
Thanks Rich, most helpful.

Hey, any time! :)

My point is, if you add a pic, you'll have to program it anyway. If you've
already got one, why add more if all you need is one more little loop and
one output pin? It's the same amount of programming, and all the
initialization stuff is already in place. In other words, you still have
to program it, regardless.

If you're going to insist on adding a chip, use a 74HC14, cap, and
resistor and make an oscillator. This will be as accurate and stable as
its components are, and you don't need a programmer or any software
written.

Of course, if somebody's already programmed a PIC for you and it's in the
mail, then this whole discussion becomes moot.

Good Luck!
Rich
 
M

Mark

Jan 1, 1970
0
Hey, any time! :)

My point is, if you add a pic, you'll have to program it anyway. If you've
already got one, why add more if all you need is one more little loop and
one output pin? It's the same amount of programming, and all the
initialization stuff is already in place. In other words, you still have
to program it, regardless.

If you're going to insist on adding a chip, use a 74HC14, cap, and
resistor and make an oscillator. This will be as accurate and stable as
its components are, and you don't need a programmer or any software
written.

Of course, if somebody's already programmed a PIC for you and it's in the
mail, then this whole discussion becomes moot.

Good Luck!
Rich

I am not clever enough to add this function to my exsisting 16CF57
without losing the funtionality of the original program, or getting
the reliable 22Khz clock I was looking for (unless of course you are
willing to show me?). Oh by the way, I use PicBasic Pro, laugh if you
wish.
 
J

John Fields

Jan 1, 1970
0
My point is, if you add a pic, you'll have to program it anyway. If you've
already got one, why add more if all you need is one more little loop and
one output pin? It's the same amount of programming, and all the
initialization stuff is already in place. In other words, you still have
to program it, regardless.

---
The problem with that approach is that the clock divider needs to
function in real time, so even if there's a free-running internal
peripheral counter in the chip which can generate interrupts, an ISR
needs to be written which will generate the divide-by and output the
22kHz signal. If there are other time-critical events which the µC is
supposed to take care of, then it can easily become a nightmare to try
to keep everybody happy. In either case, it's a little more involved
than just writing "one more little loop".
---
 
N

Nicholas O. Lindan

Jan 1, 1970
0
Mark said:
Could somebody let me know the cheapest way to generate a stable,
reasonably accurate 22Khz, 5V logic level, clock.

Not to belabor the obvious, but would a 555 fit the bill? With a
trim-pot, maybe?

'Stable' and 'reasonable' mean different things to different people.
Do you have any numbers: %/degree C; %/month; %/year; % unadjusted
accuracy ...

Importantly, what is the application for the 22kHz signal? What
sort of thing does it go into: oven timer, robot, small rocket,
stereo, dog whistle ...

If that were known I think you would get a far more optimum solution
from this group.
 
R

Rich Grise

Jan 1, 1970
0
I am not clever enough to add this function to my exsisting 16CF57 without
losing the funtionality of the original program, or getting the reliable
22Khz clock I was looking for (unless of course you are willing to show
me?). Oh by the way, I use PicBasic Pro, laugh if you wish.

How big is the program? I'm an unemployed programmer - if you post your
source code, I'd be happy to take a look at it. As long as it's textual, I
don't think there'd be any objections to a few K here and there, but if
it's really long, put [LONG] in the subject line. Or post it to
alt.binaries.schematics.electronics, they don't care about K. Or put it on
a web page.

I do wish I had a better mental picture of what it is you already have in
place, what kind of other stuff is available to work with - it sounds like
you're adding on to something somebody else designed. Is this kind of
accurate?

I have to be honest - only part of my motivation here is to help - I'm
really, really curious as to what you have there! :)

Thanks,
Rich

Oh, and you're clever enough, you just don't know it yet! :)
 
Top