Interrupts - UNO vs MEGA

Do the pin change interrupts have different vector (names) on the UNO versus MEGA?

I have code that works on the UNO using PCINT2_vect. But the code is not working on the MEGA. If they are different, where would I find the documentation of those on the MEGA (as it would appear that I only have UNO documentation).

Page 101

surepic:
http://ww1.microchip.com/downloads/en/devicedoc/atmel-2549-8-bit-avr-microcontroller-atmega640-1280-1281-2560-2561_datasheet.pdf

Page 101

Did Arduino use those names?

Any immediate thoughts as to why the code works on an UNO and not on a MEGA?

adwsystems:
Any immediate thoughts as to why the code works on an UNO and not on a MEGA?

Why don't you ask someone how has seen the code?

Whandall:
Why don't you ask someone how has seen the code?

How about a useful comment? It is a general question at this time. I am asking the group to confirm if there is anything that must be done in regards to interrupt vectors to get the same code to work on a MEGA that works on an UNO.

On uno pcint2 is on different pin than on mega. Try pin 51

surepic:
On uno pcint2 is on different pin than on mega. Try pin 51

Ding ding ding. We may have a winner.

PCINT2_vect applies to a group of pins, Arduino pins D0-7. To what group of pins does PCINT2 apply on the MEGA? (I'm reviewing the ds now but you may know off the top of your head).

Corollary, what interrupt vector is for pin change interrupts on Arduino pins D0-D7 of the MEGA?

Im sure it applies only to 1 pin not group. Thats why i think they call it pin change interrupt but not group change interrupt.

Better formated at GitHub - GreyGnome/PinChangeInt: Pin Change Interrupt library for the Arduino

The following pins are usable PinChangeInt pins on the Mega (ATmega1280 and
ATmega2560-based Arduinos**):

Arduino Arduino Arduino
Pin* PORT PCINT Pin PORT PCINT Pin PORT PCINT
A8 PK0 16 10 PB4 4 SS PB0 0
A9 PK1 17 11 PB5 5 SCK PB1 1
A10 PK2 18 12 PB6 6 MOSI PB2 2
A11 PK3 19 13 PB7 7** MISO PB3 3
A12 PK4 20 14 PJ1 10
A13 PK5 21 15 PJ0 9
A14 PK6 22
A15 PK7 23
...indeed, the ATmega2560 chip supports many more Pin Change Interrupt pins but
they are unavailable on the Arduino, unless you want to solder teeny tiny wires.

  • Note: Arduino Pin 0 is PE0 (PCINT8), which is RX0 and thus is not supported by
    this library. It is the same pin the Arduino uses to upload sketches, and they
    are connected to the FT232RL USB-to-Serial chip (ATmega16U2 on the R3).
    ** On the MegaADK, according to http://arduino.cc/en/Main/ArduinoBoardMegaADK:
    "USB Host: MAX3421E. The MAX3421E comunicate with Arduino with the SPI bus. So
    it uses the following pins:
    Digital: 7 (RST), 50 (MISO), 51 (MOSI), 52 (SCK). NB: Please do not use Digital
    pin 7 as input or output because is used in the comunication (sic) with
    MAX3421E "

Its clearly written in datasheet pin 51 for pcint2

surepic:
Its clearly written in datasheet pin 51 for pcint2

Then what is PCINT2_vect on UNO? Furthermore I need the equivalent on UNO.

I'll give you a hint.
Gammon's Interrupts

Should be pin 10 cant open datasheet from microchip now its redirecting forever

surepic:
Should be pin 10 cant open datasheet from microchip now its redirecting forever

It's not. It's not for a single pin. Check Nick's website, linked previously.

328 datasheet

Does this link work for you?

Yes its pin10

surepic:
Yes its pin10

You are looking at PCINT2. I'm asking about PCINT2_vect. See datasheet section 12.4 pdf page 74.

It doesn't matter. The reply from @Whandall is the middle of the answer. The end of the answer is, there are no pin change interrupts available on the MEGA that correspond to UNO pins D0-D7. The final outcome is that I have to build a completely different shield and add a whole lot of ifdefs to be able to swap between the MEGA and the UNO. The fact is the MEGA and the UNO are just too different.

Now i see what u mean. You have to enable the coresponding bit in pcmsk register then use use pcint2_vector.

surepic:
Now i see what u mean. You have to enable the coresponding bit in pcmsk register then use use pcint2_vector.

It's a triple lookup. Arduino to Atmega pin, then Atmega pin to PCINT pin, PCINT pin to PCINT vector. When it's all done, I'm SOL because none of the pins in D2-D7 are PCINT capable.

It sounds like its my fault.

surepic:
It sounds like its my fault.

Why? Did you design the Arduino or the ATMEGA chip?