LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Retain values reloading vi

I'm using DAQ boards from Measurement Computing. I created a program that reads information from two DAQ boards at different times. The problem is that I can't have both DAQ boards plugged in at the same time due to the two DAQ boards physically being too far apart. This has created a problem because once I unplug one of the DAQ boards and walk over to the other DAQ board the program won't respond to the new DAQ board and I have to restart the program.

So, the DAQ boards only work until one is unplugged, then no new boards will read. My question is can anyone think of a way where I can circumvent this problem?

 

I was thinking about aborting the VI, reloading the VI, and then trying to find a tricky way of restoring the values to all the controls and indicators on the VI. 

I'm currently running the VI in a Tab Control where I am using Invoke Nodes to run 3 VI's in 3 panels. My thoughts were about somehow reloading those VI's and restoring the values. I'm not sure that's possible though.

0 Kudos
Message 1 of 7
(2,640 Views)

Hi,

Suppose you unplug one DAQ when your code is in read mode,DAQ acquisition vi will generate error. Then you should move to an error state where you will wait for other DAQ to connect.

In this way you do not have to stop and reload your vi.

I hope I made my point clear.

Gaurav k
CLD Certified !!!!!
Do not forget to Mark solution and to give Kudo if problem is solved.
0 Kudos
Message 2 of 7
(2,618 Views)

I'm confused how I move to an error state. What do you mean?

0 Kudos
Message 3 of 7
(2,604 Views)

You need to look for the error in the DAQ loop when you unplug your DAQ card. When you see this error you need to make your code recover. You can reinitilize the daq until the error goes away and you start reading again. If you have the error passing through your code you should be able to probe the error and see what code you get when you have an error and responde to that number when it is thrown. Stop the old session and restart a new session until the error goes away.

Tim
GHSP
0 Kudos
Message 4 of 7
(2,601 Views)

I've figured out what the error # is going to be, but I'm going to have to sit down and try to figure out how with the ULx Measurement Computing Labview vis how to stop the session and start a new one. I have the VI reinitilize the DAQ everytime before I run the subvi that acquires the signal from the board. I thought that would be enough, but it's not and I need to figure out how to manage this.

0 Kudos
Message 5 of 7
(2,590 Views)

In the ULx program from measurement computing a VI exists that starts the task and is where I think the problem is, but I can't figure out how to reinitilize the DAQ board when the error occurs.

 

I could easily just wait till I get the error code and reinitilize if I knew how to actually do that, but since everytime the DAQ board is called it uses the ULx VI to start the task I would think that it should be happening anyway.

 

So I'm not sure what to do at this point.

0 Kudos
Message 6 of 7
(2,580 Views)

Have you tried calling the "ULx Clear Task" VI?  After you call it you will need to re-create a new task with the "ULx Create Virtual Channel" VI before starting the new task, reading, or writing.


Certified LabVIEW Architect
TestScript: Free Python/LabVIEW Connector

One global to rule them all,
One double-click to find them,
One interface to bring them all
and in the panel bind them.
0 Kudos
Message 7 of 7
(2,506 Views)