Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

viFindRsrc() returns VI_ERROR_INV_SETUP?

ViStatus status;
ViSession defaultRM = VI_NULL;
ViSession instr = VI_NULL;
ViFindList fList;
ViChar desc[VI_FIND_BUFLEN];
ViUInt32 numInstrs;

status = viOpenDefaultRM(&defaultRM);

if (status < VI_SUCCESS)
{
MessageBox("Error initializing VISA ... exiting");
return;
}

status = viFindRsrc(defaultRM, "GPIB0::3::INSTR", &fList, &numInstrs, desc);
if (status < VI_SUCCESS)
{
MessageBox ("Failed to find resources");
viClose(defaultRM);
return;
}

 

Hello,

 

the viFindRsrc() in my code above returns:

 

VI_ERROR_INV_SETUP

Unable to start operation because setup is invalid (due to attributes being set to an inconsistent state).

 


Everything works fine if I connect to my instruments instead of searching for it,

for example if I delete the viFindRsrc() line and call viOpen() instead:

 

 

status = viOpen (defaultRM, "GPIB0::3::INSTR", VI_NULL, VI_NULL, &instr);

 

In this case viOpen() returns VI_SUCCESS.

What's wrong here???

0 Kudos
Message 1 of 7
(7,923 Views)

Not quite CERTAIN what is wrong 😉 BUT, I have a good idea-

 

My GUESS is that you a trying to "find" an instrument that is not IEEE 488 compliant.  I've seen the smae problem connecting to a Yokogawa 7651 Power supply and a Sigma systems C4 oven controller.  The 7651 does not respond to the required *IDN? and actually hangs up the instrument.  The C4 controller misinterperates an *IFC as a quit controlling command.  What is the instrument you have?


"Should be" isn't "Is" -Jay
0 Kudos
Message 2 of 7
(7,908 Views)

I've got a HP34970A data aquisition unit and a USB/GPIB controller Agilent 82357A.

The HP34970A responds to the *IDN? request and can even be found by the Agilent console application "vifind32.exe".

However, Agilent VISA is installed as secondary VISA.

0 Kudos
Message 3 of 7
(7,906 Views)

Great!  I'm glad you don't have a instrument problem!

 

You will probably get quicker results from Agilient since the system you have has Agilient GBIP controller Hardware, VISA software and Agilient instruments.  I bet their App engineers can get right to the problem.

 

Good luck 


"Should be" isn't "Is" -Jay
0 Kudos
Message 4 of 7
(7,903 Views)

If you are trying to determine whether or not an instrument is present, the viOpen is going to be much more reliable. I believe the viFindRsc will only return the results of the last refresh in MAX and may not necesarily up to date.

 

That being said, I have no idea why the function fails. There could be some weird interaction between Agilent and NI VISA. Have you enabled tulip support and does the instrument actually show up in MAX? Is the instrument listed in the visaconf.ini file? What kind of software are you using that you even find it necessary to install NI VISA?

Message Edited by Dennis Knutson on 07-08-2009 10:54 AM
0 Kudos
Message 5 of 7
(7,899 Views)

Hi,

 

I agree with Dennis: does it show up in MAX?

 

It would also be good to see if it works when only NI-VISA is installed, that way we could know if it related to the presence of agilent visa.

 

Regards,

0 Kudos
Message 6 of 7
(7,857 Views)

Yes, it does show up in MAX, but in the following manner:

 

Devices and Interfaces ->? Miscellaneous VISA Resources -> GPIB::3::INSTR

 

I guess the root cause is in fact some conflict between NI-VISA and Agilent VISA or the Agilent USB->GPIB controller.

0 Kudos
Message 7 of 7
(7,853 Views)