Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

ibdev & ibonl use

We have a simple instrument control program using GPIB NI 488 library with Visual Basic to automatically configure a signal generator.
 
This program is compiled and is then called repeatedly by another program for automated testing purposes.  We are able to communicate with the instrument as required with this VB GPIB program.
 
The problem is that after many executions the PC (WinXP) crashes.  We are suspicious that our VB GPIB program is not releasing the memory after each execution so that eventually all memory is consumed resulting in a crash. 
 
We are using the ibdev command once on each execution.  However, we are not using the ibonl command at the end of the program (in fact we are not using ibonl at all).  Is this required to release the memory?  Or is there another command that should be used to close out the GPIB session and release the memory?
 
Thanks,

Don

0 Kudos
Message 1 of 4
(6,113 Views)

IBONL is needed to release the occupied resource - GPIB handle (which is also known as Unit Descriptor in NI-488.2 terminology).  On the other hand IBDEV creates a GPIB handle from resources that are not occupied yet.  Because the GPIB system configuration for "DEVx" are set up DEV1 .. DEV16 as default for GPIB0, there are only 16-time chances to succeed IBDEV without using IBONL. 

To always succeed for IBDEV call, you need IBONL call for each.  An alternative way is use IBFIND instead of IBDEV.  IBFIND returns duplicated GPIB handle even if the resource is already occupied by other IBFIND/IBDEV calls.  So it will work without IBONL.

0 Kudos
Message 2 of 4
(6,103 Views)
You should call ibonl for each time you call ibdev.  The NI-488.2 driver limits the number of available handles to 1024.  Upon opening the 1025th handle, the NI-488.2 driver should return an error.  However, the fact that your system crashes concerns me.  What hardware and driver version are you using?  I know that we test this particular condition for our modern drivers.  If there is an issue with a recent release, we would like to take a deeper look into it.

Thanks,

Craig A.
National Instruments Engineer

0 Kudos
Message 3 of 4
(6,089 Views)

Hi Craig,

I don't know for sure, but I think our NI PCI-GPIB cards were purchased in and around 2000.

The cards were just installed in August in our new WinXP PC's so I thought the drivers were recent.  However, I see that the drivers are actually dated 1999/2000 although I don't know what version they are (1.7?).  I assume I should get version 2.4.

Thanks,

Don

0 Kudos
Message 4 of 4
(6,077 Views)