LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

programmatically check if instrument is connected

I'm trying to modify a program to enable/disable certain parts depending on whether or not the instrument it controls is connected via GPIB.  There is limited functionality of the program that I still want to use even if the instrument isn't actually connected and turned on.  Is there a way to check the GPIB connection programmatically that won't throw out all kinds of run time errors if it isn't connected?

0 Kudos
Message 1 of 15
(2,449 Views)
Highlighted
You can query the instrument. The only thing that will happen is a timeout if it's not connected. You can easily trap that that error.
0 Kudos
Message 2 of 15
(2,446 Views)
Highlighted

You can use the Visa Find Resource Function to get a list of GPIB actively connected to the computer. Then you can send an *IDN? query to each and match it against a list of known instruments to check if the required instrument is connected and communicating.

 

0 Kudos
Message 3 of 15
(2,438 Views)
Highlighted

I used something like this(see attached ) to check my lock-in communication which uses GPIB connection.


@Stephen.E wrote:

I'm trying to modify a program to enable/disable certain parts depending on whether or not the instrument it controls is connected via GPIB.  There is limited functionality of the program that I still want to use even if the instrument isn't actually connected and turned on.  Is there a way to check the GPIB connection programmatically that won't throw out all kinds of run time errors if it isn't connected?


 

0 Kudos
Message 4 of 15
(2,437 Views)
Highlighted

@Tavar wrote:

You can use the Visa Find Resource Function to get a list of GPIB actively connected to the computer. Then you can send an *IDN? query to each and match it against a list of known instruments to check if the required instrument is connected and communicating.

 


Thanks, I'll give this a shot.

 

 


@AnkitG wrote:

I used something like this(see attached ) to check my lock-in communication which uses GPIB connection.

 


 I'm not familiar by sight with all of the commands you used.  Would you mind uploading the .vi file?  Thanks.

0 Kudos
Message 5 of 15
(2,426 Views)
Highlighted

@Stephen.E wrote:

@Tavar wrote:

You can use the Visa Find Resource Function to get a list of GPIB actively connected to the computer. Then you can send an *IDN? query to each and match it against a list of known instruments to check if the required instrument is connected and communicating.

 


Thanks, I'll give this a shot.

 

 


@AnkitG wrote:

I used something like this(see attached ) to check my lock-in communication which uses GPIB connection.

 


 I'm not familiar by sight with all of the commands you used.  Would you mind uploading the .vi file?  Thanks.


Those are just visa write , read function and then I am converting decimal to numbers and numbers to boolean to check the status.

0 Kudos
Message 6 of 15
(2,405 Views)
Highlighted
The image shows code that is pretty specific to a certain instrument. In all of the suggestions, you will get the timeout rror that I mentioned.
0 Kudos
Message 7 of 15
(2,403 Views)
Highlighted
Can't edit my post.

You'll actually get an error on a write because of the lack of handshaking.
0 Kudos
Message 8 of 15
(2,393 Views)
Highlighted

@Dennis_Knutson wrote:
Can't edit my post.

You'll actually get an error on a write because of the lack of handshaking.

I'm not entirely sure if I understand what you are saying or not.  Let me talk my way through it and see if it sounds correct.  Are you saying that I could use a visa write, then just unbundle the status bolean from the error and that will essentially tell me if the instrument is connected or not?  Failing the visa write wont cause any runtime error messages to pop up?

0 Kudos
Message 9 of 15
(2,370 Views)
Highlighted

@Stephen.E wrote:

@Dennis_Knutson wrote:
Can't edit my post.

You'll actually get an error on a write because of the lack of handshaking.

I'm not entirely sure if I understand what you are saying or not.  Let me talk my way through it and see if it sounds correct.  Are you saying that I could use a visa write, then just unbundle the status bolean from the error and that will essentially tell me if the instrument is connected or not?  Failing the visa write wont cause any runtime error messages to pop up?


If you handle the error and clear it, there won't be a pop up.  But your are correct.  If there is an error from the VISA write, your instrument is not there.  You can just unbundle the status boolean.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
0 Kudos
Message 10 of 15
(2,364 Views)