Quote Originally Posted by w7ami View Post
Help! I want to use multiple external interupts and perform different functions depending upon which interupt was triggered. From reading the green book and the product manual I can't see how to do this. Can someone give me a push in the right direction. I am using a PIC18F4620.
Terry
If you use the 'On Interrupt' function, when you get into the 'On Interrupt' loop, you have to check the individual interrupt flags that you've enabled.
In the case of using TMR0-overflow interrupt...
1) You set up the TMR to run at whatever rate you want (timer prescaler, timer source, etc)
2) Enable global interrupts
3) enable the timer interrupt
4) When the overflow interrupt fires (i.e. tmr0 counted from 255 and rolled over to 0), 'On Interrupt' fires...
5) The code inside the 'On Interrupt' looks at the TMR0-OverFlow Interrupt flag. If it's set (or reset depending on which interrupt you're using), that particular interrupt caused the interrupt.
6) Then (most likely) you have to reset the particular interrupt flag that you checked
7) Execute your interrupt code accordingly
8) RESUME your normal code

What, in particular, were you lookingfor? Just playing around?
I use 'On Interrupt' a lot, only because I believe I understand it well enough to overcome it's limitations.
There are a couple of much faster, more flexible interrupt routines on this forum. They deal somewhat with assembly, macros, etc. They aren't that hard to use. I believe they are the way to go if you're looking for something time critical.