This lecture is related to interrupts
of the AVR ATmega328 microcontroller.
We use part of the excellent material from "CSE P567, Design and Implementation of Digital Systems (Winter 2010)" by Carl Ebeling, Computer Science and Engineering Program, University of Washington
From the introduction to ATmege328 (“Lecture 6”) we just need:
We don't need:
A very good explanation is found here:
Let us work on Arduino Timer Interrupts based on material from instructables
http://www.instructables.com/id/Arduino-Timer-Interrupts/?ALLSTEPS
Modify the code from the instructable above to generate a frequency of f = 3 kHz.