Guys I need to detect FERR & OERR happen in the UART module in PIC.
If these errors happens will the PIC generates interrupts? Because inside ISR I check those errors after RCIF = 1.
Is my code ok?
If these errors happens will the PIC generates interrupts? Because inside ISR I check those errors after RCIF = 1.
Is my code ok?
Code:
Check_UART btfss PIR1,RCIF ; Is it a Recieve interrupt?
goto ISR_Exit
Check_Errors movf RCSTA,W
andlw b'00000110'
btfsc STATUS,Z
goto Read_UART
;--------------------------------------------------------------------------------------
Clear_OERR bcf RCSTA,CREN
nop
bsf RCSTA,CREN
;
Clear_FERR movf RCREG,W
movf RCREG,W
movf RCREG,W
goto Reset_Field
;--------------------------------------------------------------------------------------
Read_UART movf RCREG,W ; read the buffer
andlw b'01111111'
movwf RX_DATA ; load to a temperory register