LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Resetting edge count function

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.

Download All
0 Kudos
Message 1 of 2
(2,412 Views)

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:

check.png

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…)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 2
(2,383 Views)