I am pretty new to Arduino Uno and have been using it for last two weeks. I am sending a scanned pulse wave to pin 7 from a scanner and trying to read the timings whenever there is a transition in the pulse.(from high to low and from low to high) as I want to regenerate the pulse through its timings in matlab so that source of glitches can be find out.
Before I was using micros and millis function to read the system clock as soon as there is transition. But I found out that system clock is not giving the consistent result as it is a real time clock and doesn't execute the instruction as soon as it is requested (wrote a program and put delay(100); for 10 times and read the system clock. But it is giving delay of 100, 104, 108 & 112 microseconds randomly)
So, I need to use some other thing as counter and since, I need to measure microseconds, I think I need its precision to measure nanoseconds. Can anybody tell me that is there any inbuilt counter for such purpose on the arduino uno board or I have a design a separate counter and interface it with the board? I would really appreciate if anybody can light up the interfacing part too.
PS: It has Atmega328P-PU micro-controller.
Thanks Neha :)