Lab 0x02: Think Fast!
In this lab, interrupts are used to schedule an LED and record how long it takes the user to react. The board will keep testing indefinately until the user sends a keyboard interrupt, at which point all of the reaction times are averaged and reported to the user. The existing code represents Part B of the lab which implements the interrupts using the Timer module and TIC/TOC rather than the External Interrupt module.
While the method in Part B is potentially more accurate since there is less time between when the interrupt occurs and it is handled, differences between the two were roughly less than 100us, 3 orders of magnitude smaller than the average times. Implementation was much easier in Part A, and it was easier to separate concerns between the Button and the State objects. If we were measuring on a smaller time scale (<1ms) then the method in Part B would likely be more accurate.