LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Is it possible to control an app. with another app. using global variables?

Hello,
 
I have a small program that is a driver for a power supply.
 
Now, I want to have a second program, that uses global variables, to read and write data from my power supply program. Ofcourse I have to change
the power supply driver program first to ad the globals.
 
The thing is that both programs are different programs from different projects, like if they where programmed (and compiled to *.exe) on totally different computers.
But once installed on one and the same system, they have to be able to communicate with each other.
 
Hope you guys understand my question.
Thx in advance,
Heinen 
--------------------------------
The Enrichment Center is required to remind you that you will be baked, and then there will be cake.

0 Kudos
Message 1 of 10
(3,329 Views)

The typical answer is that the "other" program would have to be written in Labview. 

I've never tried to access LV Global Variables using some other language, so I do not know if it is impossible... anything is possible, you just have to find the way.

If both programs are in Labview, then yes, you can share acess to the Global Variable.  You will have to be careful about how they acess the information (ie: are both allowed to read and write to it?).  It is to avoid a race condition.

RayR

0 Kudos
Message 2 of 10
(3,324 Views)

Thank you very much for your quick reply,

 

Both programs will be writen in LabVIEW.

Do you have tips to avoid race-conditions?

 

Just to make absolutely sure, this still works when you use the application builder to make *.exe of both programms so that they are essential 2 seperate programs?

 

--------------------------------
The Enrichment Center is required to remind you that you will be baked, and then there will be cake.

0 Kudos
Message 3 of 10
(3,321 Views)
Hi Heinen,
i recommend again to use TCP/IP. You will have a defined communication interface, you can use both programs independently and you don´t need global variables. Smiley Wink
Did you try it with VI Server as smercurio already mentioned in the other thread?
 
Hope it helps.
Mike
0 Kudos
Message 4 of 10
(3,314 Views)

there's another thread?  😮

😉

0 Kudos
Message 5 of 10
(3,303 Views)

I'm sorry to ask this a second time...

 

I looked into TCP/IP and the Server VI.

By TCP/IP I don't like the fact that you have to change the network settings on every pc you install the programs, that will give a lot of problems and I don't think it is a clean solution, because TCP/IP is for networking, not for communicating between software on the same pc. Please proof me when I'm wrong because I'm really stuck on this subject.

 

At Server Vi, I do not really get this one. It looks like it does the same as if you put the VI on the blockpanel and open it as a sub-VI. Also I always have to select the path of the VI to make a refnum, but I do not have a path or VI, because my target is a compiled labView program (*.exe). The other thing is that I can only sent data to the sub-vi once, opening it in the process, but I want to do it continuesly.

 

Please help my 😞

Maybe you guys have an easy example.

 

Thx you for you time 🙂

--------------------------------
The Enrichment Center is required to remind you that you will be baked, and then there will be cake.

0 Kudos
Message 6 of 10
(3,282 Views)

@JoeLabView wrote:

there's another thread?


Yes, and the requirements were quite vague in the other one as well.

TCP/IP is not limited to just "networking". TCP/IP can be used to "communicate" between software. It's a communication protocol, right? There are shipping examples that show you how to use TCP/IP to transfer data between 2 programs. Open the Example Finder (Help -> Find Examples) and search for "tcp/ip". Open the examples "Simple Data Client" and "Simple Data Server".

What you are talking about with the VI Server is just a small part of what you can do with the VI Server. The VI Server allows you to, for example, control a LabVIEW app from, say VB.

The reason I had suggested using the VI Server rather than TCP/IP wasn't because you can't use it to communicate between apps. It was because it was likely that using the VI Server would be less of an impact to your existing code. That was just a suggestion based on a lack of definition or details in your problem statement. In this post there is still a lack of definition and details. For example, in the other post you said you wanted to control this other app. Control it how? In this post you say you want to read/write values. What values? Where are these values entered?
Message 7 of 10
(3,274 Views)

I have been trying to do a similar thing.  Shared variables work pretty easily...I have them working well between two machines by following the shared variable concepts serach materials ....(in project explorer, add new library, then add new variable, then click help on the variable panel...) but deploying them requires following the directions about deploying libraries pretty closely.

If you are using the Project expolorer...you can put both vi's in the project...open a library (new library)...then add a shared variable (new variable).  When you define the variable (which you do in the new variable process) you can make it whatever name and type you need, and then you would pick the publish to the network (if your vi's are going to be running on two different computers)...or single-Process (if the vi's using the variable will be on the same computer).

I built a little example project but will have to send all the part in sections since you can only publish 3 attachments per page.

Hope it helps.

The Hummer.

0 Kudos
Message 8 of 10
(3,266 Views)

Next installment of the project.

 

.... the attachment feature does not allow the sending of attachments with the extensions included in the project...someone at LabView ought to look at that...I would like to send an entire project....but can't because some of the extensions on some of the project files are not allowed as attachemnts.

Hope the explanation is enough.

I'm using 8.5 Pro Dev

0 Kudos
Message 9 of 10
(3,264 Views)
The shared variable approach would work if the only thing that is being done is to transfer data. If the user is actually trying to control the other app, it's a different story. It's still not clear what the specific requirements are.

P.S. Just use a ZIP file to bundle stuff up into a single attachment.


Message Edited by smercurio_fc on 07-02-2008 10:40 AM
0 Kudos
Message 10 of 10
(3,259 Views)