Hi Ben,
The only problem is that if you don't read RCREG, the USART will stop after receiving 2 bytes. Then it'll never see a framing error.
A very simple interrupt routine could solve that though.
Just a quick example...
HTH,Code:CREN VAR RCSTA.4 FERR VAR RCSTA.2 OERR VAR RCSTA.1 RCIE VAR PIE1.5 Dummy VAR BYTE ON INTERRUPT GOTO USART_Handler RCIE = 1 ; Enable USART RX INTs Main: IF FERR THEN FERR = 0 TOGGLE LED ; Do something here ENDIF GOTO Main DISABLE USART_Handler: IF OERR then ; Clear Overrun Errors CREN = 0 CREN = 1 ENDIF Dummy = RCREG ; Empty USART Buffer and Clear RCIF RESUME ENABLE


Just trying to keep the code tight. I actually have a similar routine I guess thats the method I'm sticking with. Thanks!


Bookmarks