11-26-2005 05:07 PM
11-26-2005 08:43 PM
Source of what?
You never said what your source is.
If you're sampling an analog signal, I would consider an indefinite (continuous) acquisition with a buffer - sample the signal continuously, and remember the mSec count when you start.
When the buffer is half full, look through the first half for transitions across the 255 point. If you find one at sample #37, for example, figure the time as Tstart + 37 / Sample Rate.
When you expire the buffer, wait for another half-buffer of data and process that, adding NSamples/Sample Rate to your Tstart.
When you get your five transitions (or your time has gone beyond the limit), terminate the acquisition.
Your only uncertainty is the initial timer uncertainty - you don't know exactly when your acquisition starts, relative to the mSec timer. Unless you're doing sub mSec timing, that won't matter.
Blog for (mostly LabVIEW) programmers: Tips And Tricks