interrupt problem

Status
Not open for further replies.

Tong

New Member
hi every one, i am actually using the Mikroc as my compiler, and now i am doing the receive UART interrupt. however i just manage to jump to ISR but does any one know how to return from the ISR? Previously i use the hardware interrupt which just clear the INTCON.INTF bit then it will return, yet this time the UART interrupt i clear the PIR1.RCIF and RCREG, it wont work, i really dont know what happen? thanks in advance for the helping hand.
 
The RCIF flag is cleared automatically when you read the RCREG ... you need just the return.
 
Try this -


Code:
unsigned char RXDATA;

void interrupt isr (void)
{
         if (PIR1.RCIF)
         {
                RXDATA = RCREG;
         }

}

Placing the received data from RCREG into variable RXDATA should clear the RCIF flag.
 
Last edited:
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…