C12 Embedded systems in MicroPython and C · Practice
Interrupts
Problems dealt one at a time, with new numbers every time. The kinds you miss come back more often, and you can keep going as long as you like.
Check
An ISR takes 200 cycles and fires 1 thousand times a second. What percentage of the 10 MHz processor does it use?
Check
An ISR takes 125 cycles. Above what interrupt rate can't the processor keep up, even doing nothing else?
Write units the way you normally would: 1.5 kHz, 1500 Hz and 0.0015 MHz are the same answer.
Check
An interrupt's response takes 12 cycles. What's the latency, at 10 MHz?
Write units the way you normally would: 1.5 µs, 1500 ns and 0.0015 ms are the same answer.
Check
An ISR saves and restores 5 registers, one instruction each way per register, and fires 1 thousand times a second. What share of the processor goes to that saving and restoring?
Check
count is 10. Main loads it, the ISR increments it and returns, then main adds 1 to its loaded copy and stores it. What is count now?
Check
An interrupt fires 10 thousand times a second and costs 30 cycles on the 10 MHz board.
(a)
What share of the processor does it use?
(b)
At most how many thousand per second could it run, using everything?
Check
Interrupt entry takes 12 cycles, and interrupts are disabled for at most 10 cycles at a time.
(a)
What is the worst-case latency at 10 MHz?
Write units the way you normally would: 1.5 µs, 1500 ns and 0.0015 ms are the same answer.
(b)
How much of that is the critical section?
Check
Load of an 80-cycle ISR at 5 kHz?
Check
Highest rate for a 500-cycle ISR?
Write units the way you normally would: 1.5 kHz, 1500 Hz and 0.0015 MHz are the same answer.
Check
Latency of 12 cycles?
Write units the way you normally would: 1.5 µs, 1500 ns and 0.0015 ms are the same answer.
A kind of problem counts as solid once you've got it right on the first try twice in a row. Back to the lesson · Practice every topic in C12