A Timer/Stopwatch project that is based on a simple 1 second counter implemented to an ATmega328P. The
limition of only having four 7-segment displays, means that the max time it can display is 99 minutes
with 60 seconds, even though the counter can go up to 1092 minutes due to being a 16 bit unsigned
variable.
The exact 1 second counter is based on the ATmega328P 16 MHz clock with a prescale of 256 bits to
count to 62499 (OCR1A = 62499), when reached it causes an interrupt to occur, which adds 1 to the
uint16_t count variable.
7-Segment Display
Multiplexing through each 7-segment display - each display is turned ON and OFF at a high frequency
to display each number (0-9).
Interrupt Setup
There are a total of 4 interrupts, with one being the basis for 1 second counter. The other
interrupts are for the main control switches, being 'Interrupt0', 'Interrupt1', and 'PCInterrupt0'.
Interrupt0: Controls the incrementing state of the system (PAUSE/RUN) and is used to cancel
the ALERT state when the alarm is triggered.
Interrupt1: Controls the mode of the system, allowing the user to switch between a simple
stopwatch to a timer.
PCInterrupt0: Due to a lack of interrupt pins, I implented another one to clear the uint16_t
count variable