08-25-2011 12:44 PM
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.
Solved! Go to Solution.
08-25-2011 01:50 PM
Pass a control reference from the main VI to the sub-VIs. See attached example.
08-25-2011 02:14 PM
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
08-25-2011 09:04 PM
LV2009 conversion
08-26-2011 09:49 AM
I appreciate it!
Thanks!
08-28-2011 09:56 PM
08-28-2011 10:07 PM
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.
08-29-2011 11:24 AM
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
08-29-2011 11:50 AM
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.
08-29-2011 02:15 PM
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.