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.
07-10-2014 10:44 AM
I'm a new labVIEW user here looking for a way to return false if the value hasn't been written yet.
I'm trying to use the 'select' tool to swap between values fairly early in my simulation. However, it requires data that hasn't happened yet, so I need something that waits for the value to be written.
Is there a way to use a while loop to wait until either TRUE or FALSE (instead of NULL) has been written, and then change in resonse?
Solved! Go to Solution.
07-10-2014 10:47 AM
Your description is not clear. Are you talking about writing data to a device or a DAQ card? Please explain a bit more about your situation and also attach the code if possible.
07-10-2014 10:50 AM
Actually, that's the way dataflow works. A node (in this case the selector) won't execute until it's input have received data from whatever was before them.
Perhaps if you posted a bit of code showing what you are trying to do?
Mike...
07-10-2014 10:51 AM
All instances of data in LabVIEW (controls, terminals, constants, shift registers etc.) have a value, there is no concept of NULL.
A boolean control, before you write to it, will have it's default value (probably false). A string will be empty (but not NULL, it's still valid data). A numeric will be zero, a reference will be invalid (possibly equivalent to NULL, but that terminology isn't used.
Can you describe your requirement in more detail, I don't fully understand what you are needing to do.
If you want to wait for a value change (a boolean to change to true), then poll (repeatedly read) from the control terminal in a while loop with it wired directly to the condiitional terminal. It's default value of False will cause the while loop to continually loop until the value is set to True. I'd advise inserting a short Wait inside the loop to prevent it from hoggig a CPU.
07-10-2014 10:53 AM
No, there's no external hardware yet. I'm saying the wires form a cycle. Here's the actual error message:
"These wires form a cycle, making two parts of the diagram interdependent, so each must wait for an input from the other and neither can execute."
I'm trying to get around that creating somethign that can make the Select tool default to "false" until the value is read into it. Perhaps some clever way to use while loops and boolean constants to wait until it recieves data from later in the simulation.
07-10-2014 10:55 AM
I can't post any code for privacy reasons. Give me a minute to make the same error happen again using something similar.
07-10-2014 11:06 AM
Solved! Thank you for your help. I kind of answered my own question suggesting while loops in the first place 😛