electro-music.com   Dedicated to experimental electro-acoustic
and electronic music
 
    Front Page  |  Articles  |  Radio
 |  Media  |  Forum  |  Wiki  |  Links  |  Store
Forum with support of Syndicator RSS
 FAQFAQ   CalendarCalendar   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   LinksLinks
 RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in  Chat RoomChat Room 
 Forum index » DIY Hardware and Software » Arduino
Pin Change Interrupts library for Arduino
Post new topic   Reply to topic
Page 1 of 1 [3 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
Author Message
cappy2112



Joined: Dec 24, 2004
Posts: 2256
Location: San Jose, California
Audio files: 2
G2 patch files: 1

PostPosted: Wed Oct 10, 2012 9:12 pm    Post subject: Pin Change Interrupts library for Arduino Reply with quote  Mark this post and the followings unread

The Arduino has the ability to use almost every pin as a hardware interrupt, even though there are only 2 external interrupt pins on the ATMega 328.

The library is called Pin Change Interrupt library. I've only used it in a limited experiment, but it worked well enough.

Support has recently been added for the 2560.

This library identifies which pin was interrupted, your program can make decisions based on the pin #.

http://code.google.com/p/arduino-pinchangeint/

_________________
Free Tibet. Release the Panchen Lama from prison. Let the Dalai Lama return to his home.
Back to top
View user's profile Send private message
MusicMan11712



Joined: Aug 08, 2009
Posts: 738
Location: Upstate New York USA
Audio files: 148

PostPosted: Sat Oct 13, 2012 11:50 am    Post subject: Reply with quote  Mark this post and the followings unread

This sounds like it would save some time coding. I was looking at interrupts in the AVR reference and it would be handy to have some pre-written code to help identifying the source of an interrupt. Thanks for posting this.
Steve
Back to top
View user's profile Send private message
cappy2112



Joined: Dec 24, 2004
Posts: 2256
Location: San Jose, California
Audio files: 2
G2 patch files: 1

PostPosted: Sat Oct 13, 2012 12:04 pm    Post subject: Reply with quote  Mark this post and the followings unread

MusicMan11712 wrote:
This sounds like it would save some time coding. I was looking at interrupts in the AVR reference and it would be handy to have some pre-written code to help identifying the source of an interrupt. Thanks for posting this.
Steve


When you don't use this library, it's not a problem
identifying which pin was interrupted.

When the interrupt occurs, the ISR for that pin is called.

You register the ISR to be called for each pin, so you know which pin was interrupted, and there are only 2 external interrupt pins on the 328. I think there are 4 or 6 on the 2560, but again, each pin usually has it's own ISR.

The only time you need this library is if you want to use >2 external interrupt pins (for the 328), or 4 (or 6??) for the 2560.

I believe there is some speed penalty for using Pin Change interrupts, but
this may not be an issue for many applications.

_________________
Free Tibet. Release the Panchen Lama from prison. Let the Dalai Lama return to his home.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic
Page 1 of 1 [3 Posts]
View unread posts
View new posts in the last week
Mark the topic unread :: View previous topic :: View next topic
 Forum index » DIY Hardware and Software » Arduino
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum
e-m mkii

Please support our site. If you click through and buy from
our affiliate partners, we earn a small commission.


Forum with support of Syndicator RSS
Powered by phpBB © 2001, 2005 phpBB Group
Copyright © 2003 through 2009 by electro-music.com - Conditions Of Use