If you need 115200 bps use DEBUG with a 20MHz oscillator. DEBUG uses the PAUSEUS
library function.
To figure out what data rate DEBUG will work with at a given oscillator speed use this;
(1000000 / (DEBUG_BAUD)) - (52 / (OSC)). Just drop remainders and keep the whole #.
OSC is how you define it not the actual oscillator speed. I.E. 4MHz would be 52/4 and not
52/4000000.
1000000 / 19200 = 52
52/4 = 13
52-13=39
Now try 38400 bps at 4MHz.
1000000 / 38400 = 26
52 / 4 = 13
26-13 = 13
The result is less than the minimum PAUSEUS time period for 4MHz, so it won't work at
38400 bps with DEBUG.
The value you end up with after the math should not be less than the minimum PAUSEUS
time period shown in your manual in the PAUSEUS section.
At 4MHz 19200 is the best you'll get with DEBUG.
With SERIN2/SEROUT2 use the calculation shown in the manual. (1000000/baud)-20. The
result has to be positive for it to work.
Bookmarks