Jan-Erik, You've cleared up one bit of confusion I had... I didn't understand how the register size was the size of that register. It seems obvious now :\ I did mean 8 bit registers. Thanks Bill On Fri, Mar 23, 2012 at 9:45 AM, Jan-Erik Soderholm < jan-erik.soderholm@telia.com> wrote: > > > Bill Stoddart wrote 2012-03-23 13:30: > > Thanks to everyone who chimed in, it got me thinking through the proble= m > > better. > > > > I think I am doing the calculations correctly but some of the baud rate= s > > I'd chosen must have had too much of an error. > > > > I am able to run at 9600 with 8 bit, BRGH=3D0, BRG=3D78 and at 115200 w= ith > 8bit > > BRGH=3D1, BRG=3D25. > > > > I tried to run 9600 with 8bit BRGH=3D1, BRG=3D311 with no luck. > > > > I think you must be a bit more carefull with what you write. > > There is no "BRG" register at all in the 18F4550! > > There is a SPBRG register (in 8 bit baudrate mode) and a > SPBRGH/SPBRG register pair (in 16 bit baudrate mode). > > Then there is control bit BRG16 that selects between 8 (default > at POR) and 16 bit mode. > > I'm not sure what the "with 8bit" stands for. > 8 bit characters or 8 bit baudrate register. > > Of course one can't set BRG=3D311 if in 8 bit baudrate register mode. > > Jan-Erik. > > > > This is all still using 48MHz. > > > > Thanks again > > Bill > > > > On Fri, Mar 23, 2012 at 7:26 AM, wrote: > > > >> > >>> A 'hexadecimal' crystal is more suitable for common baud rates, but > >>> whether you can or do use one depends on the functional priorities. F= or > >>> example if a microsecond timer is more important than comms, then a > >>> 20MHz would be preferable (for the 200ns cycles). You might have to > >>> compromise somewhere > >>> > >>> An 18.432MHz crystal in the calculations > >>> > >>> ((18432000/115200)/16)-1 > >>> > >>> =3D 9.000000, no error > >>> > >> > >> There is also a 19.something that gives exact baud rates (19.66088? or > >> something like that). The other option would be to 'overclock' slightl= y > at > >> twice 12.288 which is also an exact baud rate frequency (hence it > tended to > >> be used as the standard frequency for 8080 CPUs). > >> > >> > >> -- > >> Scanned by iCritical. > >> > >> -- > >> http://www.piclist.com PIC/SX FAQ& list archive > >> View/change your membership options at > >> http://mailman.mit.edu/mailman/listinfo/piclist > >> > > > > > > > -- > http://www.piclist.com PIC/SX FAQ & list archive > View/change your membership options at > http://mailman.mit.edu/mailman/listinfo/piclist > --=20 http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .