06-26-2017 08:31 AM
Could someone help me figure out a way to ensure that something executes before
a while loop executes? After someone presses a stop button, I need a couple of
DAQmx tasks to execute before the while loop exits. I tried to place the stop
button for the while loop in a case structure, but that did not work.
06-26-2017 08:59 AM
06-26-2017 09:05 AM
Hi GerdW,
Attached is a screenshot of the relevant part of the block diagram. The only way I could think to incorporate data flow would be to put the stop button in a structure, and wire the error from one of the DAQmx tasks into it. However, this does not seem to work.
Thanks,
Alexis
06-26-2017 09:14 AM
Hi dubs,
The only way I could think to incorporate data flow would be to put the stop button in a structure, and wire the error from one of the DAQmx tasks into it
This way you produce a circular reference!
Your stop button is read to generate this boolean input into the DAQmx functions, but the output of those functions should be used to enforce dataflow to read the stop button???
Please clarify your algorithm behind all this!
When should the button be read? Before or after those DAQmx functions?
(You might solve that problem using a shift register/feedback node…)
06-26-2017 09:39 AM
I apologize for my lack of clarity in the previous post.
I would like the following to happen:
When someone presses the "Stop Pumps and End Data Collection" Boolean control, I would like the following to happen in the following order:
1. Both Digital Bool DAQmx tasks execute
2. True is written to the loop condition, which will cause the while loop to execute.
06-26-2017 09:48 AM
Hi dubs,
both items are done according to your image.
But I cannot say WHEN this will be done as you only posted a small portion of your whole VI.
There's a reason why we often ask for full VI attachments instead of small images…
06-26-2017 09:51 AM - edited 06-26-2017 09:52 AM
@dubs.a wrote:
I apologize for my lack of clarity in the previous post.
I would like the following to happen:
When someone presses the "Stop Pumps and End Data Collection" Boolean control, I would like the following to happen in the following order:
1. Both Digital Bool DAQmx tasks execute
2. True is written to the loop condition, which will cause the while loop to execute.
Judging from your description and you need to modify your (also judging from your description since you haven't attached any code) "One big loop" architecture, and use a proper program architecture like a State Machine.
That way when someone presses the button it goes to the state to execute both DAQmx tasks and stops the program. (I am guessing a safe shutdown)
06-26-2017 10:08 AM
I apologize as I thought that a screenshot of the relevant code would be more helpful than a VI. I have attached the VI in question.
06-26-2017 10:10 AM
I have found a typo in my previous post. The following is what I meant to type:
I apologize for my lack of clarity in the previous post.
I would like the following to happen:
When someone presses the "Stop Pumps and End Data Collection" Boolean control, I would like the following to happen in the following order:
1. Both Digital Bool DAQmx tasks execute.
2. True is written to the loop condition, which will cause the while loop to exit.
06-26-2017
10:12 AM
- last edited on
05-13-2025
01:03 PM
by
Content Cleaner
OMG, I was right...
You need to scrap that whole thing and start over using a proper programing architecture like a State Machine.