Skip to main content
8 events
when toggle format what by license comment
Jul 1, 2015 at 1:36 comment added Nick Gammon @sachleen - regarding the minimum pulse size. It is hard to find a definite answer in the datasheet, but judging by the timing for pin-change interrupts, they are latched within half a clock cycle. Once the interrupt is "remembered" it stays remembered until the ISR kicks in and deals with it.
Dec 26, 2014 at 11:35 history bounty awarded Ricardo
Feb 26, 2014 at 21:21 comment added JRobert In addition to declaring shared globals volatile, if the global variable is wider than 1 byte, as someNumber is, you must protect against the pin-change interrupt occurring between byte accesses by the program. A statement like someNumber +=5; involves adding the low bytes and adding the high bytes with carry included. These two (more, for wider variables) must not be divided by an interrupt. Turning the interrupts off and restoring them before and after the operation (respectively) is sufficient.
Feb 25, 2014 at 15:14 vote accept Peter Bloomfield
Feb 20, 2014 at 5:13 comment added jfpoilpret +1 for this very detailed answer which includes all imortant stuff one must care about when using interrupts!
Feb 20, 2014 at 5:12 comment added jfpoilpret @sachleen That will work as long as it does not happen during the execution of an ISR function (as explained in the answer); that's why pinChanged() should be as short as possible. Hence typically the minimum time should be the time to execute the pinChanged() function itself.
Feb 20, 2014 at 4:02 comment added sachleen regarding the "brief pulses" mentioned in the question, is there a minimum time the pin must be at a state for it to trigger the interrupt? (obviously it'll be much less than polling, which depends on what else is happening in the loop)
Feb 20, 2014 at 0:42 history answered Peter Bloomfield CC BY-SA 3.0