Problems with Microcontroller Projects? You may face many Problems, but do not worry we are ready to solve your Problems. All you need to do is just leave your Comments. We will assure you that you will find a solution to your project along with future tips. On Request we will Mail you the Codes for Registered Members of this site only, at free service...Follow Me.

How To Program PIC Microcontroller Interrupt in C

We were using polling technique before in which we were waiting for some event to happen, so in that way we were consuming a lot of CPU time by keeping CPU. But in Interrupt method we can do other work and when interrupt happens we may serve that interrupt according to it’s need or importance. 
PIC Microcontroller has following types of Interrupt-

  1. Timer Interrupt
  2. Serial Interrupt
  3. External Interrupt
  4. Port B Interrupt
In all these Interrupts you 1st need to check if an interrupt occurred, then you need to check which type of Interrupt occurred and you need to write Interrupt Subroutine
The following steps are same in this type of Interrupt–
  1. Assign Interrupt to that location where it has Highest Priority(0×08) and when interrupt occurs Program Counter should jump to that location(0×08)
    #pragma code in=0×08
    in()
    {
    _asm
    GOTO chk
    _endasm
    }
    #pragma code
  2. Check which type of Interrupt Occurred and Jump to that Interrupt Subroutine
    #pragma interrupt chk
    void chk()
    {
    if(INTCONbits.TMR0IF==1)
    T0();
    if(PIR1bits.TMR1IF==1)
    T1();
    }
    You can download Interrupt files from here…. ENJOY……

No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...

Recent Comments

Popular Projects

Give Support

Give Support
Encourage Me through Comments

Microcontroller Projects

Total Pageviews