Quote:
Originally Posted by Jared
I'm not sure this will work for a few reasons. First, I doubt that our setup with Java on the cRIO (or Java running on anything) will time the 30 microsecond pulse very accurately if you set it up the way you have it now.
Also, you'd need to run this loop really quickly to capture the pulse. If you're one inch away, your pulse is less than a millisecond away. It's possible to miss pulses entirely.
You really should use interrupts for this, or you should just add an arduino board that communicates with the cRIO with serial. I bet somebody has written an arduino library for this sensor. ... I don't think your two while loops will work the way you'd like them to.
|
I wasn't sure how effective this code would be. I was just trying to provide a starting point for the OP.
Quote:
|
Also, your timing method doesn't seem to compare the two FPGA timestamps to find the duration of the pulse.
|
I should have subtracted
starttime. Added now.