What is the primary purpose of using Hardware Interrupts in AVR programming?
To allow the AVR to multitask and respond instantly to external events by interrupting the normal flow of the program, preempting the main event loop
What is the special function that runs when an interrupt is triggered?
An Interrupt Service Routine (ISR)
What process occurs immediately when an interrupt is triggered before the ISR begins running?
The AVR saves all the variables currently being used in memory.
Name the two main flavors of external interrupts discussed in the chapter.
The fancy interrupts (INT0 and INT1) and Pin-Change Interrupts (PCINT)
Which type of external interrupt is highest priority and offers the most versatile triggering possibilities (e.g., rising voltage, falling voltage)?
The fancy interrupts (INT0 and INT1)
What is the main characteristic of a Pin-Change Interrupt (PCINT) compared to INT0/INT1?
PCINT allows almost every I/O pin to be an interrupt source, but it can only detect a change in voltage, not the direction of the change (rising or falling).
How are Pin-Change Interrupts configured regarding their pins
They are grouped together in banks (e.g., B, C, and D pins), and pin mask registers are used to select which specific pins within the bank will trigger the interrup
What two keywords must be used to declare a variable that is shared between the main program loop and an Interrupt Service Routine (ISR)?
global and volatile
Why is the volatile keyword necessary for a shared variable in an ISR
It tells the compiler that the variable’s value can be changed by something outside the normal program flow (i.e., the ISR), preventing the compiler from making optimizations that would result in incorrect code
What is the main drawback of using polling (checking inputs within the main event loop) instead of interrupts?
If any part of the event loop takes a significant time to execute, a delay will be noticed in responding to the event, making the action feel sluggish.