LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

get access to a value in a running while (with C++)

Good morning,

I have a serious problem. I run a Vi with a while loop (for acquisition). In this loop, there are many values. I want to access to them while the loop is running. The problem of my VI is it does not give me the value until the loop has not finished. But I want to acces to it before the end.

The ultimate objective is to access to this value in a C++ code. In this code, I implemented threads. But since Labview does give me back the value until the VI has not finised... but it must never finish. What does do Labview when I call the VI with values and pointers from C++ ? Can I access to the value inside the running loop in real time ?

Thank you for your answers.

G.D

0 Kudos
Message 1 of 6
(2,549 Views)
I don't understand why you wouldn't do the data acquisition in c++. I also don't understand why your LabVIEW code needs to have a while loop. Your loop could be in the c++ code.

Are you planning on making a dll or using the ActiveX interface.
0 Kudos
Message 2 of 6
(2,520 Views)

I thank you for the reply. The acquisition could be in C but the VI is to much complicated, I did not do the Vi which is very dirty. The VI regulates a temperature system and using C++ would not be a big advantage. The acquisition is so in real time and the while loop is obligatory. About doing the while loop in C++, I thought to this so I am going to try. I only hope that the NiDaq and the Visual Studio 2003 will be happy together. This is a potential good idea thank you very much. If it does not function, I will try to write the VI in C++. If you have any other piece of advice, I will read them carefully.

Best regards.

G.D

0 Kudos
Message 3 of 6
(2,510 Views)
Before doing the loop in c++, you would of course have to remove it from the LabVIEW code.
0 Kudos
Message 4 of 6
(2,507 Views)

Of course ^^ but it is not the most difficult. Because in fact, with C++, I want to create another dll. This dll, I must call it with a software called digital micrograph. I don't even know if it will work. I first be at ease with Tasks name handling etc because i will put them at the entrance of the VI. Do you have an opinion ?

0 Kudos
Message 5 of 6
(2,503 Views)

I think the best design is to completely separate both components from one another and define an appropriate interface inbetween.

 

One possible flavor of a design would be to have two executables (one LV, one .NET) which interface using some ethernet protocol (based on TCP or UDP). The .NET application sends commands, the LV application reacts and sends status information.

Example (displayed from the .NET application view):

You have one command to push a new set-point. You receive an acknowledge.

You have a command to request continuous status updates (potential parameter: update rate). You receive an update of the current value until you send a command to stop updates. This approach is often called "register/unregister" method.

 

Norbert

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 6 of 6
(2,485 Views)