Padu wrote: >>Olin Lathrop wrote: >>You can answer this easily yourself. The 16x baud clock is created by >>dividing the oscillator frequency by an integer. The baud rate resolution >>is therefore very poor for low oscillator frequencies and high baud rates. >> >>For example, with 4MHz oscillator here are the fastest few baud rates: >> >> OSC | Div | Baud >> -------------------- >> 4MHz 1 250K >> 4MHz 2 125K >> 4MHz 3 83.3K >> 4MHz 4 62.5K >> 4MHz 5 50.0K >> 4MHz 6 41.7K >> 4MHz 7 35.7K >> 4MHz 8 31.3K >> 4MHz 9 27.8K >> 4MHz 10 25.0K >> >>To get 38400 baud, you have a choice of 41.7Kbaud (8.6% too high), or >>35.7Kbaud (7.0% too low). Both those errors are too high. You therefore >>can't do proper 38400 baud with a 4MHz oscillator. >> >> > > >Let me see if I got this right, if I want to be able to communicate at >38400/57600, then I'd have to find one crystal that would minimize rounding >innacuracies. Having in mind that I'll set BRGH, then I came up with the >following table: > >Desired Baud | SPBRG | Perfect Crystal > 38400 7 4.9152 > 38400 8 5.5296 > 38400 9 6.1440 > 38400 10 6.7584 > 38400 12 7.9872 > 38400 14 9.2160 > 38400 16 10.4448 > 57600 5 5.5296 > 57600 6 6.4512 > 57600 7 7.3728 > 57600 8 8.2944 > 57600 10 10.1376 > 57600 12 11.9808 > > >If my calculations were right, then a 5.5296MHz crystal would be perfect for >both 38.4K and 57.6K baud rates, am I correct? > >I went to digikey and amazingly enough, there is a crystal at exactly this >frequency (CSA309-5.5296MABJ). Should I order it? >Which one is better, cylinder or smd? Just go digikey's main page and type >in "5.5296" on the search edit box. > > I personally don't like crystals at all, but if you have to get them, the cylindrical one, mounted with a small loop on the wires and the body encased in silicone bathtub caulk, will probably last forever. SMD crystals are easily damaged by vibration and shock, don't go that way. --Bob -- Note: Attachments must be sent to attach@engineer.cotse.net, and MAY delay replies to this message. 520-219-2363 _______________________________________________ http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist