Notes to learn how to use the ATmega328P Timers using the Datasheet and other resources
This is the ATmega328P Datasheet that you need to refer to for this: https://ww1.microchip.com/downloads/en/DeviceDoc/Atmel-7810-Automotive-Microcontrollers-ATmega328P_Datasheet.pdf
This is a good tutorial I used: http://gammon.com.au/interrupts
Another tutorial that was very helpful: https://www.youtube.com/watch?v=Uv9UeYUsA8A