Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

long delays when calling GPIB function

Hi,
 
Software: VB 6
GPIB Card: NI PCI-GPIB
   --> Visa.dll  File version: 2.6.0.7
Hardware: Agilent
Window OS: Window 2000
 
When my VB program call the GPIB function (eg. Viopen), there is a long delays
and this is causing my whole program to be very slow.
 
Any suggestion ? Thanks
 
 
0 Kudos
Message 1 of 5
(3,739 Views)
How long are the delays that you say you are seeing, and on exactly which function calls to you see them?

If this is only occurring on viOpen,  then this is not normally a problem.  Each resource only needs to be opened once, so small delays here are typically unimportant, because it is a one time delay.  If you are calling viOpen repeatedly, then you should restructure your program to eliminate the unnecessary calls to the viOpen function.

-tuba
0 Kudos
Message 2 of 5
(3,722 Views)
Hi Tuba,
 
Below is the VB6 programming:
 
VB6 Programming:
*******************************************************************
status = viOpenDefaultRM(defrm)
   If status = VI_SUCCESS Then
     Call viOpen(defrm, "GPIB::" & addr & "::INSTR", 0, 0, vi)
     Call viVPrintf(vi, cmd, 0)
     Call viClose(vi)
     Call viClose(defrm)
****************************************************************** 
 
Problem: executing of viOpen will cause a delay before it moves on to
viPrint. This delays is causing my program to be very slow.
 
Previously I do not encounter any problem with this program but when I set
up another new station, I face this delays problems.
 
I need to call the viopen repeatly as I need to send commands
to the instrument.
 
Thanks
 
0 Kudos
Message 3 of 5
(3,713 Views)
You still did not mention how long the delay is.  Are we talking about several seconds, or a delay in the area of milliseconds?  You can use NI-SPY to determine a timestamp for each driver call, which will allow you to determine the actual duration of the delay.

The larger problem is that you are running viOpen repeatedly.  You should open your resource when your program is initializing, then use the same VISA resource throughout your program, only closing the resource when your program is exiting and cleaning up its resources.  Doing so will make any delays insignificant, because it only occurs once in the program instead of every time you write to the instrument.

-tuba
0 Kudos
Message 4 of 5
(3,709 Views)
Hi,

this may be:

- a VISA problem -> then you might try ib functions
- a hardware incompatiblity -> then you might try to remove any
unnecessary board ( sound card and so on ... (obviously if your GPIB
application is vital compare to other boards) )

To make it in five minutes with ib functions, you can try an
independant free
software (www.labtab.com) and send an "idn?" command to your device
with its toolbar. You can also use a direct dialog tool of NI.

Another possibility might be that you have two controllers with the
same VISA name ( one GPIB0 from NI and one GPIB0 from Agilent or other
manufacturer then it is a VISA conflict , but it is a very uncommon
situation ...)

Regards,

FG

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