Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

UART Recieve Code

Status
Not open for further replies.

Suraj143

Active Member
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?

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
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top