AnsweredAssumed Answered

6813B generating and trapping SRQs at completion of LIST operation

Question asked by marshallarts on Feb 16, 2015
I'm trying to set up a 6813B to generate an SRQ at the completion of a LIST operation. There are two areas to get right here - first, setting up the instrument correctly, and second, setting up the IO Libraries software correctly. I am using a system I have built over many years using Visual Studio and IO Libraries 15.5.

I have an object that represents the 6813B. When I connect to the instrument I do the following (pseudo code):

            IEventManager.InstallHandler(EventType.EVENT_SERVICE_REQ, Me, 6813)       ' set handler for SRQ events
            ioDmm.WriteString("*OPC")                                                                  ' allow OPC to set the bit in the Event Status Register
            ioDmm.WriteString("*ESE 1")                                                                ' enable OPC event to raise bit in STB

The object also has a method called EnableSRQForOPC, which is called just after I have loaded the lists into the 6813B. It does the following:

            ioDmm.WriteString("*SRE 32")                                                              ' enable bit in STB to generate SRQ
            IEventManager.EnableEvent(EventType.EVENT_SERVICE_REQ, EventMechanism.EVENT_HNDLR, 6813)   ' Allow IO Libraries to pass SRQ thru

In the instrument object's HandleEvent method, it simply does a RaiseEvent which invokes an event handler on the form that contains the object.  The instrument object is NOT a form control - it has no visible presence or UI on the form. When the SRQ occurs, the event handler disables SRQ events by sending "*SRE 0" to the instrument and calling IEventManager.DisableEvent(EventType.EVENT_SERVICE_REQ, EventMechanism.EVENT_HNDLR, 6813)

What is happening is that the SRQ gets generated as soon as I trigger the 6813B to run the LIST operation.  The LIST operation runs correctly, but no SRQ happens at the end, because of course the first SRQ has caused SRQ generation to be disabled.  So the SRQ is telling me about the completion of something, but I'm not sure what.

I'm sure I am doing something in the wrong order.  I had it almost working at one point, then made some changes to make the code more consistent, and now it doesn't work and I don't seem to be able to get back to where I was - don't you hate that?

Anyway, the more general question is - has anyone successfully set up a 6813B to generate an SRQ at the completion of a LIST operation, using IO Libraries and Visual Studio/Visual Basic.NET?  Can it even be done?  If so, then some info on how it was done would be welcome.  If it can't be done, then some advice on a reliable way to test for completion of the LIST operation would also be welcome.  

Outcomes