10-15-2019 03:02 AM
hello,
i have simple question and i could not find the answer here .
i have sub vi, which has while loop inside , which makes 500 measurements with DT9837A module.
the output of this subvi is connected with numeric indicator in the main VI.
My problem is that the values of the measurements do not update in the main VI simultaneously.
any hekp would be appreciated
thank you
Solved! Go to Solution.
10-15-2019 03:40 AM
without seeing your code it is hard to help. But a wild guess is that you have just wired the data from within the loop to the outside of the VI and then to the connector pane and then to an indicator in the main VI. If you want updates for every value iteration in the loop, but without exiting the VI, then you need to somehow send the data to the main VI. There are many mechanisms for that...
10-15-2019 03:55 AM
Thank you for your reply,
i have tried to make screenshoots and i hope so it would be clear.
10-15-2019 03:56 AM
if needed i can upload the whole vi's ..
thank you again
10-15-2019 03:58 AM
@thols wrote:
There are many mechanisms for that...
for example ??
10-15-2019 04:17 AM
The simplest might be this: https://knowledge.ni.com/KnowledgeArticleDetails?id=kA00Z0000019PGuSAM&l=sv-SE
10-15-2019 05:57 AM - edited 10-15-2019 06:04 AM
Hi moha_affa,
I'd suggest building an array of those 4 values in your subVI, and then using either a Queue or a Notifier pass those values (as a block) to the calling (main) VI.
You can then dequeue the element (which is an array of 4 elements) if you're using a Queue, or Wait on Notification for the same (if using a notifier) and update the main VI inside its own While loop. Take care not to run the subVI in the loop - this isn't what you're looking for.
For an example using Queues to communicate between loops, see Producer/Consumer. Now you can just imagine that the Producer loop is inside your subVI, and connect a Queue Reference as an input for the SubVI's connector pane.
A simple example with just one number is shown below:
Note that with this arrangement, the last value generated by the subVI will never be sent to the main VI (because of the way the queue is stopped). Usually for a real application, you should implement a stopping mechanism that doesn't depend on the Queue erroring!
10-16-2019 01:53 AM - edited 10-16-2019 01:58 AM
@thols wrote:
The simplest might be this: https://knowledge.ni.com/KnowledgeArticleDetails?id=kA00Z0000019PGuSAM&l=sv-SE
it has worked thank you very much