There are two types of interrupts. What the Arduino Playground said:
The processor at the heart of any Arduino has two different kinds of interrupts: "external", and "pin change". There are only two external interrupt pins on the ATmega168/328 (ie, in the Arduino Uno/Nano/Duemilanove), INT0 and INT1, and they are mapped to Arduino pins 2 and 3. These interrupts can be set to trigger on RISING or FALLING signal edges, or on low level. The triggers are interpreted by hardware, and the interrupt is very fast. The Arduino Mega has a few more external interrupt pins available.
On the other hand the pin change interrupts can be enabled on many more pins. For ATmega168/328-based Arduinos, they can be enabled on any or all 20 of the Arduino's signal pins; on the ATmega-based Arduinos they can be enabled on 24 pins. They are triggered equally on RISING or FALLING signal edges, so it is up to the interrupt code to set the proper pins to receive interrupts, to determine what happened (which pin? ...did the signal rise, or fall?), and to handle it properly. Furthermore, the pin change interrupts are grouped into 3 "port"s on the MCU, so there are only 3 interrupt vectors (subroutines) for the entire body of pins. This makes the job of resolving the action on a single interrupt even more complicated.
Basically, the external interrupts are extremely fast since they're all hardware based. However, there is also the pin change interrupts, but those seem to be much slower because they are mostly software based.
tl;dr: the 20 interrupt pins together are much slower. The 2 interrupt pins are the fastest and most efficient.
EDIT: I just looked at the datasheet and it says that a pin change interrupt is triggered for any of the pins selected with no indication of which pin has changed (although it is split into three interrupt vectors).
- For external interrupts, it'll tell you pin 3 just changed
- For pin change it'll tell you a pin changed that you were monitoring!
As you can see, a pin change interrupt adds a lot of overhead into the ISR that you have to handle by storing previous states and seeing if it's the pin you're worried about. It might be fine for a sleep state, but it's better to use the external interrupts.
There are two types of interrupts. What the Arduino Playground said:
The processor at the heart of any Arduino has two different kinds of interrupts: "external", and "pin change". There are only two external interrupt pins on the ATmega168/328 (ie, in the Arduino Uno/Nano/Duemilanove), INT0 and INT1, and they are mapped to Arduino pins 2 and 3. These interrupts can be set to trigger on RISING or FALLING signal edges, or on low level. The triggers are interpreted by hardware, and the interrupt is very fast. The Arduino Mega has a few more external interrupt pins available.
On the other hand the pin change interrupts can be enabled on many more pins. For ATmega168/328-based Arduinos, they can be enabled on any or all 20 of the Arduino's signal pins; on the ATmega-based Arduinos they can be enabled on 24 pins. They are triggered equally on RISING or FALLING signal edges, so it is up to the interrupt code to set the proper pins to receive interrupts, to determine what happened (which pin? ...did the signal rise, or fall?), and to handle it properly. Furthermore, the pin change interrupts are grouped into 3 "port"s on the MCU, so there are only 3 interrupt vectors (subroutines) for the entire body of pins. This makes the job of resolving the action on a single interrupt even more complicated.
Basically, the external interrupts are extremely fast since they're all hardware based. However, there is also the pin change interrupts, but those seem to be much slower because they are mostly software based.
tl;dr: the 20 interrupt pins together are much slower. The 2 interrupt pins are the fastest and most efficient.
EDIT: I just looked at the datasheet and it says that a pin change interrupt is triggered for any of the pins selected with no indication of which pin has changed (although it is split into three interrupt vectors).
- For external interrupts, it'll tell you pin 3 just changed
- For pin change it'll tell you a pin changed that you were monitoring!
As you can see, a pin change interrupt adds a lot of overhead into the ISR that you have to handle by storing previous states and seeing if it's the pin you're worried about. It might be fine for a sleep state, but it's better to use the external interrupts.
There are two types of interrupts. What the Arduino Playground said:
The processor at the heart of any Arduino has two different kinds of interrupts: "external", and "pin change". There are only two external interrupt pins on the ATmega168/328 (ie, in the Arduino Uno/Nano/Duemilanove), INT0 and INT1, and they are mapped to Arduino pins 2 and 3. These interrupts can be set to trigger on RISING or FALLING signal edges, or on low level. The triggers are interpreted by hardware, and the interrupt is very fast. The Arduino Mega has a few more external interrupt pins available.
On the other hand the pin change interrupts can be enabled on many more pins. For ATmega168/328-based Arduinos, they can be enabled on any or all 20 of the Arduino's signal pins; on the ATmega-based Arduinos they can be enabled on 24 pins. They are triggered equally on RISING or FALLING signal edges, so it is up to the interrupt code to set the proper pins to receive interrupts, to determine what happened (which pin? ...did the signal rise, or fall?), and to handle it properly. Furthermore, the pin change interrupts are grouped into 3 "port"s on the MCU, so there are only 3 interrupt vectors (subroutines) for the entire body of pins. This makes the job of resolving the action on a single interrupt even more complicated.
Basically, the external interrupts are extremely fast since they're all hardware based. However, there is also the pin change interrupts, but those seem to be much slower because they are mostly software based.
tl;dr: the 20 interrupt pins together are much slower. The 2 interrupt pins are the fastest and most efficient.
EDIT: I just looked at the datasheet and it says that a pin change interrupt is triggered for any of the pins selected with no indication of which pin has changed (although it is split into three interrupt vectors).
- For external interrupts, it'll tell you pin 3 just changed
- For pin change it'll tell you a pin changed that you were monitoring!
As you can see, a pin change interrupt adds a lot of overhead into the ISR that you have to handle by storing previous states and seeing if it's the pin you're worried about. It might be fine for a sleep state, but it's better to use the external interrupts.
There are two types of interrupts. What the Arduino Playground said:
The processor at the heart of any Arduino has two different kinds of interrupts: "external", and "pin change". There are only two external interrupt pins on the ATmega168/328 (ie, in the Arduino Uno/Nano/Duemilanove), INT0 and INT1, and they are mapped to Arduino pins 2 and 3. These interrupts can be set to trigger on RISING or FALLING signal edges, or on low level. The triggers are interpreted by hardware, and the interrupt is very fast. The Arduino Mega has a few more external interrupt pins available.
On the other hand the pin change interrupts can be enabled on many more pins. For ATmega168/328-based Arduinos, they can be enabled on any or all 20 of the Arduino's signal pins; on the ATmega-based Arduinos they can be enabled on 24 pins. They are triggered equally on RISING or FALLING signal edges, so it is up to the interrupt code to set the proper pins to receive interrupts, to determine what happened (which pin? ...did the signal rise, or fall?), and to handle it properly. Furthermore, the pin change interrupts are grouped into 3 "port"s on the MCU, so there are only 3 interrupt vectors (subroutines) for the entire body of pins. This makes the job of resolving the action on a single interrupt even more complicated.
Basically, the external interrupts are extremely fast since they're all hardware based. However, there is also the pin change interrupts, but those seem to be much slower because they are mostly software based.
I couldn't find ever much about "pin change interrupts," but I could find "interrupt on change," which seems to be the same thing. This EE post provides some good information:
Basically, the external interrupt will be triggered on a specific (rising or falling, user defined) edge, while interrupt-on-change [a.k.a pin change interrupt] will be triggered on any edge (both rising and falling).
It makes senses why you can do 20 (14 digital + 6 analog) interrupts with that library, because it does all the complex logic. Where you get the two interrupts is the external interrupt number
tl;dr: the 20 interrupt pins together are much slower. The 2 interrupt pins are the fastest and most efficient.
EDIT: I just looked at the datasheet and it says that a pin change interrupt is triggered for any of the pins selected with no indication of which pin has changed (although it is split into three interrupt vectors).
- For external interrupts, it'll tell you pin 3 just changed
- For pin change it'll tell you a pin changed that you were monitoring!
As you can see, a pin change interrupt adds a lot of overhead into the ISR that you have to handle by storing previous states and seeing if it's the pin you're worried about. It might be fine for a sleep state, but it's better to use the external interrupts.
There are two types of interrupts. What the Arduino Playground said:
The processor at the heart of any Arduino has two different kinds of interrupts: "external", and "pin change". There are only two external interrupt pins on the ATmega168/328 (ie, in the Arduino Uno/Nano/Duemilanove), INT0 and INT1, and they are mapped to Arduino pins 2 and 3. These interrupts can be set to trigger on RISING or FALLING signal edges, or on low level. The triggers are interpreted by hardware, and the interrupt is very fast. The Arduino Mega has a few more external interrupt pins available.
On the other hand the pin change interrupts can be enabled on many more pins. For ATmega168/328-based Arduinos, they can be enabled on any or all 20 of the Arduino's signal pins; on the ATmega-based Arduinos they can be enabled on 24 pins. They are triggered equally on RISING or FALLING signal edges, so it is up to the interrupt code to set the proper pins to receive interrupts, to determine what happened (which pin? ...did the signal rise, or fall?), and to handle it properly. Furthermore, the pin change interrupts are grouped into 3 "port"s on the MCU, so there are only 3 interrupt vectors (subroutines) for the entire body of pins. This makes the job of resolving the action on a single interrupt even more complicated.
Basically, the external interrupts are extremely fast since they're all hardware based. However, there is also the pin change interrupts, but those seem to be much slower because they are mostly software based.
I couldn't find ever much about "pin change interrupts," but I could find "interrupt on change," which seems to be the same thing. This EE post provides some good information:
Basically, the external interrupt will be triggered on a specific (rising or falling, user defined) edge, while interrupt-on-change [a.k.a pin change interrupt] will be triggered on any edge (both rising and falling).
It makes senses why you can do 20 (14 digital + 6 analog) interrupts with that library, because it does all the complex logic. Where you get the two interrupts is the external interrupt number
tl;dr: the 20 interrupt pins together are much slower. The 2 interrupt pins are the fastest and most efficient.
There are two types of interrupts. What the Arduino Playground said:
The processor at the heart of any Arduino has two different kinds of interrupts: "external", and "pin change". There are only two external interrupt pins on the ATmega168/328 (ie, in the Arduino Uno/Nano/Duemilanove), INT0 and INT1, and they are mapped to Arduino pins 2 and 3. These interrupts can be set to trigger on RISING or FALLING signal edges, or on low level. The triggers are interpreted by hardware, and the interrupt is very fast. The Arduino Mega has a few more external interrupt pins available.
On the other hand the pin change interrupts can be enabled on many more pins. For ATmega168/328-based Arduinos, they can be enabled on any or all 20 of the Arduino's signal pins; on the ATmega-based Arduinos they can be enabled on 24 pins. They are triggered equally on RISING or FALLING signal edges, so it is up to the interrupt code to set the proper pins to receive interrupts, to determine what happened (which pin? ...did the signal rise, or fall?), and to handle it properly. Furthermore, the pin change interrupts are grouped into 3 "port"s on the MCU, so there are only 3 interrupt vectors (subroutines) for the entire body of pins. This makes the job of resolving the action on a single interrupt even more complicated.
Basically, the external interrupts are extremely fast since they're all hardware based. However, there is also the pin change interrupts, but those seem to be much slower because they are mostly software based.
tl;dr: the 20 interrupt pins together are much slower. The 2 interrupt pins are the fastest and most efficient.
EDIT: I just looked at the datasheet and it says that a pin change interrupt is triggered for any of the pins selected with no indication of which pin has changed (although it is split into three interrupt vectors).
- For external interrupts, it'll tell you pin 3 just changed
- For pin change it'll tell you a pin changed that you were monitoring!
As you can see, a pin change interrupt adds a lot of overhead into the ISR that you have to handle by storing previous states and seeing if it's the pin you're worried about. It might be fine for a sleep state, but it's better to use the external interrupts.
There are two types of interrupts. What the Arduino Playground said:
The processor at the heart of any Arduino has two different kinds of interrupts: "external", and "pin change". There are only two external interrupt pins on the ATmega168/328 (ie, in the Arduino Uno/Nano/Duemilanove), INT0 and INT1, and they are mapped to Arduino pins 2 and 3. These interrupts can be set to trigger on RISING or FALLING signal edges, or on low level. The triggers are interpreted by hardware, and the interrupt is very fast. The Arduino Mega has a few more external interrupt pins available.
On the other hand the pin change interrupts can be enabled on many more pins. For ATmega168/328-based Arduinos, they can be enabled on any or all 20 of the Arduino's signal pins; on the ATmega-based Arduinos they can be enabled on 24 pins. They are triggered equally on RISING or FALLING signal edges, so it is up to the interrupt code to set the proper pins to receive interrupts, to determine what happened (which pin? ...did the signal rise, or fall?), and to handle it properly. Furthermore, the pin change interrupts are grouped into 3 "port"s on the MCU, so there are only 3 interrupt vectors (subroutines) for the entire body of pins. This makes the job of resolving the action on a single interrupt even more complicated.
Basically, the external interrupts are extremely fast since they're all hardware based. However, there is also the pin change interrupts, but those seem to be much slower because they are mostly software based.
I couldn't find ever much about "pin change interrupts," but I could find "interrupt on change," which seems to be the same thing. This EE post provides some good information:
Basically, the external interrupt will be triggered on a specific (rising or falling, user defined) edge, while interrupt-on-change [a.k.a pin change interrupt] will be triggered on any edge (both rising and falling).
It makes senses why you can do 20 (14 digital + 6 analog) interrupts with that library, because it does all the complex logic. Where you get the two interrupts is the external interrupt number
tl;dr: the 20 interrupt pins together are much slower. The 2 interrupt pins are the fastest and most efficient.