On Fri, 2001-11-23 at 12:15, Bob Barr wrote: > On Fri, 23 Nov 2001 15:40:10 +0100, you wrote: > > > > >Note that there is no law that you must send the bits in a loop: with some > >calculation (and enough code space) you can unroll the loop and be up to 1 > >instruction accurate. > > > > True, but it doesn't make much difference whether you write your code > as a loop or unroll it. Either way, the baud rate cannot be made any > more accurate than the 1 instruction time granularity. Whether your 1 > instruction accuracy is in a loop or in-line code, the instruction > time determines how close you can get to the desired baud rate. > > Using a 10 MHz or 20 MHz crystal, by definition, introduces some > amount of baud rate error. > > Using the 'oddball' 9.216 MHz crystal (or 18.432 MHz as someone else > suggested. How did I forget that one?) will allow you to minimize the > error. > > Regards, Bob > > -- > http://www.piclist.com hint: PICList Posts must start with ONE topic: > [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads > > > By unrolling the loop, you can make the character timing accurate within 1 instruction cycle vs the bit times being accurate within one instruction cycle ( at the expense of some non cummulative bit timing jitter ). In this users case, with 1 start, 16 data bits and 1 stop bit, the character timing can be made 18 times better by unrolling the loop. This makes just about any crystal usable ( faster is better ). cheers -- ===================================================================== Lawrence Glaister VE7IT mailto:ve7it@shaw.ca 1462 Madrona Drive http://jfm.bc.ca/ Nanoose Bay, B.C. http://members.home.com/cncstuff Canada V9P 9C9 http://gspy.sourceforge.net ===================================================================== -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads