If you google for AVR manual ATmega168, you get the wiki page on the processor on the first page, and the .pdf processor manuals.
The processor manuals have details of the 3 hardware timers.
The timers are called Timer0, Timer1 and Timer2. One is used for delay() and millis(), so you should not mess with that (unless you don't use those functions). Timer 2 is not used (except if you use PWM).
The timers are basically counters, which can be driven via a prescalar from the processor clock. They can also be organised to pulse an output pin when they hit the top or bottom, or call an interrupt. They are controlled by timer registers, which are pretty low level. You don't have to know about them because the core Arduino software takes care of the set up as it starts. You can control them using symbolic constants.
Here is an example of timer 2 being used to generate an interrupt, you would need to call setup_interrupt() in your setup() function.
#define RESET_TIMER2 TCNT2 = INIT_TIMER_COUNT
void setup_interrupt()
{
//Timer2 Settings: Timer Prescaler /64 CS22 only
TCCR2B |= (1<<CS22);
TCCR2B &= ~((1<<CS20) | (1<<CS21));
TCCR2B &= ~(1<<WGM22);
// Use normal mode
TCCR2A &= ~((1<<WGM21) | (1<<WGM20));
// Use internal clock - external clock not used in Arduino
ASSR &= ~(1<<AS2);
//Timer2 Overflow Interrupt Enable, clear the two output compare interrupt enables
TIMSK2 |= (1<<TOIE2);
TIMSK2 &= ~((1<<OCIE2A) | (1<<OCIE2B));
RESET_TIMER2;
sei();
}
And this code is a partial interrupt routine:
ISR(TIMER2_OVF_vect) {
RESET_TIMER2;
// read the input pin anyway, might use later, but timing more accurate here
// direct port read is faster then digitalRead()
g_byte_in_read_pin = PINB & 0x01;
.... more stuff
}