I am currently building a custom based linux distribution designed to have low latencies (xenomai).
In order to measure the latencies I thought about using an Arduino and would like some advices.
What I want the arduino to do :
- measure time t0
- Sending an interruption through the parallel port (setting an output pin UP)
- waiting for an imput pin to go UP
- Measure reaction_time = t0 - current_time
- Store worst reaction time
- Sart over again
What I want the PC to do
- react on the IrQ of the parallel port
- set an output parallel pin to UP
I'm a novice with arduino (I don't even have one) and before buying one I would like to have some info :
What is the speed of an input pin reading i.e what would be the result of this little pseudoprogram ?
Wich model of arduino would you advise me to buy knowing that I want to make as little of electronics circuitry as possible while having a reasonable speed (in the order of the microsecond for t_read)
I really appreciate any help you could provide and will provide any additional info if needed
The most common Arduino board is the Arduino Uno.
The high end is the Arduino Due, it is faster with a ARM processor, but I would not recommend it to start with.
With the Arduino Uno, and using the normal Arduino functions, a loop that reads the interval and stores the slowest value uses about 5 to 20 µs.
For timing is a function called micros()
I read on that page that the resolution is 4µs.
Or millis()
There is a special function to measure the duration of a pulse.
The Arduino has hardware timers inside. If you use those, and optimize the code, you can go beyond the normal Arduino functions.
Read or write to I/O pins (with optimized code) is 0.125 µs
(while I was typing this, CrossRoads was already showing optimized code).
That's what I do.
Time management I either use micros(), which has about 4uS resolution, or just free running with no time management, depending on the application.