RS232 comms - need help with datasheet
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.
Stumped !!!! - Murphys (sods!) law strikes again
Uhmmm... this was working fine, disconnected the comms lead from the EasyPIC5 board, now nothing is displayed in hyperterminal when the cable is re-connected. - Errr
Have re-compiled and re-loaded the version of code I was working on, have even opened an earlier version and corrected the definds in that, compiled and tried again.... still no joy.
Either cable is damaged, com port on the PC damaged, or max chip on the Easy PIC is damaged. - To disprove that I installed the old 16F877A which still contained the development code (prior to porting to the 18F chips) and 20Mhz xtal - hyperterm displayed the data correctly - so cable, ports and max chip obviously works.
So with the power off I removed the 16F877A and installed the 18F4580, swapped the xtal back to the 12Mhz and then powered on (with hyperterm still "connected") and presto - works fine.......
Stumped !!!!!!!!