From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

How to enable Notify for device SRQ assertion

I am using Measurement Studio .NET class libraries (part of NI488.2) in C#. After instantiating a Device object, and adding an event for callback via the Device.Notify() method, I find that the call back is not executed when a SRQ on my device occurs. Note that when I also instantiate a Board object, and add the event for the Boad.Notify() method, I am getting a callback for the board ServiceRequest flag (see below) but not the device DeviceServiceRequest flag (see below). The only thing I can figure is that the Auto SerialPoll feature is disabled and I cannot find a reference of how to enable Auto SerialPoll in NI488.2, although it should be set by default. HELP!
 
Thanks,
Dave

// Example Code:

//This does not work
Device Gpib = new Device(0,1);
Gpib.Notify(GpibStatusFlags.DeviceServiceRequest, HandleSrqCallback, null);

// This does work
Board b = new Board(0);
b.Notify(GpibStatusFlags.ServiceRequest, HandleSrqCallback, null);

private void HandleSrqCallback(object sender, NotifyData notifyData)
{
}

0 Kudos
Message 1 of 7
(4,310 Views)

Hi Dave,

What are you trying to accomplish in your application. When you say Device.Notify() won't work, does it give you any sort of error message. Also, why are you using a Device.Notify(), whean your board call works fine. What are the events causing the callback and are you setting the timeout in the notify mask?

Thanks,

Arjun K

National Instruments
Applications Engineer
0 Kudos
Message 2 of 7
(4,278 Views)

Hello Arjun,

 

Thanks for taking the time to respond. In a nutshell, I tend to use a Device class rather than the Board class since I don't need lower-level controll of the GPIB (the documentation recommends using Device class and not Board class unless lower level control is required) and I working with a single device. So, in order to use the Board.Device() method, I am forced to instantiate 2 objects, a Device and a Board object, and that is very inefficent. In any case, the example supplied with NI488.2 (C:\Documents and Settings\All Users\Documents\National Instruments\NI-488.2\Languages\DotNET2.0\Notify\cs) does not work for me. That is, if you run that particlar example, open a connection to a device (in my case the Keithley 2602 Source Meter), and execute a function that triggers a SRQ in the device, the Device.Noify() method does not call back as documented. The exact steps to reproduce this problem are:

1. Open VS2005.
2. Load the .sln file located at: C:\Documents and Settings\All Users\Documents\National Instruments\NI-488.2\Languages\DotNET2.0\Notify\cs
3. Place a breakpoint at the line:

     testDevice.SerialPoll();

    in method testDevice_Notify().

4. Run the project.
5. Send a command to the device (via the GUI in the program) to cause the device to assert the SRQ line.

This should cause the NI488.2 driver to raise an even (in a new thread) to testDevice_Notify(). This does no occur for the Device class but does for the Board class.

With respect to timeout, the default is 100ms, if increased that to 10s with no success. So, I am under the impression the Device.Notify() method is buggy.

The work around is to use the Board class in addition to the Device class, but seems that NI would fix the base driver or at lease document an issue if it is indeed in error. There are a few others in the message archives that seem to have this problem as well.

Thanks,

Dave

0 Kudos
Message 3 of 7
(4,266 Views)
Hi Dave,
 
I would like to confirm you have opened a phone service request for this issue.  We are currently working on finding a resolution and will post the solution as soon as the issue is resolved.
 
Regards,
Andy L.
Applications Engineer
National Instruments
0 Kudos
Message 4 of 7
(4,228 Views)

Andy,

Yes. I open a service request early last week, #1037667. I spoke with Samantha who has called back a couple of times but we keep missing one-in-other. I will be happy to supply additional information as this seems to be a problem that has existed for awhile (based on another post I found).

Thanks,

Dave

0 Kudos
Message 5 of 7
(4,224 Views)

Andy,

 

I have this same situation, but what was the resolution?

 

Thanks

0 Kudos
Message 6 of 7
(3,825 Views)

Hi Reversme,

 

The device in this case did not allow for direct communication using the device specific addressing examples. The GPIB instrument had to be addressed first to access the 3rd party device. This was accomplished by using the board addressing examples. 

 

Regards,

Andy L.
Applications Engineer
National Instruments
0 Kudos
Message 7 of 7
(3,792 Views)