Complete the code to define an interrupt service routine (ISR) function.
void [1]() {
// ISR code here
}The function that handles an interrupt is called an ISR (Interrupt Service Routine). Naming it ISR_Handler is a common practice.
Complete the code to enable global interrupts in the microcontroller.
sei(); // [1] interruptsThe sei() function enables global interrupts in many embedded C environments.
Fix the error in the code to correctly declare an ISR for timer overflow.
ISR([1]) {
// Timer overflow code
}The correct vector name for Timer0 overflow interrupt is TIMER0_OVF_vect.
Fill both blanks to create a dictionary that maps interrupt names to their priority levels.
const int interrupt_priority[] = {
[[1]] = 1,
[[2]] = 2
};We map TIMER0_OVF_vect to priority 1 and USART_RX_vect to priority 2 as an example.
Fill all three blanks to complete the code that checks if an interrupt flag is set and clears it.
if ([1] & (1 << [2])) { [3] |= (1 << [2]); // Clear flag }
The TIFR register holds interrupt flags. TOV0 is the Timer0 overflow flag bit. Clearing the flag is done by writing 1 to the bit in TIFR.