Been searching for a previous thread where this was raised but couldn't find it so I'll start a new one.
As part of the development of my current project the original code was written for a 16F877A with a 20mhz crystal. RS232 comms between the EasyPic5 board and the PIC was fine using 115200 baud etc and using hyperterminal data could be exchanged.
Due to advancements of the code I ported this to an 18F4580, and found that the RS232 comms simply filled the hyperterminal window with blocks of hieroglyphics. At the time I shelved this as I wanted to get other functionality working, but now I would like to resolve this issue.
I've read (can say I fully understand) the section of the datasheet for the 18F4580 (http://ww1.microchip.com/downloads/e...Doc/39637c.pdf) and it appears that the UART side of things is more complicated than the 16F877A.
From memory of the previous discussion the consensus is that it's a timing issue. Here are the current register settings:
Code:
DEFINE HSER_BAUD 115200 ' Hser baud rate
DEFINE HSER_RCSTA 90h ' Hser receive status init
DEFINE HSER_TXSTA 24h ' Hser transmit status init
DEFINE HSER_SPBRG 25
DEFINE HSER_CLROERR 1 ' Hser clear overflow automatically
ColumnWidth CON 10
I'm running the 18F4580 with a 20Mhz crystal, with an DEFINE OSC 48
I've tried entering various settings into Mister_E's calc program which seem to change just the SPBRG register value, which results in nothing at all or different sets of hieroglyphics gradually filling the hyperterminal window depending on what value is entered.
I've also tried replacing the 20Mhz crystal with a 10Mhz one, and changing the DEFINE OSC to 20 and still get the hieroglyphics.
I'm sure there is probably some additional register with the 18F chip that sets up the UART(s) on the PIC, but I can't figure it out.
I'm open to (constructive) suggestions as to how I can get RS232 comms working on the 18F4580 with a 20Mhz crystal.
Bookmarks