From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
01-01-2018 09:45 AM
Hi ,
I am newbie to labview. In my project i want count the boolean value has changed within 5 sec or not?
if changed I want to trigger the hardware if not i just need to continue the loop
Solved! Go to Solution.
01-01-2018 09:55 AM
Have you read/viewed/studied any LabVIEW Tutorials, such as the ones mentioned on the first page of this Forum? If so, you should be able to:
Give it a try. When you next Reply to this message, attach your VI so that we can either (a) congratulate you for figuring out how to do this, and for putting a little effort into learning enough basic LabVIEW (like the first few Tutorials), or (b) give you just a little hint to correct a mis-impression or lack of understanding of LabVIEW's Data Flow paradigm.
Bob Schor
01-01-2018 10:59 AM
Hi Bob,
Thanks for reply...I can create a loop to generate Boolean and I can compare old and previous value...what my main problem was how to check with in 5 sec any value ( Boolean ) changed or not
01-01-2018 11:19 AM
It is always a good idea when you have a LabVIEW Question to post your LabVIEW code where you try (and, maybe, fail) to solve it. For example, you say "Boolean value", but it is unclear if this is a Boolean control or a Boolean variable.
Why does it make a difference? LabVIEW (as you may have discovered) is a little different from other Programming Environments. For one thing, Time is treated as an intrinsic concept in LabVIEW. Not only are there Timing functions, there is also the Event Structure, which allows you to "take notice" when a Control changes.
You ask "How do I check within 5 seconds whether a Boolean value changed or not". One way to do this is called "Polling" -- ask over-and-over (either "as fast as you can", which tends to waste CPU cycles, or "every <time-interval>") if the value has changed. The other way is to "fire an Event" when a change occurs.
When you say "check within 5 seconds", do you mean "If it changes at 1 second, wait until 5 seconds is up and say It Changed!" or "If it changes at 1 second, immediately say It Changed!"? If the former, what if it changes twice (On, then back Off) during the 5 second interval -- do you count those two "Changes" as a "Change"?
Next time you reply, attach the VI where you've attempted to solve your own problem. We try to not do Homework for other Forum Users, neither are we trying to develop yet another set of LabVIEW Tutorials or Classes (there are plenty on the Web).
Bob Schor
01-01-2018 12:15 PM
@RNR wrote:
In my project i want count the boolean value has changed within 5 sec or not?
if changed I want to trigger the hardware if not i just need to continue the loop
Your two sentences don't seem to agree because they talk about two different problems.. Counting transition will tell you how many times a boolean has changed over that time interval, i.e. if gives you an integer number, but you seem only be interested if it has changed at all, i.e. only two possible outputs (changed, not changed).
Do you want to count over a specific time interval (specific start and end time) or do you want to continuously detect if the boolean has changed within the last 5 seconds?
It would probably help if you could show us your code.
01-01-2018 11:33 PM
Hi,
I want detect continuously in past 5 sec the Boolean value changed or not?
I want to detect the boolean variable value's in particular timestamp , and if there is any change in value for particular time stamp, i want to trigger event .
Note:- This vi i have created for demo/ part model of my project,
thanks for reply and support. I am thinking about shared variable and queue to implement. please try to give me the logic
01-02-2018 12:55 AM - edited 01-02-2018 01:00 AM
If you just want to detect a boolean change, what's the significance of the 5 seconds? Makes no sense to me. What should happen after five seconds if no change occurred? What if more than one change occurred?
Also have a look at "boolean crossing ptbypt".
Do you want to ignore all changes for five seconds after a change has been detected?
I don't understand your code. Your boolean changes 10x per second. What's the significance of the sequence frame? I also think you have wired the indicator to the wrong output of the feedback node. To detect odd/even, you don't need Q&R, a simple "AND 1" followed by "equal zero" is preferred. I don't see any time stamps.
01-02-2018 01:03 AM
Hi,
please go through my code to have better understanding
01-02-2018 02:37 AM
RNR wrote:please go through my code to have better understanding
Sorry, that code does not really help me understand. Most of it makes no sense. Are you trying to detect if the boolean is TRUE for more than 5 seconds?
01-02-2018 02:41 AM
Yess ..I am detecting Boolean high on 5 sec