06-28-2011 07:17 PM
06-29-2011 12:21 AM
Hi pnam,
Can you be a bit more precise? What kind of boolean output are your talking about? Do you want to record some button presses or something else? And are you going to use this VI as a SubVI that you want it to stop with your main VI? Kindly clarify these things so that we can get you the best solution.
Regards,
Nitzz
(Kudos are alway Welcome;))
06-29-2011 03:53 AM - edited 06-29-2011 03:54 AM
What does a stop button have to do with a counter? Is this a different question? Please clarify? If you want to keep running, simply don't press the stop button, right? 😄
An "output" is typically just an indicator, so you need to find out the source of the boolean data that causes the output to change. What do you want to count (e.g. true to false transitions or vice versa, value changes, etc.). Or are you measuring the output of an external device? We need more information.
Typically, you keep the count in a shift register (initialzed with zero) or feedback node and conditionally increment it when the desired change occurs.
06-29-2011 07:56 AM
Here is an example of a simple counter. You will have to adapt it to your situation.
06-29-2011 02:26 PM
Could you please downgrade the code to 8.6 and send it to me please.
Thanks,
-Priya
06-29-2011 02:45 PM
Try this, it's a bit cleaner and simpler. (8.6)
(The other example was a bit weird, with extra timeout cases, misguided representations (DBL vs I32) and funny events (mouse up vs value changed)
07-01-2011 08:31 AM
Thanks a lot for your help. I need only the 'increment ' even case for my code. Now my question is how do I modify the code if I want to replace the event from the increment button to an output of a boolean?
Thanks
-P
07-01-2011 10:11 AM
I changed the mechanical action to switch action. You would simply compare the new with the previous value from a feedback node and increment if they differ.
(You can easily modify so it only increments on either the TRUE-FALSE or FALSE-TRUE transition bu changing the "not equal" to a "greater than" or "less than" comparison, for example)