LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with Boolean Controls

I am using Boolean controls to send commands to a camera. This is done using a subvi inside a while loop. Now there is another subvi that receives values from the camera and displays them. The problem is that the boolean that is used to display the received values has to be pressed several times to display the correct values. I use the latch until realeased action.
I also added the wait(ms) also. But none of these seem to help. My suspicion is that this has something to do with order of execution of the subvis as these vi's are independent. So can somebody suggest something I can do. I am pressed for time and a quick reply would be greatly appreciated.

Thanks
Hema
0 Kudos
Message 1 of 7
(2,995 Views)
Is there any chance that you can post the VIs so we can look at them? This does sound like a timing issue. If your send data VI has returns that feed to the receive data VI then the send VI must complete and exit before the data would be sent to the receive VI (which will not run until it gets all incoming data).

You might want to try tracing through the program to see what is happening (open the VI diagram and click on the highlight execution button).

Rob
0 Kudos
Message 2 of 7
(2,995 Views)
I did the execution highlighting and it appears that the receive vi is executed first. How can I change that? I am attaching the vi's as well as the main vi that runs these.
Download All
0 Kudos
Message 3 of 7
(2,995 Views)
All of your boolean switches should have a mechanical action of one of the latch types. You should have an error in and an error out connection on each or your sub-vis connector panes. Wiring the error out from the first sub-vi to the error in of the second sub-vi will gaurantee that the first will run until completion before the second one starts. They way you have it now, these two sub-vis run in parallel, causing unpredictable results. Using error in/out is a good way to ensure execution control without having to use sequences. Also, don't take this the wrong way, but your wiring is a jumbled mess. Very hard to see what wire goes where. You have booleans hiding other booleans, and wires hiding other wires in your block diagram. By using neat
ly placed wires, controls, and indicators, it will be much easier to troubleshoot your programs. Also, all your inputs to sub-vi connector panes should come in from the left side (or top or bottom). Outputs should go out the right side. This also makes the code easier to read.
- tbob

Inventor of the WORM Global
0 Kudos
Message 4 of 7
(2,995 Views)
You have to force the one to run before the other by using some form of data flow. Here is the quick and easy way (though not the best) to do it (included top level VI). I agree that you should use the error in/error out data flow to keep things straight.

Rob
0 Kudos
Message 5 of 7
(2,995 Views)
Thanks for ur suggestions.Actually the main vi I wired in the last minute and that is the reason for the jumble. Sorry for that. As regards the problem despite creating the data flow the problem remains. Also I tried to run the subvi for receive control independently and it still gives the same problem with the boolean. Is there anything else that I can do?

Thanks
Hema
0 Kudos
Message 6 of 7
(2,995 Views)
It looks like this could be a timing issue. If you wait (instead of pressing the button multiple times), does the read work on the first try?

Also, your loops do not wait to look for the button to be pressed, but is continuously running. So it is processing data in the subVIs whether the button is pressed or not. It will have to finish one full iteration before looking at the button again. How long does one iteration take?

Can you trace through and see what is happening as you press the button? What is it doing? Is the data being looked at and used?

Rob
0 Kudos
Message 7 of 7
(2,995 Views)