Timer and Stop Watch with LEDs – Code

The code above is used to maintain and countdown time for the timer/stopwatch in this project. It is set in the interrupt and is calculated for every second. Due to the nature of the LCD, it is required to use and display the time using an array. Therefore, the ten’s place of the minute, one’s place of the minute, ten’s place of the seconds and one’s place of the seconds is used to calculate time along with the interrupts. For the purpose of this project, the maximum value of time is 59 minutes, therefore the if else statement above considers the value in the format of ##:## and counts up from the one’s place of the seconds and once that reaches 0, increments the ten’s place by one and then repeats this til stop watch is stopped.