• 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.

pic18fxx and interupt

Not open for further replies.


New Member
i studied Pic 18f458 interupts.
i use
1-#pragma interrupt chk_isr
void chk_isr(void)
2-#pragma code my_HiPrio_int=0x08
void my_HiPrio_int(void)
3-#pragma code
void main()

please tell me why we use it.

Ian Rogers

User Extraordinaire
Forum Supporter
Most Helpful Member
The correct way to declare an interrupt in C18 is:-

#pragma code InterruptVectorHigh = 0x08
This instructs the compiler to the CODE section at address 0x08 ( low interrupt vector )
void InterruptVectorHigh (void)
    goto InterruptHandlerHigh //jump to interrupt routine
This places the new vector in that code space (InterruptHandlerHigh can be any function identifier )

Now vector 0x08 in code will hold the jump call to YOUR interrupt routine.

#pragma code
#pragma interrupt InterruptHandlerHigh

void InterruptHandlerHigh ()
         // your code here...
The final piece, is a function in CODE space that contains the code that needs executing when a interrupt is fired.
Not open for further replies.

Latest threads

EE World Online Articles