Ttelmah Guest
|
|
Posted: Wed Dec 13, 2006 3:35 am |
|
|
Your best bet, will be 3.9964MHz, which is fairly common, or 3.6864MHz. Take the baud rate you want (9600) multiply it by 16 (153600), and then divide the approximate frequency you want to use on the basis of the 'speed' you want your processor to be going at, by this. So:
4000000/153600 = 26.04
Now take the integer part only of this,and multiply the 153600 by this:
153600*26 = 3993600
This would be the closest frequency to 4MHz, which would give a perfect baud rate, but is an unusual crystal. However 3.9964, is only 0.07% in error from this, and is common.
You can test any frequency by performing the division, and if the result is an integer, then this is a 'good' crystal to use. So:
3.6864MHz, gives 24, and is 'perfect'.
However, your 4MHz crystal, should be perfectly acceptable, being only 0.16% off frequency, while around 4% is often considered to be an acceptable 'limit for this error. Few PC's, manage better than a couple of percent, and most USB to serial adapters are worse than this...
Best Wishes |
|