01-03-2018 05:20 PM - edited 01-03-2018 05:21 PM
Hi,
I would like to make an edge counting function in the LabVIEW.
In my program (refer attachment files), I am generating a certain number of 5V signal when I hit OK Button as shown in the left box. In the right box, I am reading the number of edge by using embedded function in DAQ Assistant. The problem is here, I would like to reset the count number if the number of signal reach to the set value (number of samples). For example, when I set the number of samples as 5, it is working good at the first round. However, If I hit the OK button again with same setting, it starts from 6 and up to 10. I want the value to be 0 after it reach the number of samples value so that I can count from 0 to certain value by clicking OK Button again. Could anybody help me with this problem?
Thank you very much for reading this script.
01-04-2018
01:29 AM
- last edited on
11-30-2024
02:17 PM
by
Content Cleaner
Hi whale,
there are no "boxes" in your "script": please try to learn basic LabVIEW vocabulary as it will help you to understand your own software and also to explain it to other people!
(There are while loops in your VI/block diagram!)
You should also learn to use AutoCleanup more often: just press Ctrl-U…
That being said:
- try to get rid of those DAQAssistents and use plain DAQmx functions. THey are explained very well in all those example VIs coming with LabVIEW!
- minimze your usage of local variables: most often overusage will result in race conditions!
- When you can't resist them: convert the DDT wire as soon as possible into "regular" wires like this:
I used the Q&R function to limit the count to your "number of samples" input.
(You could reset the DAQmx counter by stopping and starting the DAQmx counter task…)