GpibNotify Usage

NI-488.2

GpibNotify Usage

The GpibNotify OLE control is implemented using a method called SetupNotify and an event called Notify. The SetupNotify method is used to enable the NI-488.2 driver to look for one or more GPIB conditions for a particular GPIB handle. After it is set up, the OLE control fires the Notify event when one or more of the GPIB conditions is TRUE. A user-defined callback is invoked when the Notify event is fired.

This section covers the major highlights regarding the sample program that uses the GpibNotify control. The program contains three buttons: Run, Message, and Quit.

Clicking the Run button sets into motion a chain of commands that read ten measurements from a Fluke 45 multimeter. First, the program gets a handle to the device. Next, it sends a set of commands that initialize the Fluke 45 multimeter. Then a trigger command is sent. Next the program asks the device to send data. Lastly, it issues a SetupNotify to the GpibNotify OLE control with a mask of the RQS GPIB condition.

When the RQS GPIB condition is TRUE, the Notify event is fired and the user-defined callback is invoked. Each time through the callback, the RearmMask is set to RQS so that the event notification is rearmed for the next RQS GPIB condition. After the callback has read ten measurements from the Fluke 45 multimeter, the RearmMask is set to zero in order to disable the event notification mechanism.

Clicking the Message button causes a message to be displayed in a text box every time the button is clicked.

Clicking the Quit button closes the program.

The NI-488.2 software includes a sample Visual Basic program. Please refer to the readme.txt file for more detailed information about the project, classes, and code.

For overview information about asynchronous event notification within an NI-488.2 application, please refer to the Asynchronous Event Notification Overview section. For more specific information about the GpibNotify OLE control, please refer to the GpibNotify function definition.

Note The GpibNotify OLE control is implemented using the apartment model. Therefore, it only works correctly if your application responds to Windows messages in a timely fashion.