LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

pass data of a vi to another vi

In my attachment,there are two vis,I want to pass the display data of second.vi to the first.vi.Please look at my my vis,and give me any suggestion.Any suggestion will be welcome,please
Download All
0 Kudos
Message 1 of 11
(4,912 Views)
well the first thing you have to do is create a control of the type of data that you want to input on the first vi. then right click on the icon in the top right hand corner(labview icon) and select show connector then click on one of the terminals then click on the control of the type that you want to input. this will allow you to input this type of data to the vi. then on the second vi you will create an indicator of the same type. then repeat the icon process for the indicator this will allow you to pass data to the subvi. Note that when you want to create a subvi that all controls will be inputs and all indicators will be outputs. I have fixed your vis so that they will do this. If you need any more help or if this is not what you need let us know and we
will help you all we can.

Joe



Joe.
"NOTHING IS EVER EASY"
0 Kudos
Message 2 of 11
(4,912 Views)
The attached file should work for you. It uses a vi reference to control second.vi from first.vi.
Randall Pursley
0 Kudos
Message 3 of 11
(4,912 Views)
I am so sorry to say the following words:I cannot open the attacthment you posted,the error message is:labview load error 9:vi version 7.1 is newer than labview version 7.0.THe problem is I knew the 7.1 is newer than 7.0,but I havn't.Anyway,thank you.
0 Kudos
Message 4 of 11
(4,912 Views)
Apparently, you have two independed VIs, one with an infinite while loop that generates random data as fast as the processor can, and you have another VI that runs a limited FOR loop, also as fast a possible.

-- Do you want to run both concurrently and simply randomly grab the current value from "second" whenever the FOR loop iterates?
In this case, you should definitely put at least a 0ms wait in each loop to force a task switch. Else the FOR loop might run multiple times before the while loop executes again and you'll get the same value several times in a row (Just guessing, I have not tried this). Messaging the data between the two VIs can be done in a variety of ways (LV2 style functional global, Global variable, value properties, queues, datasocke
t, UDP, etc. etc.)

-- Do you need to add synchronization such that "second" executes exactly once per FOR loop iteration? Do you need to ensure that ALL data generated by "second.vi" arrives at "first.vi"?

-- Do you simply want to call "second" inside the FOR loop of "first" as a subVI call?
In this case, get rid of the while loop, add terminals, and just place the subVI inside the FOR loop.

Please tell us a bit more behind the reasoning for your design. What are typical input parameters? How are you planning to start second.vi, then stop it when it is no longer needed?
0 Kudos
Message 5 of 11
(4,912 Views)
Sorry about that. Here is a 7.0 version.
Randall Pursley
0 Kudos
Message 6 of 11
(4,912 Views)
With your modified vi for lv7.1,I got the data in attachment,assuming the x=100,y=10 and z=10.
In the second row we should get the random numbers?why not.I cannot catch it.Thanks your kindness.
0 Kudos
Message 7 of 11
(4,912 Views)
I want to add synchronization such that "second" executes exactly once per FOR loop iteration,and to save the one to one results.Of course,the two vis cannot put into a vi.

The reason I develop them are to save data and learn how to share data among vis.

whenever I need to start second vi,and then I can run it,not run with the first vi in the beginning always .

The input parameters can be string or others.The main reason I questioned here is to learn how to share data among different vis.
0 Kudos
Message 8 of 11
(4,912 Views)
Your almost there. You will need to convert the flat data to a double and then to a string for it to display correctly. First, use the 'Type Cast' function to convert the flat data coming out of the 'Get Control Value' method to a double, then use the 'Number to Fractional String' function to convert it to a string representation of the double.
Randall Pursley
0 Kudos
Message 9 of 11
(4,912 Views)
These two files should do all that you want. Notifiers are used to synch and pass data between the two vis and the first vi controls the execution of the second.
Randall Pursley
Download All
0 Kudos
Message 10 of 11
(4,912 Views)