I see into the Arduino Mega2560 specification that the Interrupts INT0, INT1, INT2 and INT3 have a line over the name (like a negative sign), the same indication is not present for the INT4 and INT5.
The two "groups" have different behaviors in particular coding circumstances?
The INT2 and INT3 are related to the (Serial1 RXD1/TXD1), are affected in case of serial communication for the Serial Monitor? It's true that the Serial Monitor is related to the Serial0 RXD0/TXD0 (pin D0 and D1) ?
The processor data sheet is the very best source of information about all aspects of the MCU. If you are interested in using interrupts, you must read the section on the individual interrupt pins very carefully, as they have different capabilities, especially where wake/sleep states are concerned.
Most pins have several mutually exclusive functions, and only one function can be used at any one time.
They are very different. ATmega2560 data sheet, page 112:
Note that recognition of falling or rising edge interrupts on INT7:4 requires the presence of an I/O clock, described in “Overview” on page 40. Low level interrupts and the edge interrupt on INT3:0 are detected asynchronously.
I ask to all of you to be patient, I'm able to program but my knowledge of the microprocessor is not so good. The "nomenclature" of the datasheet is focused on the micro-controller, and for who like me that are not so familiar with this world, sometimes is difficult to do the correlation with the usage of it into a develop shield. But stop this crying and go work.
if I have understood there are two different groups of interrupts:
group 1 : asynchronous (INT0, INT1, INT2 and INT3)
group 2 : requires an I/O clock (INT4 and INT5)
Now new doubts :
first)
For the interrupts that require a clock, How I can give a clock signal, using another pin?
If yes, how define it if the programming references is "attachInterrupt(digitalPinToInterrupt(pin), ISR, mode)"
second)
But, an external clock "in someway" is not like an "external interrupts", I 'm not sure to have transfer what i mean.
third)
The datasheet indicates that the "EICRB" (External Interrupt Control Register B) manage 7 interrupts, but with the Arduino shield we just can use 5, it's correct?
Sorry, I should have explained the ramifications of the difference in practical terms. I hinted to it in post #2.
External interrupts are often used to wake the processor from deep sleep to process external events, and INT0-INT3 are capable of doing so if a rising or falling edge is detected.
As mentioned above, INT4-7 are not, which makes them less useful.
If you don't study the data sheet and aren't aware of the details, your program will fail in unexpected ways.
If the processor doesn't need to sleep and then be awakened by a rising or falling edge, it probably doesn't matter which external interrupt you choose.
I say "probably" because each new interrupt application requires you to carefully study the data sheet and choose suitable hardware configurations.
Can you do a simple practical example where the processor go in sleep?
Jut to be aligned with my current experiment of reading the water flow, I don't think to have sleep status, or probably not conscious of it.
Battery powered projects do this to greatly extend battery life. The MCU wakes up to process a measurement, store or send the data somewhere, then goes back to sleep. Power savings can be million-fold.