A timer is a common peripheral found on a microcontroller which stores a value and keeps incrementing with a pulse…