using Mr E's Multi-calc's recommended settings
9600 baud
Code:
RCSTA = $90 ' Enable serial port & continuous receive
TXSTA = $24 ' Enable transmit, BRGH = 1
SPBRG = 160 ' 9600 Baud @ -0.08%
SPBRGH = 1
BAUDCON.3 = 1 ' Enable 16 bit baudrate generator
2400 baud
Code:
RCSTA = $90 ' Enable serial port & continuous receive
TXSTA = $24 ' Enable transmit, BRGH = 1
SPBRG = 130 ' 2400 Baud @ 0.0%
SPBRGH = 6
BAUDCON.3 = 1 ' Enable 16 bit baudrate generator
The code you posted should have been sending data out at 9600 baud with SPBRG set to 25. Set SPBRG to 103 for 2400 baud. The error rate would be a little higher than the above code snippet (not that it would probably matter in the real world).
Code:
RCSTA = $90 ' Enable serial port & continuous receive
TXSTA = $20 ' Enable transmit, BRGH = 0
SPBRG = 103 ' 2400 Baud @ 0.17%
Thanks to Mr E 
David
Bookmarks