• 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 program the PIC Interrupt?

Status
Not open for further replies.

matasoft

New Member
If an interrupt occurs then what code it will execute?
Where can I write the code for the interrupt?
Will I use it like I use a CALL command, like this:

INT:
<code>
RETFIE

:?: :?: :?:
 

Exo

Active Member
your using assembler?

Then interrupt vector is adress 0x0004. So when interrupt occurs the pic will jump to this adress. You can force code to this adress with the org command

ORG 0x0004
;context saving

;Your interrupt code

;context restoring
RETFIE

As a result your program entry (the program start, at adress 0) should contain a jump over the interrupt vector within the first 4 instructions
 
Status
Not open for further replies.

Latest threads

EE World Online Articles

Loading
Top