I am having some kind of issue getting these two uarts set up right. I'm using a PIC18F6722 running at 40MHz. UART1 runs perfectly fine at 115K, but UART2 just can't hack it. (If I lower the baudrate to 57600, it works fine). Besides setting the pin directions, I am using the setup resulting from the PIC Multicalc as follows:
Code:
'EUSART 1 (RS422 LINK)
DEFINE HSER1_RCSTA 90h
DEFINE HSER1_TXSTA 24h
DEFINE HSER1_CLROERR 1
DEFINE HSER1_SPBRG 86
SPBRGH1 = 0
BAUDCON1.3 = 1
'EUSART 2 (RS485 LINK)
DEFINE HSER2_RCSTA 90h
DEFINE HSER2_TXSTA 24h
DEFINE HSER2_CLROERR 1
DEFINE HSER2_SPBRG 86
SPBRGH2 = 0
BAUDCON2.3 = 1
I am not doing anything fancy, just trying to get both ports to transmit and receive at 115k - one at a time. No interrupts, nothing fancy.
Can anyone tell me why HSERIN2 fails to work when HSERIN1 works at this baudrate?
Bookmarks