Quote:
|
Originally Posted by Don Rotolo
Very cool.
We measure muzzle velocity by shooting the ball through a light beam (an LED and sensor pair, spaced 8" apart) and measuring the time it takes for a 6.875" ball to cross it. We used a storage oscilloscope to measure the time, but we're looking for a better way of measuring the time, on the order of 15 milliseconds.
Don
|
Use one of the timers on the RC set up in 16 bit mode and your optical sensors set up to interrupt the RC on digital inputs 1 and 2. Assuming that digital input 1 is the start for the timer, when this interrupt comes through zero the timer. When the second interrupt on digital input 2 comes through read the timer into a variable available to code running in the packet loop. Have a look at Kevin's interrupt template code, and pay careful attention to his comments on how to read and write the timer correctly in 16 bit mode.
By suitably adjusting the pre-scaler for the timer your granularity can be 100ns, 200ns, 400ns or 800ns. Assuming a 16 bit timer and the 800ns clock tick you can measure up to 52.4 milliseconds with very high precision.
Have fun,
Eugene