ATMEGA328P - Fastest timer?

Hi all

Apologies if this question seems rather vague, but I am trying to ascertain the capabilities of the ATMEGA328P before trying to implement into a project. I am trying to measure the response time of an opto coupler, and need it to be <5uS. What I am hoping to be able to do is hook up a test circuit with the Input and output of the opto connected to the atmega328.

I will feed a pulse into the opto, and I want the atmega to Start a timer on the input rising edge, and stop the timer on the output falling edge (NPN phototransistor output). I will then perform a functiom based on the response time of the opto.

My real question is: can the atmega328p measure that fast? I would like accuracy to 0.5us.

Thanks for any and all advise.

Regards
Al

It would be a close thing. You can get a timer to run at 16MHz, but gating it off of two inputs might not be possible…

(Not using the arduino libraries, of course.)