Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

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.

Latest threads

New Articles From Microcontroller Tips

Back
Top