Hello all, I'm building a shield for programming on the arduino diecimila board for the m168 chip. I am sure I need a 16 mhz crystal on pins 9 & 10 to minic the original board - my question:
Can I use a 16 mhz resonator rather than a 16 mhz crystal? The 16 mhz crystal has a 22pF cap from each leg to ground - does the resonator need these capacitors?
The resonator has built in capacitors unlike the crystal. Either can be use for burning programs or bootloaders. A crystal has somewhat better accuracy specs but otherwise operation is the same.
That was a fast response Larry - and your answer is what I was thinking, but needed confirmation. By using the resonators I can just attach a leg to each pin... that sure makes wiring simple.
On most of my "production" projects where I build a dedicated board I almost always use ceramic resonators. Only on a few occasions where I needed the extra accuracy have I reverted to crystals.
As you surmised, resonators a just much simpler in do-it-yourself projects. Saves a few components and quite a bit of space on the perf-board. Connect the resonator to pins 9 & 10, connect the middle pin to ground and you're set.
Not ALL resonators have built-in capacitors. If your resonator has only has 2 leads, it will need capacitors just like the crystal (potentially of a different value.) If it has three leads, it had caps built-in (going to the middle lead, which you should connect to ground.)
Thank you for the follow up - my resonators have three pins so I can just connect the outside legs to pins 9 & 10, with center pin to ground... easy to do on my test board. Thanks to all for the info and follow up.
Only on a few occasions where I needed the extra accuracy have I reverted to crystals.
One such is serial communication. To guarantee the serial connection works your speed has to be +/- 1% of nominal. So if you have any trouble with serial comms then this is the first place to look.
Bah. Resonators are typically well within +/- 1%, and serial comm isn't that sensitive; you usually need a combined error of close to 10% to cause real problems.
The most common need for a crystal is in timekeeping; A 1% error is 14 minutes/day, which is far worse than we expect from modern timekeeping tools...
If you want to do the sums then it is just about 2% but:-
Be careful with microcontrollers that synthesize baud frequencies for their internal UARTs. Depending on the choice of microcontroller clock, the baud rates may not be exact. If the error can be determined, it can be easily included in the link error budget.
If you want to do the sums then it is just about 2%
With a "traditional" uart that samples bits starting at the middle of a bit (start sampling 1.5 bit time past the edge of the start bit), you have 9 bit-times to drift 1/2 bit before you get errors, or about 5.5% (usually allocated half to each side of the connection, so "2% off" at each side is supposed to be OK. Of course, not all uarts or software serial implementations will end up sampling the bitstream exactly at the middle, so YMMV.
Resonators seem to be typically +/- 0.5%, plus perhaps another +/-0.5% for temperature and aging, so they tend to be pretty safe. I don't think I've ever heard of someone attributing serial comm failures to use of a resonator (although I've heard several people report problems with internal (RC) clocks.)
but [clock divisor issues]
If you start off producing a wrong frequency because of BRG issues, you also eat into that 5% margin, but errors in the crystal are just as likely to help you be CLOSER as they are to hurt you...