From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Edge counting using DAQ assistant

Hi all,

 

I'm trying to use the edge count of DAQ assistant and the elapsed time to count the number of events that occur during a specific period, for example 0.1 s.

If my input is a square signal of 1000 Hz, the count shoud be 100. However, what I get is 50 counts. I trying other inputs of different frequency, and the counts was always the half of the counts I expected. While I increased the time duration, the difference between the value that I got and the value I expected became smaller.

I don't know where comes this problem. My first guess is that the DAQ assistant needs configuring for each iteration, and the configuration takes some time. So during the 0.1s, only a certain fraction of time is used to count the events. Thus the counts don't match with what I expect.

Can anyone here answer my question? Also, I want to know whether there is an alternative way to solve this problem and give a more accurate count. Thanks!
 
Untitled.png
0 Kudos
Message 1 of 7
(3,653 Views)

You know, I tried clicking on your picture and it wouldn't execute!  Does that mean your code gives me 0 counts?

 

Seriously, since this is your first post, you might not know that "looking at a picture" isn't much help to us when we are trying to see what you are really doing.  The DAQ Assistant "hides" many details, which we can discover if you attach your VI to your post.

 

Please attach your VI and we will take a look at it and (maybe) make useful suggestions.

 

Bob Schor

Message 2 of 7
(3,645 Views)

Get rid of the DAQ Assistant.  Use the actual DAQmx API so that you can get your timing a little closer to reality.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 3 of 7
(3,632 Views)

Hi Bob,

Thanks for your reply.

I attached my VI

0 Kudos
Message 4 of 7
(3,598 Views)

Hi I have the same VI you are suggesting but my counting is always 0, I have the signal on the scope and its a square pulse with variable frequency 0-300 Hz, any suggestion why is it not working? please

0 Kudos
Message 5 of 7
(825 Views)

Please see @crossrulz's excellent, elegant, simple DAQmx "solution" to this simple edge-counting problem.  The Dreaded DAQ Assistant should (almost never) be used.  I'm convinced it was "invented" for NI "traveling Sales reps" who show up at schools and companies with simple-minded Demos ("Look how easy you can gather data with LabVIEW -- there's even a DAQ Assistant to take the burden of "wiring" your Instrument off your plate.").  Sorry, I've been to too many of these (though a Sales rep hasn't been seen out our way for about 6-8 years ...).

 

Bob Schor

0 Kudos
Message 6 of 7
(810 Views)

Thank you, is good to know, but my problem was solved adding a chanel node for the counter with the terminal property wired.

0 Kudos
Message 7 of 7
(808 Views)