LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

two separate executables conflict

Hi,

 

I have some Motion Control cards and Digital and Analog IO cards, controlling 2 different sets of hardware and I have two different LabVIEW programs (executables) to control them. However, they share some of the cards (even ports). The problem I have is: When I run both programs at the same time, I get NaN when I fetch data from the Analog IO cards and some other conflicts. Apart from combining the two programs (which is hard), is there any workaround for this?

Thanks!

 

--ray

0 Kudos
Message 1 of 4
(2,534 Views)

If I'm not mistaken, you usually cannot run more than one task accessing Analog Inputs on the same board.

 

A way out of your problem could be to use one of your programs to read all the AIs, and then to make them available to the other one (via Datasocket, TCP/IP, shared Variables, etc...).

 

Marco

0 Kudos
Message 2 of 4
(2,522 Views)

Marco is correct. You cannot run two analog input tasks at the same time. This is a hardware limitation, not a software one.

 

Your question is really more of a generic one with two programs trying to access the same hardware resource. Basically you have the following options:

  • Make the programs smart enough to determine if the hardware is in use and wait until the hardware is freed up to be able to use it.
  • Use Marco's suggestion and have one program collect the data and make it available to the other. This may be cumbersome if the programs are intended to be independent, as it would mean the program that is collecting data must be running all the time.
  • Use a third process to collect the data and make it available to either of your two programs. This means you still need the collection program running all the time, but it makes your two existing programs independent of each other.
  • Use additional DAQ hardware.
0 Kudos
Message 3 of 4
(2,501 Views)

Thanks for all your suggestions. I'm now creating a new program for obtaining the data (I call it Data Fetcher) and make the data available to the other two programs (Let's call them Prog A and Prog B for now) through DataSocket.

As a first step, I'm testing it out on Prog A. I noticed that when data fetcher is running but prog A is not running, the data is constantly read out from the hardware, even though prog A is not processing it. In the reverse case: Prog A is running, but data fetcher is not running, Prog A processes the same set of data over and over.

However, what I want to do is that every set of data obtained is processed exactly once by prog A. Since data fetcher and prog A are most likely not running at the same rate, there must be some data lost or some data get processed twice (or more). So, how do I avoid this?

Thanks,
Raymond

0 Kudos
Message 4 of 4
(2,440 Views)