-->
Page 1 of 1

Pin Interrupts

PostPosted: Sat Jul 16, 2016 3:17 pm
by Oldbod
Just wondering how these are handled? If they're true interrupts, or if they're done by software polling pin states, or if a true interrupt sets a flag picked up by a software routine.

I'm asking because I'm wondering if any transitions might be missed if they occur when another interrupt is being processed....

Re: Pin Interrupts

PostPosted: Sat Jul 16, 2016 4:56 pm
by Mmiscool
Pins set as an interupt are polled each time the esp exicutes a line. It will trigger the actual interupt when the esp is in a wait state. It is posible that the pins state could change between when it detected the interup and when the branch is run. A true interupt will not work so well with an interperted language.

Re: Pin Interrupts

PostPosted: Sat Jul 16, 2016 5:24 pm
by raintime
Hmmm, I would hope that an interrupt pin would not be polled, but when an interrupt occurs, would instantly set a flag. Then, when esp executes the next line, the flag would be checked to see if the interrupt occurred. And the flag would then be reset. I think that's what you are already doing. No missed interrupts.

Also, to make things better, if when an interrupt occurs, if that flag was already set, this would be a double interrupt, which could raise an error, or a counter could be incremented that the user could check to see how many of those specific interrupts occurred. (But this is not so easy to do.)

It might also be great if at least one interrupt could read a (microsecond) timer that the user could set to zero when desired, and then could see exactly when the interrupt occurred..

Re: Pin Interrupts

PostPosted: Sun Jul 17, 2016 2:41 am
by Oldbod
Thanks for the replies. I now feel guilty because I'm sure I've already read this or much of it in the documentation.

I guess much of if this is ever likey to be an issue depends on how fast changes occur and how code is written plus how fast the hardware is. Im going to think a bit more about this, thank you again for now. :-)