How to write code in Address 0x0008? (Interrupt Vector)

Status
Not open for further replies.

electroRF

Member
Hi

I'm using PIC18F4520, with MPLAB IDE, XC8 Compiler.

I wanna write code for ISR, at address 0x0008.

How do I do that?

Thank you.
 
If you write..

C:
void interrupt ISR()
   {
    // High by default
   }
Or low priority
C:
void low_priority interrupt ISR()
   {
    // Low as required..
   }

I haven't used / tested this... This is from the manual..
 
A rewrite.... I hate giving code untested,,,, So I wrote this to test

C:
#include<xc.h>
volatile int x;

void interrupt low_priority ISRL()
    {
    x = 2;
    INT1IF = 0;  // cancel button 1 press
    }
  
void interrupt ISRH()
    {
    x = 1;
    INT2IF = 0;  // cancel button 2 press
    }
  
void main(void)
    {
    IPEN = 1;   // Interrupt prority set,,,
    ADCON1 = 0xF;  // PORTB ADC off
    INTCON3 = 0x98;  // set interrupt priority to INT1 and INT2
    INTCON = 0xC0;    // GIEH and GIEL set
    while(1)
        {
        }  
    }

This DOES work...
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…