From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do run two instances of a LabView program

Hi,
 
I have a LabView application that is used for RS-485 diagnostics with a 2-port PCMCIA card in a laptop.  The application is written to access only one of these ports at a time, although the user interface does allow the user to choose which one.  What I need to do is to run two instantiations of this application, accessing one port per application, yet keeping them completely independent.  How do I do this?
 
So far, I have complied an executable application, but they don't seem to be independent.  Could it be that opening one port interferes with the other.  Also, renaming the app doesn't seem to work.  It does seem clear that I have to run a compiled application because I can't run the same VI with the same subVI's independently within LabView.
 
Thanks,
 
Jason
0 Kudos
Message 1 of 3
(2,337 Views)
Jason,

Here are a couple of things to think about:

To run within the LabVIEW environment you could make the subVIs reentrant. This creates a separate data space for each instance of the VI. It does, however, mean that you cannot use the subVI's front panel.

The built executables share the LV run time engine so there may be resource contention when you try to open the second port.

I think you should be able to write a program in LV using VIs without reentrancy that will do what you want. Try a simple program which opens Port 1 and then Port 2 using the standard communications VIs (VISA?) and checks for errors. Multiple port stuff is done all the time. Unless the PCMCIA card does not support it. If this works then you could put together a program which monitors both ports as a single port and the port number is a parameter.

Lynn
0 Kudos
Message 2 of 3
(2,333 Views)
Hi Jason,
 
Try something like the attached vi. This should let you run the same application to control a different serial port separately. I think the key is you need to make sure only one VISA resource is opened during an operation. 
0 Kudos
Message 3 of 3
(2,305 Views)