How to write interrupt priority in C for PIC16F727

Status
Not open for further replies.

helloleong

New Member
The PIC16F727 does not have interrupt priority it self

So my code have 3 interrupt, and the simplified code are as below

Code:
void interrupt isr(void)
{
     if (RBIE && RBIF && (~PORTB & 0x30)){...}

     if (SSPIE && SSPIF) { SSPIF = 0;}

     if (T0IE && T0IF)
     {
         //If the processor servicing Timer 0 interrupt,
         //and at the same time PORTB interrupt occur.

         //How can I immediately exit this if statement
         //and service PORTB interrupt immediately?
         ...
     }
}

I have to set PORTB interrupt as high priority to capture the wiegand data.
Some time the 1st wiegand data was miss.
If I take out the Timer 0 interrupt if statement, all wiegand data are able to be fully capture.
So how can I immediately exit this if statement and service PORTB interrupt immediately?

Thank you very much.
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…