LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to get updated values from the loops while they are running

Solved!
Go to solution

Hello,

        I am having difficulty solving a very basic problem, how to access the updated values from the 'FOR loop' while its running?  Basically, the VI  I am currently working on calls two sub VIs. Each sub VI has a for loop, and both VIs may or may not run for same number of iterations. My goal is to read the values at each terminal inside the loop of both sub VIs, in the Main VI. I tried to achieve it using Global Variables, but in main VI it displays only the last iteration value from both sub VIs. Could anyone please tell me whrere am I going wrong? Is there any other/better way to achieve this.

I appreciate any input on this issue.Global Check VI_BD.png  Sub VI_A_BD.pngSub VI_B_BD.pngGlobal Variabe_FP.png



------------------------------------------------------------------------------------------------------
Kudos are (always) welcome for the good post. 🙂
0 Kudos
Message 1 of 16
(1,271 Views)
Solution
Accepted by topic author odessy27

Pass a control reference from the main VI to the sub-VIs.  See attached example.

Download All
Message 2 of 16
(1,264 Views)

pcardinale,

              I appreciate the response. I am using LV9.0.1 and thus can not open the VIs you attached (LV 10 I suppose?). Can you please save it as older version or post the block diagram picture?

Thanks!

 

-Nilesh



------------------------------------------------------------------------------------------------------
Kudos are (always) welcome for the good post. 🙂
0 Kudos
Message 3 of 16
(1,257 Views)

LV2009 conversion

-----------------------------------------------------------------------------------------
Reese, (former CLAD, future CLD)

Some people call me the Space Cowboy!
Some call me the gangster of love.
Some people call me MoReese!
...I'm right here baby, right here, right here, right here at home
Download All
Message 4 of 16
(1,234 Views)

I appreciate it!

Thanks!

 



------------------------------------------------------------------------------------------------------
Kudos are (always) welcome for the good post. 🙂
0 Kudos
Message 5 of 16
(1,210 Views)
One small addition to my question. By the use of reference I could access the value in the main vi but couldn't 'read from ' the Reference. Any idea on how?


------------------------------------------------------------------------------------------------------
Kudos are (always) welcome for the good post. 🙂
0 Kudos
Message 6 of 16
(1,161 Views)

I don't understand that. You can read the value by using the reference but could not read from the reference. Post some code or explain a bit better, please.

0 Kudos
Message 7 of 16
(1,159 Views)

Dennis,

            In attached VI, I can see the values changing in the sub VI from the main VI with the numeric indicator whose reference is passed on to the sub VI. Now if I wanted to store or use those values how do I do that? I tried to chnge the indicator to control and read from it (in the attached VI) , but the the indicator updates only once. Tried to create a property node and read the Value from it and it didn't work either.

Thanks in Advance!

 

-Nilesh



------------------------------------------------------------------------------------------------------
Kudos are (always) welcome for the good post. 🙂
Download All
0 Kudos
Message 8 of 16
(1,137 Views)

The indicator only updates once because that part of the code only executes once. You would need a loop. You could also just put the store function in the subVI.

0 Kudos
Message 9 of 16
(1,129 Views)

Tried that too, but it misses some values during the run. I could store the data in the sub vi but I want to be able to store the data from two different sub vi s that are running simultenously and may or may not creat same amount of data samples. Basically, need to be able to access the values as they are produced in those sub VIs so that if the value from one sub vi is available then it ll check if the new value from other sub vi is available and if not it ll use the previuos value that was available for that sub VI and write it to a 2D array. Its kind of a data synchronization I am trying to achieve here.

 



------------------------------------------------------------------------------------------------------
Kudos are (always) welcome for the good post. 🙂
0 Kudos
Message 10 of 16
(1,114 Views)