LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Not Understanding Data Value References

Solved!
Go to solution

now kindly do help me on how to pass data from one vi to multiple vis in the same project. The methods I know are queue and global variable, both of which is not the appropriate thing for my project. 

0 Kudos
Message 11 of 47
(1,966 Views)

Ok sorry i didnt see the whole message. 

 

GerdW : Use a wire and connector panes to forward the class object. 

 

Not sure what you meant by that. Could you please help me by being more specific. 

 

 

0 Kudos
Message 12 of 47
(1,963 Views)

Hi govind,

 

Not sure what you meant by that. Could you please help me by being more specific. 

You don't know about using wires and connector panes in LabVIEW? (This is most basic stuff!)

Did you take the very beginner tutorials offered for free?

Did you notice the Training section in the header of this LabVIEW board?

 

Simple example of using two class methods on the very same object:

check.png

Two VI using wires and their connector panes…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 13 of 47
(1,962 Views)

I know how to use wires and connector panes. That is how I did the programming for create dvr data which creates a reference to the data in the labview object and i selected it to be the output of the connecter pane. Similarly I did two vis with write and read which accepts a object in its top left input connector pane. So i know this. But as I said I connect the output of create dvr to input of write and read. When I am using the same create vi and branch it both write and read, I am getting the output perfectly because I am branching the reference so it will be the same. But when I am using two create VIs, I am creating two references, so its not working. So how can I use wires and connector pane to write data in a single vi, then use the read VI as a sub VI in many different VIs in the main project, since the write vi will use one dvr reference created and the different read vis will use different dvr references created. So how can I use wires and connector pane.

0 Kudos
Message 14 of 47
(1,958 Views)

I have created a simple write and read numeric value project with these functions in 2 vis which is in one class. Now the object of this class has a DVR of a numeric value. Then I created the create DVR vi which creates the DVR. Then in the main program, I branched the create DVR to both Write and Read VI. Then when I ran it, it worked fine. The value that was written into write was read from the read vi. Now instead of branching I made a copy of the create DVR and gave the first Create DVR to write and the second to the read. But then it doesn't work: Can anyone please explain me what is the difference here.I think I know. I believe while branching I just create DVR data and giving it to many, but while I am making a copy, then I am creating two different references. I think this is the reason. If this is the reason, what can be done to achieve my second operation, because in my project, the write and read are not used in the same VI. I need to write at one VI and read in multiple VIs. So how can I achieve that. Too be more specific, i have different microcontroller boards that communicate using CAN bus. I need to initialize the can bus first and then give the initialised can bus reading to different boards which are different VIs. But now I have done it in a way that i initialise and uninitialise the can bus for every board. But that is not correct. I just need to initialise it once seperate in the CAN bus class and use it for each of the boards which have its own classes and its own methods. So how can I do that without using global variable. As far as the Value is concerned it is two rings, that is can bus type and its baudrate. I select the appropriate value in the ring and pass it to the can init vi and out comes the initailised can bus and its baud rate and I need to pass these values to different vis, not through wires, but by reference and that is how I started learning queues and dvr. Queues wont be helpful since I have multiples times the same initialised can bus and baud rate to the queue and dequeue it in one by one in multiple vis. So I moved on to DVR and till now I am not able to work with DVR the way I want. DVR also passes by value. If I use 2 create DVRs as explained before it creates 2 different references. So what is my option now.  Kindly do help me.How to make the first thing work.How to make the first thing work.

0 Kudos
Message 15 of 47
(1,952 Views)

In 1 you create two objects with each a DVR in it. These DVRs are independent of each other and hence "point" to individual copies of a numeric. Nothing can make them share the same dataspace.

 

In 2 you create one object with one DVR in it. By branching the wire you do copy the object itself but the DVR inside is for both the same.

Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
Message 16 of 47
(1,957 Views)

Hi govind,

 

since the write vi will use one dvr reference created and the different read vis will use different dvr references created. So how can I use wires and connector pane.

The Write method should write to a different DVR as is accessed by your Read method calls?

And each Read method should read from a different DVR? (Does that make sense?)

 

When all need to access different DVRs you need to create a lot of objects with their own DVR, then wire those objects to all those Read method calls…

 

Why do you still start new threads on the very same topic? Please stop that behaviour…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 17 of 47
(1,956 Views)

GerdW : 

The Write method should write to a different DVR as is accessed by your Read method calls?

And each Read method should read from a different DVR? (Does that make sense?)

 

When all need to access different DVRs you need to create a lot of objects with their own DVR, then wire those objects to all those Read method calls…

 

----------------------------------------------------------------------------------------------------------------------------------------------------------------------

I am sorry couldn't understand. My major doubt is how can I pass data in one VI to multiple VI. All the VIs in the multiple VI should have the same reference to the data in the first VI. How can I do that. It can be anything DVRs or anything. I try googling and read many things but still cannot find a solution to this one problem. 

---------------------------------------------------------------------------------------------------------------------------------------------------------------------

I am sorry I am starting new threads because I badly need to understand this. 

0 Kudos
Message 18 of 47
(1,943 Views)
Solution
Accepted by govindsankar

Hi govind,

 

how can I pass data in one VI to multiple VI. All the VIs in the multiple VI should have the same reference to the data in the first VI. How can I do that

So now you want to access the very same data? (In contrast to your former question?)

You really should learn to express your questions in a clear and understandable way…

 

To access the same data in all instances of your code you should use a wire and the connector panes of your subVIs. Did you notice the image in one of my former messages?

(Again: did you take those beginner courses to learn LabVIEW?)

 

I am sorry I am starting new threads because I badly need to understand this. 

It definitely does NOT help to spread a discussion over several threads!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 19 of 47
(1,935 Views)

Ok so I should use connector panes of subVIs which is in other words using a functional global variable. Yes I know that too. But then my doubt is wont the function in the subVI will keep on executing every time I place the subVI or FGV in another VI. Because as I said my requirement is to initialise a data at one class and use this internalised data in different other classes of the same project. So when I keep my sub VI in different VIs, wont the data get initialised again and again. That is my doubt. If that is not the case then yes I know how to use a functional global variable.  

0 Kudos
Message 20 of 47
(1,931 Views)