Hi, Malc
There's an error somewhere on your side ...
- OR your Xtal is 20 Mhz and you run the HS Osc ... and you have to declare 20 Mhz as a define
- OR your Xtal is a 12 Mhz and you run the HS PLL Osc ... then you get real 48 Mhz as a clock frequency
a 20 Mhz Xtal with HS PLL would give 80 Mhz ... if the clock could run those frequencies ( I only reached 64 Mhz ... but hardly !!! )
(so, I do hope it's just a typo from yours ...)
Just try
- a 12Mhz Xtal in HS PLL mode with 48 Mhz as a DEFINE
OR
- a 10 Mhz Xtal .... With 40 Mhz as a DEFINE.
of course, the UART values have to be set accordingly to the DEFINEd freq. ...
looks Mr E's calculator does not agree with you ...
Code:
DEFINE HSER_RCSTA 90h ' Enable serial port & continuous receive
DEFINE HSER_TXSTA 20h ' Enable transmit, BRGH = 0
DEFINE HSER_CLROERR 1 ' Clear overflow automatically
DEFINE HSER_SPBRG 25 ' 115200 Baud @ 48MHz, 0.16%
SPBRGH = 0
BAUDCON.3 = 1 ' Enable 16 bit baudrate generator
OR
Code:
DEFINE HSER_RCSTA 90h ' Enable serial port & continuous receive
DEFINE HSER_TXSTA 24h ' Enable transmit, BRGH = 1
DEFINE HSER_CLROERR 1 ' Clear overflow automatically
DEFINE HSER_SPBRG 86 ' 115200 Baud @ 40MHz, -0.22%
SPBRGH = 0
BAUDCON.3 = 1 ' Enable 16 bit baudrate generator
Aheum .... 
Alain
Bookmarks