Quote:
|
Originally Posted by Alan Anderson
It's not hard, but you do have to know what you're doing to get it right.
We're using three encoders. Two of them are on pins 1&7 and 2&8, using essentially Kevin's code. The third is on pins 3&9, with a few lines of interrupt initialization and service routine copied from Kevin's interrupts.c to dispatch the third encoder's handler when INT4 occurs. There is also an extra check to call the handler only when INT4 was triggered by a falling edge of the signal on pin 3. (That part of the code seems a little inconsistent, as if the input pin were going low and then high again before we had a chance to look at it. I'm considering wiring in a hardware pulse-stretch circuit to deal with it.)
To avoid extra interrupts that we would just have to ignore, we have nothing connected to pins 4-6.
|
hi, I tried doing the same thing, but I ran into problems because interrupts 3-6 are "ganged together". how do I reference one at a time? I couldn't figure out how to clear the interrupt flag either. basically, are there any magic lines of code to access one instead of all 4. we're going to need a third interrupt also (the arm), and since our team is pushing the building to the last minute, I can't afford have code messing up too much. thanks.