LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Testing for the presence of a device

Solved!
Go to solution

Is there a simple method to test for the presence of a device?  I have a 9172 chassis that I occasionally forget to turn on so my LabVIEW VI errors out the first time it tries to do something with the hardware (and I need to resart the VI and reenter the GUI selections Smiley Mad).

 

I would like to find a nice simple way to test to be sure the cassis is connected tot he PC and turned on and if it isn't give a not so subtle remicer to do so before proceeding with the actual test portion of the code.

 

Any ideas?

0 Kudos
Message 1 of 6
(568 Views)

Trying querying the device for some status or ID before completing your initialization. If this fails then inform the user.

 

This also sounds like your application could benefit from some UI enhancements which allow for error recovery in general. I get the impression that the user has one chance to set values when running the program. When writing an application that is interactive (the user will be present) it is always best to have error recovery techniques and provide as much control to the user as possible. Things like pausing or aborting an action, exiting, saving configuration values, reconfiguring and restarting if an error occurs, etc.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 2 of 6
(565 Views)

Any suggestions how to query a 9172 chassis or any of its modules?

0 Kudos
Message 3 of 6
(554 Views)

I recommend using the DAQmx System and Device property nodes, similar to something like this:

 

Finding Modules in cDAQ-9172.png

Seth B.
Principal Test Engineer | National Instruments
Certified LabVIEW Architect
Certified TestStand Architect

Engineers like to solve problems. If there are no problems handily available, they will create their own.
0 Kudos
Message 4 of 6
(548 Views)
Solution
Accepted by topic author MJHanagan

You may want to look at this thread. Also, what type of communication do you have in your application now? What devices do you expect to be there? I have to assume that your applications runs if the chasis is turned on. So, you have known equipment that you do communicate with now. Any status query of any of these devices would be enough for you to determine if the chasis is there or not. If you can connect and get a response you are good to go. If not, then you need to have the user turn the chasis on, connect it or whatever to resolve the problem.

 

For your application you could use a producer/consumer architecture or a state machine which would allow you to stay in the initialization state before proceeding if you cannot communicate with the device.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 5 of 6
(545 Views)

Ah ha! I stumbled into something very similar. across something.  I tried to read the DevSerialNum which when it is off (not connected) I get an error code of -200220 and no error code when it is not present.  I then fed the error status (AND withthe -200220 error code value) to a case structure for the appropriate action.

 

Thanks for your help!

  

0 Kudos
Message 6 of 6
(538 Views)