LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

C++ communication between Labview and one application

Your modifications for tcp/ip support would require strong skills. Either way, spend some with the shipping examples and free tutorials. You need to get to at least a basic level of understanding.
0 Kudos
Message 21 of 32
(1,116 Views)

Yes, I will not use more than the VI provided by gregFreeman. The first will be included in the famous while. The second will be used to make a wrapped a dll.

Thus, I will call the value when I want.

0 Kudos
Message 22 of 32
(1,109 Views)

@gautierdufourcq wrote:

Actually, the VI is a big while loop because of acquisition. The loop never stops so I cannot access to any value inside. But if I do not understand the ideau of a global variable, correct me.


A DLL can export multiple functions. At the moment it sounds like you only call one such function, which is the main loop VI. But you could add additional VIs as well. You can use those VIs inside your main loop and also call them through the DLL, so this provides a way to share data. A Functional Global Variable (FGV) is a LabVIEW VI that uses an unitialized shift register to store data between calls. One parameter of such a VI indicates whether to read or write the data. In your case, to get data from the main loop back to the calling program, the main loop would call the FGV and write new data into the shift register. The calling program would call that same function through the DLL and read the data. This is much simpler than adding TCP communication.

0 Kudos
Message 23 of 32
(1,099 Views)

I realize that the TCP is not a good solution because ti get the value, I need to start the client and it waits for the server. It is not what I want.

 

About the FGV.

If I understand, I remove the loop and I replace the variables by FGV (excepted the variables from the frontpanel to control them with the frontpanel ?). But is it possible to replace all of them easily ?

0 Kudos
Message 24 of 32
(1,078 Views)

The TCP is not good for my application because when the client has the data, the socket closes. So, I am going to try to do something with a global variable.

0 Kudos
Message 25 of 32
(1,069 Views)

@gautierdufourcq wrote:

The TCP is not good for my application because when the client has the data, the socket closes. So, I am going to try to do something with a global variable.


What? You have done something wrong.

0 Kudos
Message 26 of 32
(1,063 Views)

gautierdufourcq wrote:

About the FGV.

If I understand, I remove the loop and I replace the variables by FGV (excepted the variables from the frontpanel to control them with the frontpanel ?). But is it possible to replace all of them easily ?


No, you don't remove the loop. Not sure what you mean by "replace all the variables." All you are doing is adding one or more extra VIs that store data, then calling those same VIs (while the main loop is still running!) through the DLL interface. Remember that an FGV is a VI. You can store multiple pieces of data in one VI using a cluster or an array, or you can store them in separate VIs. You could also store several pieces of data in the same VI, but return them individually; you'd just need to add another parameter indicating which value to return.

0 Kudos
Message 27 of 32
(1,051 Views)

Thank you everybody for your answers.

For the TCP, indeed, whan I call the client, the connexion stops. So, maybe I made a mistake but I tried twice.

Another idea, it was to use a global variable. I tried, but I cannot access to the value when I call the wrapped dll. The problem is perfectly described there

http://forums.ni.com/t5/LabVIEW/how-to-build-labview-global-variable-into-dll-And-how-to-use-it/td-p...

Is there a way to export global variable ?

Best regards

0 Kudos
Message 28 of 32
(1,035 Views)

Ok, I deleted the close of TCP in server. It runs, but I must start client then server in this order. It is not good for me because I have always the server speaking and sometimes the client comes. Would it correspond to UDP ? Thank you again.

0 Kudos
Message 29 of 32
(1,031 Views)
Please read what I'm writing. You are not trying to add a global variable to your program. You want to add a Functional Global Variable, which is actually a VI that acts like a global variable in that it stores data. Since it is a VI, you can call export it to a DLL.
0 Kudos
Message 30 of 32
(1,033 Views)