Go Down

Topic: PinChangeInt library- To attach interrupts to multiple Arduino (Uno/Mega) pins (Read 21 times) previous topic - next topic


Version 1.71beta is now available for upload.  From the Release Notes:

Code reordering: Starting in version 1.3 of this library, I put the code that enables
    interrupts for the given pin, and the code that enables Pin Change Interrupts, ahead of actually
    setting the user's function for the pin.  Thus in the small interval between turning on the
    interrupts and actually creating a valid link to an interrupt handler, it is possible to get an
    interrupt.  At that point the value of the pointer is 0, so this means that the Arduino
    will start over again from memory location 0- just as if you'd pressed the reset button.  Oops!

    I corrected it so the code now operates in the proper order.
    (EDITORIAL NOTE:  If you want to really learn something, teach it!)

    Minor code clean-up:  All references to PCintPort::curr are now explicit.  This changes the compiled
    hex code not one whit.  I just sleep better at night.

    Numbering:  Changed the numbering scheme.  Beta versions will end with an odd number in the hundredths
    place- because they may be odd- and continue to be marked "beta".  I'll just sleep better at night. :-)


I have stuck a fork in the beta version 1.71 and called it "DONE!".  Thus, the release version 1.72 is now available.  There are no code changes since the 1.71beta release.

Also I uploaded a new version of the Speed Tests document.


PinChangeInt Library version 1.81beta has now been released.  It adds MEGA support, for the ATmega1280 and its brethren.  See http://code.google.com/p/arduino-pinchangeint/

From the release notes:

To sum it up for the Mega: No Port C, no Port D. Instead, you get Port J and Port K. Port B remains. Port J, however, is practically useless because there is only 1 pin available for interrupts. Most of the Port J pins are not even connected to a header connector. Caveat Programmer.

From cserveny's (the author of the MEGA stuff) notes:

Mega and friends are using port B, J and K for interrupts. B is working without any modifications.

J is mostly useless, because of the hardware UART. I was not able to get pin change notifications from the TX pin (14), so only 15 left. All other (PORT J) pins are not connected on the Arduino boards. If you can verify this for me, I would love to know for user. Please send me an email or post to the bug reports section. Thanks. -Ed

K controls Arduino pin A8-A15, working fine.

328/168 boards use C and D. So in case the lib is compiled with Mega target, the C and D will be disabled. Also you cannot see port J/K with other targets. For J and K new flags introduced:


My MEGA changes have not been tested.  The library compiles and runs on my Duemilanove, but I don't have an Arduino Mega.  I would appreciate feedback.  Thanks.
- GreyGnome


June 28, 2012: Version 2.01beta has been released! I had a brainstorm and modified how the ISR loops over the list of possible pins, thereby saving 2 microseconds in the ISR. Look at the notes for the download (here:  http://code.google.com/p/arduino-pinchangeint/downloads/detail?name=pinchangeint-v2.01beta.zip) or read the VERSIONS section of PinChangeInt.h for more information.



Two microseconds ? That's a huge gain in performance, well done. I am off to read what you have done now.

Thanks for your continued work on the library, as you might have seen before I use it a lot.

Duane B


Go Up