In embedded C, the interrupt keyword must be preceded by double underscores: __interrupt.
Step 2: Verify other parts
ISR functions return void and have no parameters, which is correct here. Interrupt number 2 is valid.
Final Answer:
Missing __ before interrupt keyword -> Option D
Quick Check:
ISR syntax needs __interrupt [OK]
Hint: ISR must use __interrupt keyword [OK]
Common Mistakes:
Using single underscore or no underscore
Changing return type from void
Adding parameters to ISR
5. You want your embedded program to monitor a sensor and also perform other tasks without delay. How does using interrupts help achieve this?
hard
A. Interrupts require the program to wait for sensor manually
B. Interrupts pause other tasks and immediately run sensor code when triggered
C. Interrupts disable sensor monitoring to save power
D. Interrupts make the program run tasks one after another slowly
Solution
Step 1: Understand multitasking with interrupts
Interrupts allow the program to stop current tasks and quickly handle sensor events.
Step 2: Compare options
Interrupts pause other tasks and immediately run sensor code when triggered correctly describes how interrupts improve responsiveness by pausing other tasks to run sensor code immediately.
Final Answer:
Interrupts pause other tasks and immediately run sensor code when triggered -> Option B