Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Do I need to initialize the GPIB board?

119 views
Skip to first unread message

John Nordling

unread,
May 16, 2003, 10:53:02 AM5/16/03
to
I'm having a great deal of difficulty connecting an instrument to our
computer using a GPIB interface and the CVI driver supplied with the
instrument, and I came up with a fairly obvious question, which I
can't find the answer to.

In my program, do I need to initialize the GPIB board itself, or is
this done for me when I call the OpenDev function to open a given
device? The reason I ask is that my errors happen approximately 2/3
of the time, and I can't seem to find any real rhyme or reason to
them.

thanks,

John

Daniel

unread,
May 19, 2003, 7:25:23 AM5/19/03
to
John, try to use the ibdev() function if you don't.
Below is an example:

/****************************************************************************/
te_booleen MultiMetreInitialise (void)
/****************************************************************************/
{
int idMultiMetre;
DisableBreakOnLibraryErrors ();
idMultiMetre = ibdev (0, 22, NO_SAD, T3s, 1, 0);
return idMultiMetre;
EnableBreakOnLibraryErrors ();
}


Hope this helps,
Daniel


John Nordling <x...@no.email> wrote in message news:<506500000008000000F9...@exchange.ni.com>...

Ray K

unread,
May 20, 2003, 9:09:59 AM5/20/03
to
The CVI driver should come with an example program that you can test
communication with.

The GPIB board does not have to be initialized and Daniel is right,
ibdev is the recommended method to obtain an instrument handle.

You may also want to test communication with IBIC. <a
href="http://www.ni.com/support/gpib/max/ibic.htm/">This webpage</a>
explains how to use IBIC.
Launching IBIC: Measurement and Automation explorer >> Tools >>
NI-488.2 >> Interactive Control

Also, the errors themselves may indicate what you may be doing wrong.
What errors have you been getting?

Daniel

unread,
May 21, 2003, 7:08:29 AM5/21/03
to
John,

We had probably the same GPIB problem as you have. The program worked
fine for a while, but then crashed at some point. It was on Windows 95
or 98. For versions above that, I didn't test them.

We finally found out this workaround:
You have to find the GPIB first, before opening the device. It has to
be the same GPIB device than the one that you will open afterwards.

Here is an example (almost the same I gave you before, but I just
found the workaround in my sources again. It was missing at first):

/****************************************************************************/
int MultiMetreInitialise (void)


/****************************************************************************/
{
int idMultiMetre;
DisableBreakOnLibraryErrors ();

idMultiMetre = ibfind ("GPIB0"); /* This line solves the GPIB bug */
if (idMultiMetre>=0)


MultiMetre = ibdev (0, 22, NO_SAD, T3s, 1, 0);

EnableBreakOnLibraryErrors ();
if (idMultiMetre < 0)
{
// error message here
}
return idMultiMetre;
}

Hope this will help you, and please tell it here if it does, for the
next ones having this problem.

Regards,

Daniel

John Nordling

unread,
May 21, 2003, 9:06:04 AM5/21/03
to
I tried putting in an ibfind call yesterday afternoon,
and it seems to have cleared up several of my
problems. The function I wrote to ensure that my
board is initialized is contained below:


void InitializeGPIB()
{
GPIBboard = ibfind ("gpib0");
ibpad (GPIBboard, 0);
ibrsc (GPIBboard, 1);
ibsic (GPIBboard);
ibsre (GPIBboard, 0);

}

Additionally, in the driver file, I replaced the call
to OpenDev with a call to ibpad, and that also seems
to help.

again, thanks for all the help.


-John

0 new messages