Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Add support for CHANGE mode on attachInterrupt #229

Open
GeneApperson opened this Issue May 31, 2012 · 5 comments

Comments

Projects
None yet
2 participants
Contributor

GeneApperson commented May 31, 2012

This can be done by toggling the 'edge' bit in the interrupt control register each time an interrupt is taken.

Solved:
http://demolishun.net/chipkit/change_notification/

The example PDE should explain how to use this.

I also explained a bit here:
http://www.chipkit.org/forum/viewtopic.php?f=7&t=1382

Contributor

GeneApperson commented Jun 7, 2012

Sorry, but what you have done doesn't appear to have anything to do with what this Issue is about. It isn't about implementing pin change interrupts, it is about implementing the CHANGE mode on attachInterrupt. These are completely different things.

Okay, I see what you are trying to do. However, there are 17 (correction) interrupt on change pins available with the changes I made. Rather than trying to force the edge triggered pins to do change on interrupt why not use the hardware the way it is designed. There are only 5 edge triggered pins currently implemented. You will also run into timing issues and miss interrupt events if they are too quick for the interrupt handler to catch. It would not be hard to implement, but I think it would diminishing returns.

Contributor

GeneApperson commented Jun 7, 2012

Because that's not the way attachInterrupt works on an Arduino board. The goal is to make it work the way it does on Arduino. What you have done is a completely new feature. It would be good to have support for pin change interrupts, but that isn't what this was about.

Gene

-----Original Message-----
From: Demolishun [mailto:reply@reply.github.com]
Sent: Thursday, June 07, 2012 11:31 AM
To: Gene Apperson
Subject: Re: [chipKIT32-MAX] Add support for CHANGE mode on attachInterrupt (#229)

Okay, I see what you are trying to do. However, there are 19 interrupt on change pins available with the changes I made. Rather than trying to force the edge triggered pins to do change on interrupt why not use the hardware the way it is designed. There are only 5 edge triggered pins currently implemented. You will also run into timing issues and miss interrupt events if they are too quick for the interrupt handler to catch. It would not be hard to implement, but I think it would diminishing returns.


Reply to this email directly or view it on GitHub:
#229 (comment)

Alright, when I get a chance I will see what it takes to do that as well. My head is in the game right now, so it would be a good time to do this. It will have to store the state of it being a CHANGE interrupt pin somewhere. Like a mask. That way when it interrupts it will look at that mask and if it is set then it will toggle the interrupt bit to be the other edge. Now that I have had a chance to mull it over it really is a good change. You might even be able to simulate edge triggering on the change notification pins as well. Like with the other pins simulating a change pin it will have a frequency limitation.

Just so you know right now the changes I added require you to use the constant CHANGE or CHANGE_PULLUP using the attachInterrupt function.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment