Serial transmission/ reception using interrrup

Status
Not open for further replies.

JeffreyPeter

New Member
Hi, This is an serial interrupt code that should not execute while serial transmission but should execute while receiving data. It simulates fine in proteus but on actual hardware implementation, it hangs it is not transmitting data. Please help me debug this code.
Thanks in advance
Code:
void serial_receive() interrupt 4
{
	if(TI==0) // so that it does not execute while transmitting....
	{
		while(RI==0);// non zero character recived
		serial_get=1;
		RI=0;
	}
	
}
 
The only place it can hang is at the " while(RI == 0) " Since The interrupt has already occured, I should leave this out...

Only include "RI = 0;" at the end of the interrupt...
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…