Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

PIC18F UART framing errors problem

Status
Not open for further replies.

yasser_shoukry

Full Member level 4
Joined
May 31, 2006
Messages
233
Helped
25
Reputation
54
Reaction score
5
Trophy points
1,298
Location
Cairo - Egypt
Activity points
2,749
pic18f uart

Hi all,

I am facing a problem with the UART of my PIC18F4580 module as the RCIF (receive interrupt flag) never goes down after the first receiving byte. The data sheet says that to clear this bit , I should read RCREG (receive register) , I did so but nothing happens.

Note:- I am using MPLAB SIM to test the UART functionality

Here is the part of the interrupt service routine which handles the UART receiving part.

Code:
if( PIR1bits.RCIF == 1){		
		byteReceieved = RCREG;

		if(RCSTAbits.OERR == 1){					//Start with error handling (Overrun error)
			TXSTAbits.TXEN=0;
			TXSTAbits.TXEN=1;
			RCSTAbits.CREN=0;
			RCSTAbits.CREN=1;
		}
		else if(RCSTAbits.FERR == 1){				//Handling Framing error
			char dummy;
			dummy = RCREG;
			TXSTAbits.TXEN=0;
			TXSTAbits.TXEN=1;
		}
		else{										//If message is recieved correctly then process this data
			USART_Receive(byteReceieved);
		}

Can any body help me,
Thanks in advance
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top