Pages: 1 ... 3 4 [5]   Go Down
Author Topic: PinChangeInt library- To attach interrupts to multiple Arduino (Uno/Mega) pins  (Read 18982 times)
0 Members and 2 Guests are viewing this topic.
0
Offline Offline
Jr. Member
**
Karma: 4
Posts: 93
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

After some time, I have updated the library. There is a significant fix submitted by jrhelbert which makes the two Port J pins work properly with the Mega. See http://code.google.com/p/arduino-pinchangeint/.

Downloads available at https://bintray.com/greygnome/generic/PinChangeInt/view

Bleeding edge source available at https://github.com/GreyGnome/PinChangeInt
Logged

0
Offline Offline
Jr. Member
**
Karma: 4
Posts: 93
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Note: I don't have a Mega, so I didn't test ports J and K. If you use it, please let me know if it works. Thanks.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 11
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Maybe somebody can help me?
I have this code, it is used to read a rotary encoder with an Arduino Uno. I want to make this work on an Arduino Mega.


Code:
  PORTC |= _BV(PORTC0) | _BV(PORTC1) | _BV(PORTC2) | _BV(PORTC3);   // enable pullup for pins
  PCMSK1 = _BV(PCINT8) | _BV(PCINT9) | _BV(PCINT10) | _BV(PCINT11); // enable button pin change interrupt A0 A1 A2 A3
  PCICR = _BV(PCIE1);
     

I can not find any help about converting this to a working Mega sketch. Can you help me?
Logged

0
Offline Offline
Jr. Member
**
Karma: 4
Posts: 93
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

First you have to study the Mega pinout and figure out which pins and ports are available to you. Have you done this?

It looks like you have two rotary encoders (4 pins total). Is that correct?
Logged

Pages: 1 ... 3 4 [5]   Go Up
Jump to: