02-05-2009 05:37 PM
Hello,
I would like to count the number of times an event occurs within a defined period (1000ms). I have tried to implement this with an Elapsed Time item (see the attachment).
Time Target, is set to: Get Start Time + 1000 (run for one second after starting)
Auto-reset, is set to: True
Set Start Time, is set to: 0 (uses the current time as the start time)
The output, Time Has Elapsed, is fed into the While loop. After one second of the VI executing, this line should become True hence the While loop terminates.
When I run the VI the loop never ends (I can continuously vary the gauge value). How do I correctly implement this delay?
Thank you
MCU
02-05-2009 09:38 PM
Hi MCU,
If I were you, I'll use sequence structure.
Keep timing in the first loop.
Run for loop in second sequence.
Collec time in third loop, and minus the time in first loop.
You may refer to my attached screenshot for more information:
02-05-2009 10:02 PM
I think this may help you.
Balaji(CLAD)
02-06-2009 08:11 PM
Hello,
Thank you very much for the help.
Regards
MCU
02-07-2009 12:14 PM - edited 02-07-2009 12:14 PM
MCU wrote:I would like to count the number of times an event occurs within a defined period (1000ms). I have tried to implement this with an Elapsed Time item (see the attachment).
Time Target, is set to: Get Start Time + 1000 (run for one second after starting)
Auto-reset, is set to: True
Set Start Time, is set to: 0 (uses the current time as the start time)
The output, Time Has Elapsed, is fed into the While loop. After one second of the VI executing, this line should become True hence the While loop terminates.
When I run the VI the loop never ends (I can continuously vary the gauge value). How do I correctly implement this delay?
OK, your VI has two problems:
Here's a quick draft of some code that counts how many times the knob changes value during one second, then stops.
(As othere have noted, there are probably more efficient ways using tick count, but let's use the "elapsed time" express VI for simplicity.)
03-20-2009 06:11 AM
Hi MCU,
Is your problem solved? If so please mark post (Whichever you think is the best solution for your query). This will help others facing same problem and looking for a solution.