Measuring Muzzle Velocity

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