You can change the baud rate "on the fly". I generally try to find a combination of BRGH and BRG16 that will give me both of the baud rates that I want with writing only to SPBRG.
I normally run at 40Mhz, so with the following in the header
DEFINE HSER_RCSTA 90H
DEFINE HSER_TXSTA 24H
DEFINE HSER_CLROERR 1
Then, in the main program...
You can run at 9600 baud with the statement:
SPBRG = 255
Or at 57600 baud with the statement:
SPBRG = 42




Bookmarks