Massimo,
A few notes in no particular order:
1. Re: future use of last counter for another speed measurement. With the 6601, you only have 1 DMA channel available for buffered measurements. A second buffered measurement would have to be manually configured to use interrupts.
A buffered measurement will give you much better precision, but you may be better off starting with a simpler unbuffered approach when getting started.
2. How accurately do you need to measure speed? And how often do you need a new measurement? It sounds like you're reasonably happy with a simple speed estimate made about once per second.
3. Have you considered making a separate loop for the speed measurement? You could simply read the count once per second (unbuffered) and put it into a shift register. Then estimate speed as delta counts divided by delta time. A small enhancement would be to also store the time from 'Tick Count (msec)' on each loop, and use a measured delta time rather than an assumed one in the calculation.
Note that with this method, it's best to run unbuffered to avoid the lock-up problem you saw. It'll also be simpler to add your second speed-measurement counter task in the future.
4. Again, there *are* solutions available involving precise buffered measurements. I recently posted a DAQmx-based example that includes an instant-response buffered read (toward the end of
this thread.). But I'd recommend first getting a simpler approach to work, then coming back to the buffered measurements later when you're sure you need more precision.
Good luck!
-Kevin P.
ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.