Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Using Ibnotify() in GPIB

The function call Ibnotify() returns EARG(4) error.
Our application is written in Borland C++ we are using Windows 2000 OS. I modified our code looking at the example for ibnotify in NI Reference books.

Can you please help me why I am getting this error and how to fix it.

Thanks
Praveen.
0 Kudos
Message 1 of 11
(4,581 Views)
There are two possible problems with your code which will give you an EARG error. First, you may have passed an invalid mask to the ibnotify() call. Second, you may have passed an invalid function pointer to the ibnotify call.
0 Kudos
Message 2 of 11
(4,581 Views)
Hi,

I am passing RQS defined in decl-32.h file for the mask, and the function pointer for the call back function is defined. I am still getting the same error.

Aslo, I tried to run the ibnotify from the interactive control even there I am getting the same error. Could you please help Thanks
Praveen.
0 Kudos
Message 3 of 11
(4,581 Views)
Now I see what the problem is. You're probably using the RQS mask with a board handle instead of a device handle. ibnotify with RQS in the mask indicates that you want the driver to notify your application when the GPIB device that you have a handle to has requested service. If you're using all board-level calls, you may want to use ibnotify SRQI to detect when the SRQ line has been asserted. Otherwise, you must use ibnotify RQS with a device handle.
0 Kudos
Message 4 of 11
(4,581 Views)
I am using the device handle not the board handle.
following the code that I am using.
Please let me know if I am doing anything wrong.

Thanks
Praveen.

//Declaration of the call back function.
extern "C" int __stdcall MyCallback (int ud, int LocalIbsta, int LocalIberr, long LocalIbcntl, void *RefData);

main()
{
if ( (pcBoardId = ibfind("GPIB0")) < 0 )
{
Error Message
}

int tmOut = T10s;
ibtmo( cellBoardId, tmOut );
//S2Cell is the name of the device.
if ( (cellBoardId = ibfind("S2CELL")) < 0 )
{
Error meessage;
}

ibnotify(cellBoardId, RQS, MyCallback, NULL);
if (ibsta & ERR)
{
ibonl(cellBoardId, 0);
return (FAILURE);
}
}


//My call back function definition
int __stdcall MyCallback( int Localud
, int LocalIbsta, int LocalIberr, long LocalIbcntl, void *RefData)
{
char SpoolByte;
int expectedResponse = 0x40;

//Read the serial poll byte from the device. If the ERR bit is set
//in ibsta, then set the Variable DeviceError to ture and return.
LocalIbsta = ibrsp(Localud, &SpoolByte);
if (LocalIbsta & ERR)
{
DeviceError = true;
return 0;
}

//If the returned status byte equals the expected response, then the
//cell has the valid data to send; otherwise it has a fault condition to report.

if(SpoolByte != expectedResponse)
{
DeviceError = true;
return 0;
}
GPIBAsyncLink::dataToRead = 1;
pLink->ProcessLink();
return (RQS);
}
0 Kudos
Message 5 of 11
(4,581 Views)
I was able to connect to the device directly (pcmci-gpib) with the same code above and ibnotify() function call was successful.
When I try to do this with ENET I am getting the above error.
Also, I tried to connect thru ENET from within the lab and it was working fine.

We are about 1-2 miles away from my office to the lab.
FYI.
Praveen.
0 Kudos
Message 6 of 11
(4,581 Views)
Are you using a GPIB-ENET or a GPIB-ENET/100? What driver version are you using? What firmware version is on the ENET?
0 Kudos
Message 7 of 11
(4,581 Views)
We are using GPIB-ENET.
And we are using 2.10 version of NI-488.2.

I am not sure what is the firmware version on the ENET.
We have not updated the Firmware for last three years.
How do I find out what is the firmware version?
Thanks
0 Kudos
Message 8 of 11
(4,581 Views)
The most recent firmare can be found here: http://digital.ni.com/softlib.nsf/websearch/816AA92FBCEA836086256B410077732B?opendocument&node=132070_US

The current revision of the firmware is A.5. This firmware version added support for ibnotify.

You can update the firmware using the GPIB-ENET firmware update utility. It is located in (Installation Directory)\NI-488.2\GPIB-ENET\update.exe.
0 Kudos
Message 9 of 11
(4,581 Views)
I have updated the Firmware on the GPIB ENET with the latest file. Still I am not able to communicate, from my office. As I mentioned earlier, I can communicate to the device from within the lab.

Do you think ibnotify needs any special ports open for communicating from outside. The ENET is inside the firewall?
0 Kudos
Message 10 of 11
(4,581 Views)