help! PIC USART interrupt problem!

Status
Not open for further replies.

kerden

Junior Member level 3
Joined
Dec 11, 2004
Messages
25
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
284
My problem as follow.and i emluator in ICD2, the progam can send out the data. but it can't receive any data, and it can run into the interrupt.
what's wrong?
thank you!

Code:
void init_com()
{
	SPBRG = 0x23;  
	TXSTA = 0x04;   
	RCSTA = 0x90;  
	TRISC = 0x80;
	INTCON |= 0xc0;  
	PIE1 |= 0x20;   
}

main()
{
	init_com();
	while(1);	
}

void interrupt Data_Rec(void)
{
	if(RCIF)   
	{
		data = RCREG;
	}
}
 

Hi Kerden,

I could probably help you on this, but I need to know which PIC you use... There's a lot of different versions out there!

cyberblak
 

cyberblak said:
Hi Kerden,

I could probably help you on this, but I need to know which PIC you use... There's a lot of different versions out there!

cyberblak


thank you !
i use pic16f877 chip.
 

hi

I used pic 16f877 the problem what ur saying i understood i think u r doing some mistake in ur code itself u assigned the RCREG to a variable data but where did u call it in main and that the function in main u check whether it is always polling data or not
ram
 


thank you!
but why i can receive the data?
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…