Some advice: I do a lot of serial communications with pics. I always use the USART. The reason being is I don't have to constantly poll the pins to receive data. When data comes in the program is interrupted and I handle the data as needed. Also the USART buffers data, so I never lose anything.
Here are the things you will need to get it to function:
DEFINE HSER_BAUD 9600 ' 9600 Baud USART
DEFINE HSER_RCSTA 90h ' Enable USART RX
DEFINE HSER_TXSTA 24h ' Enable USART TX
DEFINE HSER_CLROERR 1 ' Clear all USART errors as they happen
ON INTERRUPT GoTo INTERRUPT_SUB
PIE1.5=1 ' Enable USART RCIF interrupt flag
INTERRUPT_SUB :
IF PIR1.5=1 Then HSerin [Data] ' If RX flag is set retrieve serial data
This should give you a running start if you use it.




Bookmarks