im confused about the setting of the interruprt flag i.e,bit 1 of intcon register for using xternal interrupts......i wanna know where it should b cleared...shud i clear it inside the isr itself? i,e. before retfie?....or else where and how should i clear it...
i tried clearing it just before retfie in isr....the program worked when simulated but found that it is hanging on to the last instruction for a long time.....that is it is taking much time to return to main code......
sme one give an explanation..........
im confused about the setting of the interruprt flag i.e,bit 1 of intcon register for using xternal interrupts......i wanna know where it should b cleared...shud i clear it inside the isr itself? i,e. before retfie?....or else where and how should i clear it...
Ya, clear it just before the retfie (unless you have some reason to re-enable it earlier). Just use something like
Code:
bcf INTCON,INT0IF
Just an example. Happens to be bit-1 of INTCON in a 16F88 that I have in front of me. Replace INT0IF with whatever bit you need in the PIC you're working with.
i tried clearing it just before retfie in isr....the program worked when simulated but found that it is hanging on to the last instruction for a long time.....that is it is taking much time to return to main code......
sme one give an explanation..........
I can't explain that one. Maybe a bug of some sort? Are you "stacking"/"unstacking" W, STATUS and, if necessary, PCLATH? If you don't, bad things will happen.