Hi all,in ARDUINO documentation they say that interrupt 0 (INT0) is attached to pin 2 in the ARDUINNO MEGA*: http://arduino.cc/en/Reference/AttachInterruptBUT, in the following page, they say show INT0 as being attached to pin 21:http://arduino.cc/en/uploads/Main/arduino-mega2560-schematic.pdfI know that INT0 is not related to pin 21 because I have tested and concluuded that, in reality, pin 21 it is related to INT2. I ask if this difference is "by design", or if is some documentation flaw.Please advise.Thanks.-SR
INT0,1,2,3 are physical pins 43,44,45,46 on the ATMega2560. D21,20,19,18 on the Mega2560 schematic.
Most Arduino boards have two external interrupts: numbers 0 (on digital pin 2) and 1 (on digital pin 3). The Arduino Mega has an additional four: numbers 2 (pin 21), 3 (pin 20), 4 (pin 19), and 5 (pin 18).
sketch interrupt number arduino pin number 0 2 1 3 2 21 3 20 4 19 5 18
Arduino software is redefining the ATMega2560 INTs into its own numbering it seems:Phsyical INT4 -> Arduino INT0Physical INT5 -> Arduino INT1Physical INT0 -> Arduino INT2Physical INT1 -> Arduino INT3Physical INT2 -> Arduino INT4Physical INT3 -> Arduino INT5
attachInterrupt(0, blink, CHANGE);
Input and OutputEach of the 54 digital pins on the Mega can be used as an input or output, using pinMode(), digitalWrite(), and digitalRead() functions. They operate at 5 volts. Each pin can provide or receive a maximum of 40 mA and has an internal pull-up resistor (disconnected by default) of 20-50 kOhms. In addition, some pins have specialized functions: Serial: 0 (RX) and 1 (TX); Serial 1: 19 (RX) and 18 (TX); Serial 2: 17 (RX) and 16 (TX); Serial 3: 15 (RX) and 14 (TX). Used to receive (RX) and transmit (TX) TTL serial data. Pins 0 and 1 are also connected to the corresponding pins of the ATmega8U2 USB-to-TTL Serial chip. External Interrupts: 2 (interrupt 0), 3 (interrupt 1), 18 (interrupt 5), 19 (interrupt 4), 20 (interrupt 3), and 21 (interrupt 2). These pins can be configured to trigger an interrupt on a low value, a rising or falling edge, or a change in value. See the attachInterrupt() function for details.
Please enter a valid email to subscribe
We need to confirm your email address.
To complete the subscription, please click the link in the
email we just sent you.
Thank you for subscribing!
via Egeo 16