National Instruments 320682C Musical Toy Instrument User Manual


 
Chapter 4 GPIB/GPIB-488.2 Library
© National Instruments Corporation 4-7 LabWindows/CVI Standard Libraries
Note: When writing instrument modules, you must use the Device Manager functions
(OpenDev and CloseDev) instead of ibfind or ibdev. You must also use the
Device Manager functions in application programs that make calls to instrument
modules. The Device Manager functions allow instrument modules to open devices
without specific device names, thereby preventing device name conflicts. They also
help the LabWindows/CVI interactive program ensure that devices are closed when no
longer needed.
Device and Board Functions
Device functions are high-level functions that execute command sequences to handle bus
management operations required by activities such as reading from and writing to devices or
polling them for status. Device functions access a specific device and take care of the addressing
and bus management protocol for that device. Because they execute automatically, you do not
need to know any GPIB protocol or bus management details. A descriptor of the accessed device
is one of the arguments of the function.
In contrast, board functions are low-level functions that perform rudimentary GPIB operations.
They are necessary because high-level functions may not always meet the requirements of
applications. In such cases, low-level functions offer the flexibility to meet your application
needs.
Board functions access the GPIB interface board directly and require you to do the addressing
and bus management protocol for the bus. A descriptor of the accessed board is one of the
arguments of the function.
Automatic Serial Polling
Automatic Serial Polling relieves you of the burden of sorting out occurrences of SRQ and status
bytes of a device you can enable. To enable Automatic Serial Polling (or Autopolling), use the
configuration utility, IBCONF, or the configuration function, ibconfig. If you enable
Autopolling, the handler automatically conducts serial polls when SRQ is asserted.
As part of the Autopoll procedure, the handler stores each positive serial poll response in a queue
associated with each device. A positive response has the RQS or hex 40 bit set in the device
status byte. Queues are necessary because some devices can send multiple positive status bytes
back-to-back. When a positive response from a device is received, the RQS bit of its status word
(ibsta) is set. The polling continues until SRQ is unasserted or an error condition is detected.
If the handler cannot locate the device requesting service (no known device responds positively
to the poll) or if SRQ becomes stuck on (because of a faulty instrument or cable), a GPIB system
error exists that will interfere with the proper evaluation of the RQS bit in the status words of
devices. The error ESRQ is reported to you when you issue an ibwait call with the RQS bit