04-06-2017 03:49 AM
I have a C# application using several devices and I want to use Notify for some of them. It works most of the time but for some devices addressing them cause a driver error. Here are the details.
I send a "*SRE 16" command to two or three devices, then I configure them to be polled on SRQ like this:
board.Notify(notifymask, notifycallback, null); //mask selects bit 4
notifylist.Add(device); //add to list of devices to poll on SRQ
(There are other devices on the bus for which the response time is not critical and which are not configured for setting SRQ and are not in the list)
The notify callback function only sets a flag to notify other threads which devices should be polled, something like this:
public static void notifycallback(Object sender, NotifyData notifyData)
{
foreach (GPIBDevice device in notifylist) { device.pollflag=true } //signal other threads all devices that should be polled
Thread.Sleep(50); //give other threads time to poll their devices before rearming
notifyData.SetReenableMask(notifymask); //rearm to allow next notify
}
This works quite well, but for some hardware (eg a Tektronics scope), even if it is not configured to set SRQ (not in the list above), simply sending it a command causes error n°0 (driver error) or n°28 (power failure?). The same scope works perfectly when other devices are not configured for SRQ. This is very strange and I don't know where to start to debug this.
04-12-2017 02:28 AM
Hello,
Please find the following KB :
http://digital.ni.com/public.nsf/allkb/862567530005F09C862562A2000187FC?OpenDocument
For further debug, you can use the software NI IO Trace
http://digital.ni.com/public.nsf/allkb/282C5D41E2BA04F2862574BA007803B9
Paolo_P
Certified TestStand Architect
Certified LabVIEW Architect
National Instruments France
04-12-2017 04:46 AM
Thank you for your answer! After having looked at the reference you gave I tried to disable the automatic polling before enabling Notify:
board.UseAutomaticSerialPolling = False
and the problem disappeared - at least in the hardware configuration I was testing. It's good to have the problem solved in this particular case but I still don't understand how this autopolling works, when it should be used or not and why it doesn't seem compatible with Notify. NI documents say autopolling is enabled by default but don't say when it should be disabled.