Open GoogleCodeExporter opened 9 years ago
You cannot set 2 interrupt vectors to a single pin... it's one or the other. So
you can interrupt on FALLING, *or* RISING, *or* CHANGE. I have created a
modification of your program, attached a switch to pin 5 (which is still PORT
D), and observed the printed output. All looks proper; it interrupts on rise or
on fall and prints the counts properly.
To do what you want to do, you need to: 1) interrupt on CHANGE, and 2) observe
the pinState in your interrupt routine by checking PCintPort::pinState. If it
is HIGH, your change was RISING. If it is LOW, your change was FALLING. So
you'll have a single interrupt routine with an if statement in it.
Original comment by m...@schwager.com
on 4 Apr 2013 at 3:00
Attachments:
Thank you very much for that. It allows me to do what I want to do.
However I do not think it explains why I see 2 FALLING interrupts when ther was
I believe only 1.
Alan
Original comment by alantjoh...@gmail.com
on 4 Apr 2013 at 7:43
I don't know, but the first step with troubleshooting is to make sure you're
working within the proper parameters. Because you were trying to attach two
interrupts to the same pin, I think the problem starts in the code you were
creating.
My code demonstrates that the library is able to distinguish between rising and
falling. If you continue to have a problem, then the shortest way to get to a
solution is to strip out all nonessential code and illustrate the problem. One
thing: are you doing a digitalWrite(pin, HIGH) to turn on the pullup resistor?
Original comment by m...@schwager.com
on 4 Apr 2013 at 12:59
I am not writing to the pin.
I am forced to conclude that the spidev module in Python is sending an extra
SS low/SS high signal with no data after each data burst.
Original comment by alantjoh...@gmail.com
on 5 Apr 2013 at 6:43
You need to do a write to the pin to enable the pullup resistor... even if the
pin's mode is set as input.
One thing you can do is interrupt on CHANGE, and in your loop() report on every
interrupt. Use the millis() function to report on the actual time between state
changes. Make sure the system's response is what you expect.
Original comment by m...@schwager.com
on 8 Apr 2013 at 12:37
I'll leave this up for another week or so unless there are further updates to
the problem. Then I will close it.
Original comment by m...@schwager.com
on 13 Apr 2013 at 4:16
Original issue reported on code.google.com by
alantjoh...@gmail.com
on 3 Apr 2013 at 6:44Attachments: