LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

counting consecutive events

Hello, I try to count how often a true/false indicator is true. I'm using a "(U16) count: the number of TTL rising edges counted" after it, but with every incoming value the counter sets to 0. Therefore I always have 0 or 1 on the front panel instead of adding the new true to the previous ones. Thanks
0 Kudos
Message 1 of 13
(3,964 Views)
Sounds like your counter might be in a While Loop using an initialized shift register, probably in a sub-vi. If you have a 0 connected to the left side register outside the loop, everytime the loop runs, it will reset the register to 0.

There are ways to initialize shift registers inside the loop if needed so this problem won't happen.

If this is not the problem, post some more details, or attach the code to another message so we can have a look.

Ed


Ed Dickens - Certified LabVIEW Architect
Lockheed Martin Space
Using the Abort button to stop your VI is like using a tree to stop your car. It works, but there may be consequences.
0 Kudos
Message 2 of 13
(3,964 Views)
What you would want to do is not that complicated at all. I am attaching a VI that I wrote for you to demonstrate how to take your signal and make it control a Boolean value. You can actually make this simpler if you want but this will show all the things you need. If you have more trouble post your VI and let us have a look and maybe we can tell you what you are doing wrong. There is also a great toolkit that I love it�s openG toolkit.You can get it at www.openg.org.

Joe
Joe



Joe.
"NOTHING IS EVER EASY"
Message 3 of 13
(3,964 Views)
Hey thanks Joe, it's you again right? The trigger detection VI doesn't accept the type of data from the above or below true/false indicator and I wasn't able to wire it other than to the Index Array. It kind of works but I now it's wrong and it counts only the points above limit of only one of the two values. Thank you Ed as well.
Bernd
0 Kudos
Message 4 of 13
(3,964 Views)
Are you wanting to know how many times that your pulses cross a certain value after the index array or are you wanting to know how many times before index.
where exactly are you trying to count the pulses. if after the index then are you saying that as long as it is between the upper and lower limits that is considered a pulse. Let me know these specifics and I will help you get this running cause it is not that hard and you will probably not even need the trigger VI.

Joe



Joe.
"NOTHING IS EVER EASY"
0 Kudos
Message 5 of 13
(3,964 Views)
I try to count the four pulses after the "above/below green limit true/false" indicators where you now see the broken wire to the trigger detection vi. A pulse is considered not between but below and above the upper and lower limit (counting the rejects).
0 Kudos
Message 6 of 13
(3,964 Views)
Take a look at this vi.It takes an array which represents your data. Indexes the data. takes the min/max of the data checks to see if it is range and adds 1 to the number of pulses using an uninitialized shift register.If I understood you correctly all you have to do is implement this into your program. I do not have any IMAQ stuff so I cannot check it to see. If this does not work then we will try something different or see what someone else has to say about this. But if I understand you correctly then this should work.



Joe.
"NOTHING IS EVER EASY"
0 Kudos
Message 7 of 13
(3,964 Views)
So a case structure in a while loop. That works, thanks a lot Joe.
0 Kudos
Message 8 of 13
(3,964 Views)
I hope this solves your problem if it did then Have a good day. If not then let me know and I will help you all I can.

C-ya



Joe.
"NOTHING IS EVER EASY"
0 Kudos
Message 9 of 13
(3,964 Views)
Yes it solved the problem. I have another question if you don't mind. How do I split a 1-D array into its elements to further work with those elements separately?
0 Kudos
Message 10 of 13
(3,964 Views)