Cheapest way 2 generate 22Khz clock?

Dec 02, 2004 16 Replies

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/

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

"it's the network..." "The Journey is the reward" speff@interlog.com Info for manufacturers: http://www.trexon.com Embedded software/hardware/analog Info for designers: http://www.speff.com

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.

Hi Spehro, Hi Mrk,

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

formatting link

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"

-- kensmith@rahul.net forging knowledge

[deleted]

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

Leon

Leon Heller, G1HSM http://www.geocities.com/leon_heller http://www.kasamba.com/viewExpert.asp?conMemID=105725&Catid=1111&banID=2100

Would you _please_ post what you need/want in terms of accuracy and stability?

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

"it's the network..." "The Journey is the reward" speff@interlog.com Info for manufacturers: http://www.trexon.com Embedded software/hardware/analog Info for designers: http://www.speff.com

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?

there

to

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.

Thanks, Frank. (remove 'x' and 'invalid' when replying by email)

In message , Frank Bemelman writes

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

Keith Wootten

"Mark" wrote

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.

Nicholas O. Lindan, Cleveland, Ohio Consulting Engineer: Electronics; Informatics; Photonics. Remove spaces etc. to reply: n o lindan at net com dot com psst.. want to buy an f-stop timer? nolindan.com/da/fstop/

There is an easy crash-bang solution that requires zero programming skills.

Choose any PIC that will work with a 4MHz 3-legged resonator. A 4MHz PIC will do an instr every 1uS. 21739Hz is a period of 46uS. So have a simple programme loop that is 46 instructions long.

Instruction#01. Set the output pin to a 1. NOP NOP

"Tony Williams" a écrit dans le message de news: snipped-for-privacy@ledelec.demon.co.uk...

LOL. Makes me wonder. Add a couple ADD or INC instrructions and you'll have a NOP DDS (neat oddly programmable DDS).

Thanks, Fred.

:)

Don't laugh.... It's an easy quick and dirty way of getting synchronised clocks and/or multiple phases.

Tony Williams.

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required