Hi all, I've got a spare 168 chip and I've got a load of junk kit knocking about, there are various crystals on the circuit boards, lots of 12s, a 32, a 48, and a 4-100mhz + some 'others' . I've had a read up a bit on crystals, serial, parallel, fixed, harmonics, variable, I think I understand most of it.
To get my 168 working at 16Mhz with any salvaged crystals is there anything special I need to look out for? Which would be the better type of crystal to go for? As there are the 'lozenge' H49 ones as standard on the arduino kit, cylindrical, 'glass' that are low profile smd etc. a lot of them seem to be a bit of a pita to identify exactly what they are, any pointers in finding their datasheets or ID'ing a particular type such as serial/parallel?
Am I also right in thinking that if I want to run at 16Mhz then I either need a 16Mhz crystal or something that can be tuned down, so if I can't find a fixed 16Mhz crystal I would need a variable type, then its a case of getting the right capacitor circuit built (if I can find a datasheet)? Or can I derive a 16Mhz clock from a 32/48Mhz fixed crystal? The numbers sound like I should be able to but sods law probably says I can't.
How many clock sources can I provide to the bare 168 chip, I know it has its 8mhz internal, then theres the 16Mhz it runs at, is it worth providing more than one source, or will that depend entirely on the project?
I know crystals are £1 a bag on ebay but its way more fun (and cheapest) learning about crystals by salvaging them, I get to learn how to cleanly remove smd parts with an iron while I'm at it.
the only 16mhz is sitting on something I want to keep, typical, really just wanted to see what my options were before I buy some. as some of the crystal information I have read mentioned harmonics I thought I might be able to do something with what I've got here to hand.
You can't use just any crystal and expect to pull it with a capacitor. The frequency shift you can get that way is only very small.
There are two things you can do to make the frequency you want:-
Make an oscillator at a higher frequency and divide it down to 16MHz. This will require a crystal that is an integer multiple of 16 MHz.
Make a phase locked loop (PLL) with you available crystal as a reference and derive 16MHz that way. This allows you to use crystals lower that 16MHz as well as those higher depending on how you do the feedback. With a PLL you can synthesise most frequincies.
Of course both these are more expensive than actually buying a crystal but I understood that is not the point.
Hii Grumpy_Mike, I had a thought that it needed to be an integer multiple, so for instance, if it was a 48Mhz crystal then I could derive 16,12,8,4,2 and 1 from it but 20Mhz would not be possible? What would I use to divide the clock, would it be fuse/software settings on the chip like pre-scaler and CKDiv?
I had a thought that it needed to be an integer multiple
Yes that is the simplest especially when dividing down. How you can go in for fractional division. This is where the divide number changes with each cycle. Suppose you have a chain that divided by 10 one time and the next divided by 11. On average it would divide by 10.5. This is better used in a phase locked loop but it will work by direct division. You do get more phase jitter with these techniques but that does not matter in this application.