interrupt feature on pic16f877a

Status
Not open for further replies.

raviram87

New Member
i am working with a PIC16f877a type uC... i want to use the interrupt feature for my project...

it is mentioned in the datasheet that when an interrupt is responded to, the PC is loaded with the address 0004h....

but this location also contains the FSR register... what exactly happens here?
and if in my code, i use the following,

org 0x04 ; control comes here on encountering an interrupt

intsrvc: ; my interrupt service routine
// some actions

can this be the correct way to service the interrupt?
 
The pics have seperate program and data memory. The PC always reads the flash memory and all other read/writes are to data memory (SFRs).

That is the correct way to service an ISR.

Mike.
 
Leaving ISR correctly

It's worth to note that after "some actions" you should:

a) reset the flag that triggered the interrupt and

b) leave with RETFIE

BTW, give a careful read to your datasheet. It's well explained. If so, you would be not asking this question.

Buena suerte.
 

Plus a host of others as usual:

1. Setting the global.
2. Setting peripheral.
3. Setting the actual.
4. Clearing the flag before setting any of the above.
5. Saving W and Status.
6. Returing W and Status.
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…