Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

How to check if the 488.2 hardware is present when creating Device instance.

What is the recommended method of checking to see if the 488.2 hardware, or the GPIB instrument is present.  It seems the Device object is created regardless of what is really there.  I currently create a device, then try and get the id via IDN?.  If the write fails, then I assume something is wrong.  Is there a better way?

0 Kudos
Message 1 of 4
(3,477 Views)

Dear _Programmer_,

 

What NI Hardware are you using?  A PCI-GPIB device pehaps?

Using Measurement & Automation Explorer (MAX) open find your device, open up the "communicate with instruement" window and do a query.

I would say this is the easiest way.

 

Sincerely,

Sammy Z.

0 Kudos
Message 2 of 4
(3,454 Views)

Sorry, I should have been more clear on this one.  I'm using the 488.2 USB GPIB interface and the NI .NET drivers.

I was asking about how I would know if an instrument is there when writing a program using the NI driver.

 

I create a device:

 

NI4882.Device myDevice = new NI4882.Device(0, 0x05);

 

I get a valid device no matter if the USB interface is attached to my computer or not.  I will also give a valid device back when there is no instrument present.  It isn't until I try and write to the device that I will get an error.

 

I was wondering if there is a better way to figure out if everything is okay before doing a write.

 

Thanks.

Message Edited by _Programmer_ on 03-27-2009 05:38 AM
0 Kudos
Message 3 of 4
(3,444 Views)

Dear _Programmer_,

The line of code that you have is attempting to set the device, so you are experiencing the expected behavior.

The easiest way to go about it is to do an initial IDN?. 

 

As extra resources for you to help with your application, please use the .NET examples.

 

Thanks,

Sammy Z.

0 Kudos
Message 4 of 4
(3,422 Views)