06-25-2019 04:01 AM
Hi experts,
I am a beginner of the labview, I appreciate if you can help me out.
I have been doing to create a start and stop button for my program, but I got some trouble for creating a start button to make it in same status with stop button...
When I try to put a event structure outside of my while loop, the stop button inside the while loop won't work anyone, I don't know what should i do to deal with this situation, could u plz help me? Also I have a 'export' button to export the measurements, how can I to make it can be pressed anytime after I press the start button?
Thanks in advance!
06-25-2019 04:27 AM
Hello Rivershen,
Your program looks good and I don't think there should be any problem with the stop button unless the program gets stuck in any of the subroutines.
If you want to export the data any time after the program starts the put the event structure inside the while loop. Notice there should be a timeout event with a timeout as per your requirement and there should be another event which is linked with the export button.
06-25-2019 04:38 AM
Hi River,
your block diagram can be improved: after using AutoCleanup it immediatly fits into just one FullHD screen…
Other improvements:
06-25-2019 05:11 AM
Hi GerdW,
Thanks for your reply and your great advice!
I don't know if I understand it right, so I moved my 'data flow' event into the while loop, is that correct?
Also, what I mentioned at the beginning is that if I put a event structure outside my while loop and use a 'ok' button to control the it(which is shown in the new VI), the loop won't run in number of iterations and I can't use the stop or export button after I pressed the ok button...
One more question about the data flow, which is that I create one more case structure to let the user be able to use more channels, but the data saving can't accept more than one flowing into it, what should I do?
Really thanks for your time!
River
06-25-2019 05:13 AM
Hi,
Thanks for your reply! I will try that!
Best wishes
River
06-25-2019 06:07 AM
Hi River,
what should I do?
Read the LabVIEW help on the event structure. And the linked Caveats article!
Placing the event structure around your while loop is wrong.
Placing another event structure inside the loop inside the event case is wrong.
LabVIEW comes with a huge example library: did you examine the examples on event structure usage?
06-25-2019 06:28 AM
Your second example is worse than the first for the reasons that GerdW has already noted. You should definitely look at some examples. You don't really need event structures for what you want to accomplish, though. Just put a case structure inside your loop and connect a Start/Stop button to it. No need for two buttons. You can do the same for your logging. No need for an event structure there either. As GerdW mentioned you should move your open and close connection outside your loop so that you're not performing this action every time through the loop.
06-25-2019 07:01 AM
Hi GerdW,
I will go through the examples and the labview help, thanks for your advice!
Best wishes
River
06-25-2019 07:03 AM
Hi,
Thanks for your advice, just start the labview programming and still need to improve a lot. Anyway, thanks for our advice!
Best wishes
River
06-25-2019 07:24 AM - edited 06-25-2019 07:26 AM
Hello RiverShen,
Am not an expert but if I can help, I uploaded a test example for you. The start boolean should be inside your events box. And the stop can be activated using another events.
If you do not put a while loop around the events box, it will run only once. If you put a while loop around the events box, it will run over and over until the stop condition to stop that loop is activated.
If you have more questions and if I can help, will be glad to do so.