Thanks for all of your replies I got what I wanted from this link : http://maxembedded.com/2011/06/28/avr-timers-timer1/