> is using interrupts the way to go on this ?
Not necessarily. You may be making life more complicated as you still have to work out what and how many pins have caused the interrupt. Remember that an interrupt isn't serviced until the current command has executed, so by the time you get to looking at the interrupt flag, you may miss the pulse on the next pin. If both pins are going to cause an interrupt, then the interrupt flags WON'T tell you that they happened simultaneously.
You need to AND the two pulses together and then trigger an interrupt. This will work, but remember the delay between completion of the last command being executed and servicing the interrupt.
If you use a PIC with comparators, and both pulses are the same level, then you can use those instead of any external AND gates. If the pulses are not the same level then you can still use the comparators but a little more magic is needed.
Finally, if you want to stop your processor dead, IMMEDIATELY, then the AND gate (or Comparator) connected to the MCLR pin is the way to go...




Bookmarks