Skip to content
Blink Maker edited this page Jul 11, 2019 · 5 revisions

What's New?

Mon Mar 23 06:32:22 CDT 2015 This project's home is here on Github!

I'm considering deprecating this library in favor of a new one that encompasses all interrupt types. Please take my survey at https://www.surveymonkey.com/s/CJVMX3P . Thanks!

Latest version: Here on Github. Get a zipped archive on Bintray: https://bintray.com/greygnome/generic/PinChangeInt/view

The PinChangeInt library implements Pin Change interrupts for the Arduino environment. This library was designed for the Arduino Uno/Duemilanove/Mega 2560/Mega ADK. It will likely work with other ATmega328- or ATmega168-based Arduinos; it has been reported to work just fine on the Nano. It will not work on ARM-based Arduinos, but then, attachInterrupt() is a complete solution there.

What are Pin Change interrupts? The ATmega328p processor at the heart of the Arduino has two different kinds of interrupts: “external”, and “pin change”. There are only two external interrupt pins, INT0 and INT1, and they are mapped to Arduino pins 2 and 3. These interrupts can be set to trigger on RISING or FALLING signal edges, CHANGE, or on LOW level. The triggers are interpreted by hardware.

On the other hand the pin change interrupts can be enabled on many more of the Arduino's signal pins (all pins on the ATmega328). They trigger on CHANGE (ie, both RISING or FALLING signal edges), so it is up to the interrupt code to determine the proper pins to support an interrupt, to determine what happened (which pin? ...did the signal rise, or fall?), and to handle it properly. Furthermore, the pin change interrupts are grouped into “Port”s on the MCU, so there are only 3 interrupt vectors (subroutines) for the entire body of 20 pins. This makes the job of resolving the action on a single pin even more complicated, and it means that there is a bit of time between the signal change and the library determining which pin and if the sketch is interested.

The PinChangeInt library is designed to handle the Arduino's pin change interrupts as quickly, easily, and reasonably as possible.

Version 1.4 (and later) puts all the code in the .h file, to allow the programmer to configure it through their sketch for minimum ram usage, and so the library can be used by other libraries.

See the Wiki pages for more information.

Clone this wiki locally