Depends on the prescale you use. Here is a clip of my code using BASCOM-AVR editor:
http://www.mcselec.com/?option=com_content&task=view&id=14&Itemid=41
' ########### MAIN ############################################################
Main:
Config Timer0 = , Prescale = 8
'1/8/64/256/1024, 1 == 0.125us, >>8==1us, 64==8us, 256==32us, 1024==128us
On Timer0 Tmr0_isr
Enable Timer0
On Int0 Eint0_isr
Enable Interrupts
Config Adc = Free , Prescaler = Auto , Reference = Avcc
Enable Adc
Do
Call Calculate_delay
If Rpm_period < Dead Then
If Rpm_period >= Redline Then
Call Set_advance
End If
End If
Loop
End
' _____________________________________________________________________________
' ########### TMR0_ISR ########################################################
' ### clock F = 8mhz,
' ### Divide clock by prescale.
' ### timer clock F / pf. main loop P = 1/F.
' ### Interrupts every 255 (overflow) loops OR
' ### 1 == 32us, >>8 == 255us, 64 == 2 ms, 256 == 8 ms, 1024 == 32ms
Tmr0_isr:
Incr Loop_timer
Incr Delay_timer
Return
' #######################################################################
If the prescale = 1, then it runs full speed at 8Mhz (this is the 10Mhz version). This should run up to the specified 10Mhz and ditto for the 20Mhz version. Why did you ask 16Mhz? Am I missing something? My code is at 8Mhz. Shouldn't I be able to set it to 10Mhz and ditto for the 20Mhz version?
On this code, the prescaler is at 8. So, the loop time for one iteration of the code is 1uSec and the interrupt from overflow happens at 255 loops or 255uS. If I set it to 1, then the timing is .125uS and 32uS respectively.
My external interrupt routine looks like this for the trigger input:
' ########### Eint0_isr ########################################################
' ### External interrupt. PD2 input. Rising edges only
Eint0_isr:
Stop Timer0
Start Timer0
'reset timer at every external interrupt
Rpm_period = Loop_timer
Loop_timer = 0
Delay_timer = 0
Return
You can see I set the interrupt registers to see only rising edges. This is so I measure the period only, disregarding the falling edges.