I want to use pin change interrupt on my mega board. I mean specifically, the those referred to by Atmel as PCINT0 PCINT1 and PCINT2 branching to vectors 0x12, 0x14, 0x16.
For the regular interrupts, one uses attacheinterrupt(pin, isr_name, mode) but in this case it's not a pin but rather ports B, E, J and K. Also, how do i mask pins of the ports to filter off from my isr things like the serial and the spi (used by ethernet)
doesnt the executing code do just that? I doubt the processor ever feels fun
Yes, but suppose that the Arduino team had decided that digitalRead() was going to be called f123() and analogRead() was going to be f124() and digitalWrite() was f125() and analogWrite() was f322145().
Pretty confusing knowing what a function named f123() is supposed to do, isn't it?
It isn't at all obvious what process() does. Is process a verb? Or is it a noun?
ISR(PCINT0_vect)
{
...
// Code to handle the event.
}
ISR(PCINT1_vect, ISR_ALIASOF(PCINT0_vect));
Which is explained as
Two vectors sharing the same code
In some circumstances, the actions to be taken upon two different interrupts might be completely identical so a single implementation for the ISR would suffice. For example, pin-change interrupts arriving from two different ports could logically signal an event that is independent from the actual port (and thus interrupt vector) where it happened. Sharing interrupt vector code can be accomplished using the ISR_ALIASOF() attribute to the ISR macro:
PaulS:
Yes, but suppose that the Arduino team had decided that digitalRead() was going to be called f123() and analogRead() was going to be f124() and digitalWrite() was f125() and analogWrite() was f322145().