LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

vifindrsrc issue

Solved!
Go to solution

status = viOpenDefaultRM(&updateSession);
status = viFindRsrc(updateSession, "GPIB0?*INSTR", &fList, &numInstrs, desc);
if(status < VI_SUCCESS)
 {
  viClose(updateSession);
 }
while(numInstrs--) {
      viOpen(updateSession, desc, 0, VI_NULL, &updateName);
      viClose(updateName);
      viFindNext(fList, desc);
    
 }
 viClose(fList);
 viClose(updateSession);
 updateSession = VI_NULL;

 

 

The above program is the callback function of button 'OK' in .uir. First, I turn one instrument on, click 'OK', it gets one address ('desc'); Second, I turn another instrument on, click 'OK' again, it gets two addresses; Last, I turn the first instrument off, click 'OK', but it still gets both addresses.  There is no Error during this process. Anyone can answer this question?

0 Kudos
Message 1 of 5
(5,574 Views)

Hello marqtestlab!

 

To help troubleshoot this, I would try to use MAX (Measurement Automation Explorer). If you highlight your GPIB conmtroller in MAX you should have a button to Scan For Instruments

 

When you run this do you find both instruments after one is powered off?

---

Peter Flores
Applications Engineer
0 Kudos
Message 2 of 5
(5,536 Views)
Solution
Accepted by topic author marqtestlab

I tried MAX, it's the same problem.

 

I have two GPIB instruments, Agilent DC Power Supply, and Agilent Digital Multimeter.

 

I start MAX --> View --> Refresh, It displays there are two GPIB instruments, even though I already shut one down.

 

When I click 'Open VISA Test Panel' for the disconnected instrument, it returns 'unable to open session to...'

 

So I was thinking if this is the compatability problem between NI and Agilent. Is there any other command which behaves like viFindRsrc without the problem?

 

Thank you.

0 Kudos
Message 3 of 5
(5,454 Views)

can you please tell me , how all the variables (like fList,numInstrs,desc, updateSession ) are declared and where?

0 Kudos
Message 4 of 5
(3,396 Views)

This is a very old thread whose author hasn't connected any more since 2009, I doubt you can have any help from him! In such a case, opening a new discussion is normally better. If relevant, you can add a link to the old one in your post.

 

Having said this, informations on the function can be found in the help. If you have VISA support installed in CVI, you can search for related examples with the Example Finder (Help >> Search Example menu function): this is a very basic function and you should be able to easily locate the appropriate code.

As to where to declare variables, it depends on the scope of them: they could be declared in the function where the instruction is used, thus being private to that function, or at a higher level to be common to several or all functions. It depends ultimately on how you design your application.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
Message 5 of 5
(3,384 Views)