Re: Pic18 and RN42 bluetooth communication problem using UART
It doesn't work using 4Mhz internal oscillator and I wonder if that is problem and a 24 external oscillator will fix it or the is problem with my code?
@ 4mHz The baudrate error is 8.5 % .Quite likely to cause trouble , the internal osc is quite capable of 8 12 16 24 or 48 MHz operation any one of which would be better than 4 .
Code:
DEFINE HSER_RCSTA 90h
DEFINE HSER_TXSTA 24h
DEFINE HSER_BAUD 115200
DEFINE HSER_SPBRG 1 ' 115200 Bauds
DEFINE HSER_CLOERR 1
DEFINE OSC 4
SPBRG = 1 why ? DEFINE HSER_SPBRG 1
RCSTA = 010000 ? even with %010000 its still wrong and conflicts with DEFINE HSER_RCSTA 90h
TXSTA = 100100 ? even with %100100 its redundant
Warning I'm not a teacher
Bookmarks