LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

boolean to run the program

I have a Start button , How do I make it to run my program , my starting part is just initialization of the port which happens once and then a while loop, while loop has the stop boolean. Thanks
0 Kudos
Message 1 of 5
(3,265 Views)
You can do this many ways. See the attached example for two different ways.
One of your basic choices is whether to use data dependency to control the program flow or a sequence structure. Either way, you need a while loop that stops when Start goes True and doesn't do anything else.
If you're using a sequence structure, put this while loop in sequence frame 0. Put initialization stuff in frame 1, then the rest of your program in frame 2.
If you're using data dependency, put some output you'll need for the next step (after Start) in the while loop and wire it to the next step outside of the loop.
0 Kudos
Message 2 of 5
(3,265 Views)
Sorry I can not open the file. I am using 6.0 Version.
I currently do not have any sequence becasue after initialization I have to read the device buffer and write front panel after it reads the buffer, then I go in my while loop and send command and receive data and parse data and keep doing that unless user press the stop button.
0 Kudos
Message 3 of 5
(3,265 Views)
Here's a 6.0 version.
You can still use a sequence based on what you describe.
Frame 0: Wait for start.
Frame 1: Initialize.
Frame 2: Read the device buffer, etc.

Sequences can be a personal choice. I try to avoid them when I can use data dependency instead, which makes it easier for me to see the overall program flow.
0 Kudos
Message 4 of 5
(3,265 Views)
Use a state machine. In 6.0 there was one called Event Handler and another called Queued Message Handler. There's plenty of others available in the LabVIEW Development Library. Here's one link. Do a search to find others.
0 Kudos
Message 5 of 5
(3,265 Views)