Using the internal OSC sure leads to problems one day or another, even with newer OSC accuracy.
@8MHz and 9600 baud, it shouldn't matter if you use 24, or 20 for TXSTA as both will return the same error %... BUT assuming some ASM limitations, asking PBP macro to calculate the SPBRG value for you, could give some difference at this point.
See what a single digit of difference can do
@8MHz and TXSTA=20,
if SPBRG=11, err% =8.507%
if SPBRG=12, err% =0.16
if SPBRG=13, err% = -6.994%
When TXSTA=24
if SPBRG=50, err% =2.124%
if SPBRG=51, err% =0.16
if SPBRG=52, err% =-1.73%
Play safe and set SPBRG yourself.
Code:
DEFINE HSER_RCSTA 90h ' Enable serial port & continuous receive
DEFINE HSER_TXSTA 20h ' Enable transmit, BRGH = 0
DEFINE HSER_SPBRG 12 ' 9600 Baud @ 8MHz, 0.16%
DEFINE HSER_CLROERR 1 ' Clear overflow automatically
This is where I begun to think about some Standalone Calc software. First was E-Z SPBRG Calculator, then it grows and became PicMultiCalc.
Download it
http://www.picbasic.co.uk/forum/atta...7&d=1225550328
Last edited by mister_e; - 11th May 2009 at 18:08.
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
Bookmarks