Timing the Operation

The operation was timed using the PIC’s internal timer 0. The timer interrupts the operation 38 times per second. As such, global interrupts were enabled along with internal interrupts to allow the timer interrupt to be used. Once enabled, when an interrupt was triggered an ISR would check to see whether the timer was triggering the interrupt using the flag and increment the counter of the number of times this interrupt had occurred. Once the counter reached 38, the operation time was incremented by 1. Upon completion of the operation, the operation time was saved and converted from Binary to ASCII characters for display on the LCD.