Page 2
National Instruments Corporate Headquarters 6504 Bridge Point Parkway Austin, TX 78730-5039 (512) 794-0100 Technical support fax: (800) 328-2203 (512) 794-5678 Branch Offices: Australia (03) 879 9422, Austria (0662) 435986, Belgium 02/757.00.20, Canada (Ontario) (519) 622-9310, Canada (Québec) (514) 694-8521, Denmark 45 76 26 00, Finland (90) 527 2321, France (1) 48 14 24 24,...
Page 3
The reader should consult National Instruments if errors are suspected. In no event shall National Instruments be liable for any damages arising out of or related to this document or the information contained in it.
Page 4
Under the copyright laws, this publication may not be reproduced or transmitted in any form, electronic or mechanical, including photocopying, recording, storing in an information retrieval system, or translating, in whole or in part, without the prior written consent of National Instruments Corporation. Trademarks ®...
NI-488.2M Driver and Driver Utilities ......1-1 Language Files ............. 1-2 Example Program Files ..........1-2 API-Related Files ............1-3 How the NI-488.2M Software Works with OS/2....... 1-4 GPIB Overview ................1-5 The IEEE 488 Standard and GPIB....... 1-5 Talkers, Listeners, and Controllers ......1-5 Controller-In-Charge and System Controller....
Page 10
Contents Figures Figure 1-1. How the NI-488.2M Software Works with OS/2 ....1-4 Figure 1-2. Linear and Star System Configuration......1-8 Figure 1-3. Example of Multiboard System Setup......1-9 Figure 2-1. Program Flowchart for Example 1........2-3 Figure 2-2. Program Flowchart for Example 2........2-5 Figure 2-3.
About This Manual This manual describes the features and functions of the NI-488.2M software for OS/2. The NI-488.2M software package is meant to be used with OS/2 (IBM Operating System/2) version 2.0 or higher. This manual assumes that you are already familiar with the OS/2 system.
• Appendix C, Customer Communication, contains forms you can use to request help from National Instruments or to comment on our products and manuals. • The Glossary contains an alphabetical list and a description of terms, including abbreviations, acronyms, metric prefixes, mnemonics, and symbols, that this manual uses.
Page 13
ANSI/IEEE Standard 488.1-1987 and the ANSI/IEEE Standard 488.2-1987, respectively, which define the GPIB. NI-488.2M software NI-488.2M software refers to the NI-488.2M software for OS/2 unless otherwise noted. Abbreviations, acronyms, metric prefixes, mnemonics, symbols, and terms are listed in the Glossary.
Examples Use the getting-started manual to install and configure your GPIB hardware and NI-488.2M software for OS/2. Use the software reference manual if you want to learn the basics of GPIB and how to develop an application program. The software reference manual also contains debugging information and detailed examples.
Common Commands. Customer Communication National Instruments wants to receive your comments on our products and manuals. We are interested in the applications you develop with our products, and we want to help if you have problems with them. To make it easy for you to contact us, this manual contains comment and configuration forms for you to complete.
Chapter 1 NI-488.2M Software Description This chapter describes the NI-488.2M software package and explains how the software works with your OS/2 system. The NI-488.2M Software Package The following section highlights important elements of the NI-488.2M software for OS/2 and describes the function of each element.
OS/2 API functions. • nicode.h is a C language declaration file that contains definitions of NI- 488.2M function codes and other NI-488.2M-related constant and structure definitions. • nictl_32.h is a C language declaration file that contains a macro definition.
OS/2 device driver services are available to all OS/2 programs running in the system. Figure 1-1 shows two ways you can access the NI-488.2M driver. You can use either the NI-488.2 language interface or the OS/2 API (Application Program Interface) calls.
Chapter 1 NI-488.2M Software Description Controlling More Than One Board Multiboard drivers, such as the NI-488.2M driver for OS/2, can control more than one interface board. Figure 1-3 shows an example of a multiboard system configuration. GPIB Digital Voltmeter gpib0...
GPIB device. A technician needs to monitor voltage readings using a GPIB multimeter. His computer is equipped with an IEEE 488.2 interface board. The NI-488.2M software is installed and a GPIB cable runs from the computer to the GPIB port on the multimeter.
This example illustrates how you can clear and trigger GPIB devices. Two freshman physics lab partners are learning how to use a GPIB digital oscilloscope. They have successfully loaded the NI-488.2M software on a personal computer and connected their GPIB board to a GPIB digital oscilloscope.
GPIB color printer and fitted with the NI-488.2M software package. The biologist is familiar with the command set of her color printer, as described in the user manual provided by the manufacturer.
GPIB digital film recorder. A GPIB cable connects the GPIB port on the film recorder to the IEEE 488.2 interface board installed in her computer. She has installed the NI-488.2M software package on the host computer and is familiar with the programming instructions for the film recorder, as described in the user manual provided by the manufacturer.
The GPIB strain gauges are connected to a computer equipped with an IEEE 488.2 interface board and fitted with the NI-488.2M software. The process is controlled by an application that uses NI-488.2 routines to communicate with the IEEE 488.2 compliant strain gauges.
The three monitoring units are connected to the IEEE 488.2 interface board of a computer fitted with the NI-488.2M software and operated by an application using NI- 488.2 routines. The application obtains information from the multiple units by conducting a parallel poll, then determines when to pour the metals into the mixture tank.
Application Examples Example 9: Non-Controller Example This example illustrates how you can use the NI-488.2M software to emulate a GPIB device that is not the GPIB Controller. A software engineer has written firmware to emulate a GPIB device for a research project and is testing it by using an application that makes simple GPIB calls.
This chapter explains how to develop a GPIB application program using NI-488 functions and NI-488.2 routines. Choosing a Programming Method Programs that need to communicate across the GPIB can access the NI-488.2M driver using either the NI-488.2 language interface or the OS/2 API calls. Using the NI-488.2 Language Interface One method of programming the NI-488.2M driver is with an NI-488.2...
Using the OS/2 API Interface If the NI-488.2 interface does not meet your requirements, you can access the NI-488.2M driver through the OS/2 API interface. This interface uses the OS/2 standard device driver interface instead of a particular language interface.
Before you run your application program, you should run the software diagnostic test, ibtest, that came with your NI-488.2M software. The ibtest program is an NI-488.2M application that makes calls to the driver. If ibtest passes, your GPIB hardware and NI-488.2M software are interacting correctly.
Debugging Your Application Debugging with the Global Status Variables After each function call to your NI-488.2M driver, ibsta, iberr, and ibcnt are updated before the call returns to your application. You should check for an error after each GPIB call. Refer to Chapter 3, Developing Your Application, for more information about how to use these variables within your program to automatically check for errors.
Data is corrupted If these problems occur, make sure that the GPIB hardware settings match the NI-488.2M software settings for the interrupt request level and the DMA channel. For information on hardware and software default settings, refer to the getting-started manual that came with your kit. The next section discusses how to reconfigure your NI-488.2M software, if necessary.
If your program uses dynamic configuration, it will always work regardless of the previous driver configuration. For more information, refer to the description of ibconfig in the NI-488.2M Function Reference Manual for OS/2. Timing Errors If your application fails but the same calls issued in ibic are successful, your program might be issuing the NI-488.2 calls too quickly for your device to...
IEEE 488.2 standard should remain in their current state until specific commands are sent across the GPIB to change their state. You might need to configure your NI-488.2M driver to perform repeat addressing if your device does not remain in its currently addressed state. Refer to Chapter 7, ibconf—Interface Bus Configuration Utility, or to the description of ibconfig...
Starting ibic The ibic program is contained in ibic.exe, the executable file that was copied from your distribution disk when you installed the NI-488.2M software. To run ibic, change to the appropriate subdirectory (AT-GPIB in the following example) and enter ibic at the prompt as shown: C:/AT-GPIB>...
8 The \r and \n represent the carriage return and linefeed characters, respectively. Refer to Appendix A, Multiline Interface Messages, in the NI-488.2M Function Reference Manual for OS/2 for more information about non-printable characters. Status Word Return In ibic, all NI-488 functions (except ibfind and ibdev) and NI-488.2 routines return the status word ibsta in two forms: a hex value in square brackets and a list of mnemonics in parentheses.
You can use the ibeot function to enable the end of transmission (EOT) mode. If EOT mode is enabled, the NI-488.2M driver asserts the GPIB EOI line when the last byte of a write is sent out on the GPIB. If it is disabled, the EOI line is not asserted with the last byte of a write.
• The EOS read method. If the EOS read method is enabled, the NI-488.2M driver terminates ibrd calls when the EOS byte is detected on the GPIB or when the GPIB EOI line is asserted or when the specified count has been reached. If the EOS read method is disabled, ibrd calls terminate only when the GPIB EOI line is asserted or the specified count has been read.
The interface board returns a response byte of hex 42. The current CIC passes control to the GPIB board. If the current CIC does not pass control, the NI-488.2M driver returns the ECIC error code to your application. This error can occur if the current CIC does not understand the CIC protocol.
NI-488 call as long as no GPIB is currently I/O in progress. This means that an automatic serial poll can occur even when your application is not making any calls to the NI-488.2M software. Autopolling can also occur when a device-level ibwait for RQS is in progress.
SerialPollResponse; SRQ and Serial Polling with NI-488.2 Routines The NI-488.2M software includes a set of NI-488.2 routines that you can use to conduct SRQ servicing and serial polling. Routines pertinent to SRQ servicing and serial polling are AllSpoll, FindRQS, ReadStatusByte, TestSRQ, and WaitSRQ.
Implementing a Parallel Poll You can implement parallel polling with either NI-488 functions or NI-488.2M routines. If you use NI-488.2M routines to execute parallel polls, you do not need extensive knowledge of the parallel polling messages. However, you should use the NI-488.2M functions for parallel polling when the GPIB board is not the Controller and must configure itself for a parallel poll and set its own individual status bit (ist).
If you use dynamic configuration, you do not need to run ibconf before you start your application. Also, you can run your application on any computer with the appropriate NI-488.2M software regardless of its configuration, because the application configures the driver as necessary.
Page 123
• Driver—an NI-488.2M driver file for OS/2, such as gpib.sys, that you copy from the distribution disk to your hard disk. Changes to a driver file do not affect your application until the system is restarted.
The GPIB primary address of any device is set within the device, either with hardware switches or a software program. The address set within the device must correspond to the address in the memory-resident driver. In the NI-488.2M driver for OS/2, the default primary addresses of dev1 through dev32 are 1 through 32, respectively.
GPIB-Specific Errors Boards and devices have a switch that specifies whether the NI-488.2M driver returns OS/2 device errors or GPIB device errors when API IOCtl functions are used. A no response causes the OS/2 API functions (except the status query function) to return OS/2 device errors.
Each GPIB board and device is set to return GPIB-specific errors while executing API-style calls. • At the end of each NI-488.2 routine, the NI-488.2M driver leaves the bus in its currently addressed state (IEEE 488.2 standard). • The time limit for a serial poll is set for 1 s.
Make sure the NI-488.2M driver is installed by checking the gpibinst.inf file in the root directory. Check the config.sys file in the root directory and make sure it contains the following line: DEVICE= dir \gpib.sys...
Filling out a copy of the Technical Support Form before contacting National Instruments helps us help you better and faster. National Instruments provides comprehensive technical assistance around the world.
Page 154
Getting Started Manual. Use additional pages if necessary. Name Company Address Fax ( Phone ( Computer brand Model Processor Operating system Speed Display adapter Mouse Other adapters installed Hard disk capacity Brand Instruments used National Instruments hardware product model Revision Configuration (continues)
Page 155
National Instruments software product Version Configuration The problem is List any error messages The following steps will reproduce the problem...
Page 156
Documentation Comment Form National Instruments encourages you to comment on the documentation supplied with our products. This information helps us provide quality products to meet your needs. ™ Title: NI-488.2M Software Reference Manual for OS/2 Edition Date: January 1995 Part Number:...
Page 157
Thank you for your help. Name Title Company Address Phone Mail to: Technical Publications National Instruments Corporation 6504 Bridge Point Parkway, MS 53-02 Austin, TX 78730-5039 Fax to: Technical Publications National Instruments Corporation MS 53-02 (512) 794-5678...
Page 159
Glossary Automatic Serial Polling A feature of the NI-488.2M software in which (Autopolling) serial polls are executed automatically by the driver whenever a device asserts the GPIB SRQ line. Board Function A function that operates on or otherwise pertains to one of the GPIB interface boards in the computer.
Page 161
(MSA). The GPIB board has both a GPIB address and an I/O address. GPIB Board Refers to the National Instruments family of GPIB interface boards. The NI-488.2M driver file name. gpib.sys Group Executed Trigger See GET.
Page 162
GPIB protocol matters. See Low-Level Function. hertz After each NI-488.2M I/O function, this global ibcnt variable contains the actual number of bytes transmitted. The NI-488.2M driver configuration program.
Page 163
Parallel Poll Configure function. LAD or Listen Address See MLA. Language Interface Code that enables an application program that uses NI-488.2M functions or NI-488.2M routines to access the driver. Listen Address See MLA. Listener A GPIB device that receives data messages from a Talker.
Page 166
Status Word See ibsta. Synchronous Refers to the relationship between the NI-488.2M driver functions and a process when executing driver functions is predictable; the process is blocked until the OS/2 driver completes the function. System Controller The single-designated Controller that can assert control (become CIC of the GPIB) by sending the Interface Clear (IFC) message.
Page 167
Controller to an addressed Talker. Timeout A feature of the NI-488.2M driver that prevents I/O functions from hanging indefinitely when there is a problem on the GPIB. An integrated circuit that implements most of the GPIB Talker, Listener, and Controller functions in hardware.
Page 171
5-23 EOS. See end of string (EOS). EOS byte, 7-11 EOT mode, 6-1 ERR status, A-2 error codes. See also ibsta (status files for NI-488.2M software. See word). NI-488.2M software. EABO, B-6 FindLstn routine, 3-15 EADR, 5-15, B-4...