Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Using ibnotify with ibtmo executes callback and then stops altogether

I have a piece of code I've inherited that I am trying to debug.  The code initializes
and starts up the GPIB interface.  Then ibtmo is called with a timeout of 3 seconds.  Last,
ibnotify if called with a callback method.  During execution (and via NISpy), I see the
callback executing every 3s as expected with exactly the same input and output arguments
on every invocation.  I have reduced the callback to a single statement,  return (RQS |  TIMO) ... 
 
After a variable amount of time (usually less than 3 minutes) the callbacks stop occuring. 
I cannot figure out why, any ideas?  This is somewhat of an exception condition (when the
bus is idle) that I am debugging.  During normal operation (constant communication) the
entire thing works propertly so I don't think it is a general configuration issue, but rather
something in particular to how ibnotify and/or ibtmo are used or implemented.
 
Thanks 
0 Kudos
Message 1 of 4
(3,886 Views)
aymanme,

Should the call back be occurring once it stops occurring. More specify is the TIMO bit being set? The other thing I could think of is that for some reason the polling has stopped so it isn't looking for the RQS to change any longer. Do you have any insight into these possible conditions?
-Marshall R
0 Kudos
Message 2 of 4
(3,867 Views)
aymanme,

I have a couple more questions for you.
Could you send me a little more information about what driver version you are using?
Exactly what is in the mask you are using?
Posting your NI-spy log might also be helpful.
I will see if I might be able to recreate it.
-Marshall R
0 Kudos
Message 3 of 4
(3,852 Views)
The callback SHOULD still be occurring once it has stopped.  The callback method was reduced to the following:
 
int callback (xxx)
{
   return (TIMO | RQS); // mask
}
 
We can control when the other device asserts the SRQ.  When that occurs AND The callback has stopped running, the SRQ is effectively ignored.  On the other hand, if I assert the SRQ during the time that the callback appears to function, everything works.
 
I believe it is version 2.4, but I am not sure how to determine it.
 
--
 
Having said that, I was able to work around this by polling.  I continuously call ibwait() with 0 for a mask, so it does nothing but update the ibsta.  Then I switch on ibsta if something I am interested in has happened.  This has been working continously for a couple of days (vs. less than 5 minutes before).  Rather than use ibnotify to invoke my method, I have just invoked it directly (to avoid rewriting the code) and it works.  So I am pretty sure there is nothing wrong with my callback method.
 
 
0 Kudos
Message 4 of 4
(3,846 Views)