National Instruments GPIB-PC User Manual

GPIB-PC User Manual
for the
IBM Personal Computer and
Compatibles
April 1988 Edition
Part Number 320014-01
© Copyright 1984, 1994 National Instruments Corporation.
All Rights Reserved.
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, Germany 089/741 31 30, Italy 02/48301892, Japan (03) 3788-1921, Netherlands 03480-33466, Norway 32-848400, Spain (91) 640 0085, Sweden 08-730 49 70, Switzerland 056/20 51 51, U.K. 0635 523545

Limited Warranty

The GPIB-PC is warranted against defects in materials and workmanship for a period of two years from the date of shipment, as evidenced by receipts or other documentation. National Instruments will, at its option, repair or replace equipment that proves to be defective during the warranty period. This warranty includes parts and labor.
The media on which you receive National Instruments software are warranted not to fail to execute programming instructions, due to defects in materials and workmanship, for a period of 90 days from date of shipment, as evidenced by receipts or other documentation. National Instruments will, at its option, repair or replace software media that do not execute programming instructions if National Instruments receives notice of such defects during the warranty period. National Instruments does not warrant that the operation of the software shall be uninterrupted or error free.
A Return Material Authorization (RMA) number must be obtained from the factory and clearly marked on the outside of the package before any equipment will be accepted for warranty work. National Instruments will pay the shipping costs of returning to the owner parts which are covered by warranty.
National Instruments believes that the information in this manual is accurate. The document has been carefully reviewed for technical accuracy. In the event that technical or typographical errors exist, National Instruments reserves the right to make changes to subsequent editions of this document without prior notice to holders of this edition. 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.
EXCEPT AS SPECIFIED HEREIN, NATIONAL INSTRUMENTS MAKES NO
WARRANTIES ANY WARRANTY OF MERCHANTABILITY OR FITNESS FOR A
PARTICULAR PURPOSE CAUSED BY FAULT OR NEGLIGENCE ON THE PART OF
, EXPRESS OR IMPLIED, AND SPECIFICALLY DISCLAIMS
. CUSTOMER'S RIGHT TO RECOVER DAMAGES
NATIONAL
INSTRUMENTS SHALL BE LIMITED TO THE AMOUNT THERETOFORE
PAID BY THE CUSTOMER LIABLE FOR DAMAGES RESULTING FROM LOSS OF DATA USE OF PRODUCTS, OR INCIDENTAL OR CONSEQUENTIAL DAMAGES, EVEN IF ADVISED OF THE POSSIBILITY THEREOF. This limitation of the
. NATIONAL INSTRUMENTS WILL NOT BE
, PROFITS,
liability of National Instruments will apply regardless of the form of action, whether in contract or tort, including negligence. Any action against
National Instruments must be brought within one year after the cause of action accrues. National Instruments shall not be liable for any delay in performance due to causes beyond its reasonable control. The warranty provided herein does not cover damages, defects, malfunctions, or service failures caused by owner's failure to follow the National Instruments installation, operation, or maintenance instructions; owner's modification of the product; owner's abuse, misuse, or negligent acts; and power failure or surges, fire, flood, accident, actions of third parties, or other events outside reasonable control.

Copyright

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

Product and company names listed are trademarks or trade names of their respective companies.
WARNING REGARDING MEDICAL AND
CLINICAL USE OF NATIONAL
INSTRUMENTS PRODUCTS
National Instruments products are not designed with components and testing intended to ensure a level of reliability suitable for use in treatment and diagnosis of humans. Applications of National Instruments products involving medical or clinical treatment can create a potential for accidental injury caused by product failure, or by errors on the part of the user or application designer. Any use or application of National Instruments products for or involving medical or clinical treatment must be performed by properly trained and qualified medical personnel, and all traditional medical safeguards, equipment, and procedures that are appropriate in the particular situation to prevent serious injury or death should always continue to be used when National Instruments products are being used. National Instruments products are NOT intended to be a substitute for any form of established process, procedure, or equipment used to monitor or safeguard human health and safety in medical or clinical treatment.

Preface

Introduction to the GPIB

The GPIB is a link, or bus, or interface system, through which interconnected electronic devices communicate.

History of the GPIB

The original GPIB was designed by Hewlett-Packard (where it is called the HP-IB) to connect and control programmable instruments manufactured by Hewlett-Packard. Because of its high data transfer rates of from 250 kilobytes to 1 megabyte per second, the GPIB quickly gained popularity in other applications such as intercomputer communication and peripheral control. It was later accepted as the industry standard IEEE-488. The versatility of the system prompted the name General Purpose Interface Bus.
National Instruments expanded the use of the GPIB among users of computers manufactured by companies other than Hewlett-Packard. National Instruments specialized both in high performance, high-speed hardware interfaces, and in comprehensive, full-function software that helps users bridge the gap between their knowledge of instruments and computer peripherals and of the GPIB itself.

The GPIB-PC Family

The GPIB-PC family consists of GPIB interface hardware products, software, documentation, and other items for several types of personal computers.

What Your Package Should Contain

Unless you have a special application, your GPIB-PC package consists of the following:
• A GPIB-PC interface board for your personal computer. Each board has a model name such as GPIB-PCIIA. This manual uses GPIB-PC to refer generally to all models of the GPIB-PC interface board.
©National Instruments Corp. v GPIB-PC User Manual
Preface
•A Getting Started with your GPIB-PC pamphlet. The pamphlet contains the directions with a minimum of explanations for installing your hardware and software in your GPIB system.
• A GPIB-PC distribution diskette. The distribution diskette is part of the GPIB-PC package. It contains the DOS handler, BASICA and QuickBASIC language interfaces, and other programs.
•A GPIB-PC User Manual. The manual contains descriptions of the GPIB-PC handler functions, BASICA, and QuickBASIC language interfaces to the handler.
•A Programmer Reference Guide for BASIC.
• A supplement to Section Two of the manual describing your particular interface board and how to install it in your personal computer.
For a language other than BASICA and QuickBASIC, you also need:
• An additional GPIB-PC distribution diskette containing the software for that language.
• A supplement to Section Four describing the GPIB functions in the syntax and semantics of that language.
• A Programmer Reference Guide for that language.

Who Are Our Users?

Most of our users have experience in technological fields and with computers.

How to Get Started

If you already have experience with the GPIB, you may wish to turn directly to the Getting Started with your GPIB-PC pamphlet that was shipped with your hardware. It contains directions, with a minimum of explanations, for installing your hardware and software in your GPIB system.
If you are less experienced or want more information than the pamphlet provides, read this GPIB-PC User Manual. It explains in detail all of the information you will need for the proper operation of the GPIB-PC.
GPIB-PC User Manual vi ©National Instruments Corp.
Preface

About the Manual

This manual is written specifically for a GPIB-PC which is to be installed in an IBM Personal Computer or compatible PC which is operating under PC-DOS or MS-DOS and programmed using BASICA and QuickBASIC. With appropriate supplements to the manual, other GPIB-PC interfaces can be installed in other computers, using other programming languages.

Organization of the Manual

Section One - Operation of the GPIB describes the operation of the GPIB.
Section Two - Installation and Configuration describes the installation of the software and the configuration program IBCONF. A supplement contains instructions for installing your particular board into your computer.
Section Three - GPIB-PC Functions — Introduction introduces you to the functions used by your GPIB-PC. The features are divided into groups as a means of helping you understand the uses of the functions.
Section Four - GPIB-PC Functions — Overview introduces you to programming information common to all languages.
Section Four A - Function Reference — Language Interface(s) pertains to BASICA and QuickBASIC. The descriptions are listed alphabetically for easy reference.
Section Five - IBIC introduces you to IBIC, the interactive control program that allows you to control and communicate with the GPIB through functions you enter at your keyboard. IBIC is designed to help you learn how to use the GPIB-PC functions to program your devices.
Section Six - Applications Monitor introduces you to the applications monitor, a resident program that is useful in debugging sequences of GPIB calls from within your application.
Appendix A - Multiline Interface Messages is a listing of Multiline Interface Command Messages.
Appendix B - Common Errors and Their Solutions singles out the most common errors users have encountered and some probable solutions.
©National Instruments Corp. vi i GPIB-PC User Manual
Preface
Appendix C - Differences Between Software Revisions points out differences between revisions of the GPIB-PC handler.
Appendix D - Using your Printer with the GPIB-PC gives some quick steps to connect your GPIB-PC with your printer.
Appendix E - Application Notes is an application note about computer­to-computer transfers.
Appendix F - 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 description of terms used in this manual, including abbreviations, acronyms, metric prefixes, mnemonics, and symbols.
The Index contains an alphabetical list of key terms and topics in this manual, including the page where you can find each one.
Now, with your personal computer, your GPIB-PC, your manuals and supplements, and these instructions, you are ready to get started with your GPIB. We hope your experience will be a rewarding one.

Customer Support

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. For information on how to contact us, refer to Appendix F, Customer
Communication, at the end of this manual.
GPIB-PC User Manual viii ©National Instruments Corp.

Contents

Section One - Operation of the GPIB................................................ 1-1
Types of Messages...................................................................................... 1-1
Talkers, Listeners, and Controllers ..................................................... 1-1
The Controller-In-Charge and System Controller......................... 1-2
GPIB Signals and Lines ........................................................................... 1-3
Data Lines..................................................................................... 1-3
Handshake Lines........................................................................ 1-3
NRFD (not ready for data).................................. 1-3
NDAC (not data accepted)................................. 1-4
DAV (data valid)..................................................... 1-4
Interface Management Lines............................................... 1-4
ATN (attention)........................................................ 1-4
IFC (interface clear).............................................. 1-4
REN (remote enable)............................................ 1-4
SRQ (service request)........................................... 1-5
EOI (end or identify).............................................. 1-5
Physical and Electrical Characteristics............................................ 1-5
Configuration Requirements................................................................... 1-9
Related Documents.................................................................................... 1-9
Section Two - Installation and Configuration............................ 2-1
Installing the Hardware............................................................................. 2-1
The GPIB-PC Software Package ......................................................... 2-1
Additional Programs and Files............................................ 2-2
Installing the Software .............................................................................. 2-3
Step 1 - Preparation.................................................................. 2-3
Booting from a Floppy Disk ............................... 2-3
Booting from a Hard Disk.................................... 2-3
Step 2 - Run IBSTART........................................................... 2-4
Step 3 - Run IBCONF (optional)....................................... 2-5
Step 4 - Reboot........................................................................... 2-5
Step 5 - Test Software Installation.................................... 2-5
More About IBCONF................................................................................. 2-6
Characteristics of the Instruments ..................................... 2-7
Characteristics of each GPIB-PC ...................................... 2-7
Default Configurations .............................................................................. 2-8
Primary Default Characteristics ......................................... 2-8
©National Instruments Corp. ix GPIB-PC User Manual
Contents
Running IBCONF ........................................................................................ 2-9
Upper and Lower Levels of IBCONF............................ 2-10
Upper Level - Device Map
for Board GPIBx.................................................... 2-10
Device Map Concepts and Terms ................ 2-11
Lower Level - Device/Board
Characteristics ....................................................... 2-11
Device and Board Characteristics.................................. 2-12
Primary GPIB Address ....................................... 2-12
Secondary GPIB Address.................................. 2-12
Timeout Settings................................................... 2-12
EOS Byte.................................................................. 2-14
EOS Modes.............................................................. 2-14
Set EOI with last byte of Write ..................... 2-14
GPIB-PC Model .................................................... 2-14
Board is System Controller
(Boards Only)......................................................... 2-14
Local Lockout on all Devices
(Boards Only)......................................................... 2-15
Disable Auto Serial Polling
(Boards Only)......................................................... 2-15
High-Speed Timing
(Boards Only)......................................................... 2-15
Interrupt Jumper Setting
(Boards Only)......................................................... 2-15
Base I/O Address (Boards Only)................... 2-15
DMA Channel (Boards Only)......................... 2-16
Internal Clock Frequency
(Boards Only)......................................................... 2-16
Exiting IBCONF...................................................................... 2-16
Using Your GPIB-PC .............................................................................. 2-18
Section Three - GPIB-PC Functions — Introduction
Introduction to the GPIB-PC Functions ............................................ 3-1
High-Level Functions .............................................................. 3-1
Low-Level Functions ............................................................... 3-1
Calling Syntax............................................................................ 3-1
Group I.. .. .. .... .. .................................................................................................. 3-2
IBRD (bd,buf,cnt) ..................................................................... 3-2
IBWRT (bd,buf,cnt)................................................................. 3-2
IBFIND (bdname,bd)............................................................... 3-3
GPIB-PC User Manual x ©National Instruments Corp.
............................................................................ 3-1
Contents
Group II............................................................................................................. 3-3
IB RS P (bd ,spr ) ........................................................................... 3-3
IBCLR (bd) .................................................................................. 3-4
Clearing the Device Versus
Clearing the GPIB................................................... 3-4
Clearing the Device ............................. 3-4
Clearing the GPIB................................. 3-4
IBTRG (bd) .................................................................................. 3-4
IBLOC (bd) .................................................................................. 3-4
Placing a Device in Remote Mode ................ 3-4
Placing a Device in Local Mode..................... 3-5
Group III..... ...................................................................................................... 3-5
IBRDA (bd,buf,cnt) and......................................................... 3-6
IBRDF (bd,buf,cnt) and ......................................................... 3-6
IBWAIT (bd,mask)................................................................... 3-6
IBSTOP (bd)................................................................................ 3-6
IBTMO (bd,v) ............................................................................. 3-7
IBONL (bd,v) .............................................................................. 3-7
IBPCT (bd)................................................................................... 3-7
Group IV........................................................................................................... 3-8
Purpose of Board Functions.................................................. 3-9
Multiboard Capability ............................................................. 3-9
IBFIND (bdname,bd)............................................................ 3-10
IBCMD (bd,buf,cnt) and..................................................... 3-10
IBRD (bd,buf,cnt) and ......................................................... 3-10
IBWRT (bd,buf,cnt) and..................................................... 3-12
IBSTOP (bd)............................................................................. 3-12
IBWAIT (bd,mask)................................................................ 3-12
IBTMO (bd,v) .......................................................................... 3-12
IBONL (bd,v) ........................................................................... 3-12
IBSIC (bd) ................................................................................. 3-12
IBSRE (bd,v)............................................................................ 3-13
IBGTS (bd,v)............................................................................ 3-13
IBCAC (bd,v)........................................................................... 3-13
IBRPP (bd,buf)........................................................................ 3-13
IBPPC (bd,v)............................................................................ 3-13
More About Device and Board Functions .................................... 3-14
Group V......................................................................................................... 3-15
IBRSV (bd,v)........................................................................... 3-15
IBLOC (bd) ............................................................................... 3-15
IBPPC (bd,v)............................................................................ 3-16
IBIST (bd,v).............................................................................. 3-16
IBWAIT (bd,mask)................................................................ 3-16
©National Instruments Corp. xi GPIB-PC User Manual
Contents
Group VI........................................................................................................ 3-17
IBEOT (bd,v)............................................................................ 3-17
IBEOS (bd,v)............................................................................ 3-18
IBBNA (bd,"GPIBn") ........................................................... 3-18
IBDMA (bd,v).......................................................................... 3-18
IBPAD (bd,v) ........................................................................... 3-18
IBSAD (bd,v) ........................................................................... 3-18
IBRSC (bd,v)........................................................................... 3-18
IBTMO (bd,v) .......................................................................... 3-18
Section Four - GPIB-PC Functions — Overview
General Programming Information ................................................... 4-1
Status Word................................................................................................. 4-2
Error Codes.................................................................................................. 4-6
Count Variable......................................................................................... 4-11
Read and Write Termination ............................................................ 4-11
Device Function Calls......................................................................... 4-12
Automatic Serial Polling .................................................................... 4-13
................................................................................. 4-1
Section Four A - BASICA/QuickBASIC GPIB-PC Function Calls
BASICA Files .......................................................................................... 4A-2
QuickBASIC Files ................................................................................. 4A-2
Programming Preparations for BASICA .................... 4A-3
Programming Preparations for QuickBASIC ........... 4A-4
BASICA/QuickBASIC GPIB-PC I/O Functions ...................... 4A-5
BASICA/QuickBASIC "ON SRQ" Capability.......................... 4A-6
New GPIB-PC Functions .................................................................. 4A-12
GPIB-PC Function Descriptions.................................................... 4A-15
IBBNA......................................................................................................................... 4A-16
IBCAC......................................................................................................................... 4A-17
IBCLR.......................................................................................................................... 4A-19
IBCMD........................................................................................................................ 4A-20
IBCMDA..................................................................................................................... 4A-23
IBDMA........................................................................................................................ 4A-25
IBEOS.......................................................................................................................... 4A-26
IBEOT.......................................................................................................................... 4A-30
IBFIND........................................................................................................................ 4A-32
IBGTS.......................................................................................................................... 4A-34
IBIST............................................................................................................................ 4A-36
IBLOC.......................................................................................................................... 4A-38
IBONL.......................................................................................................................... 4A-40
IBPAD.......................................................................................................................... 4A-42
......................................................................... 4A-1
GPIB-PC User Manual xii ©National Instruments Corp.
Contents
IBPCT .......................................................................................................................... 4A-44
IBPPC.......................................................................................................................... 4A-45
IBRD............................................................................................................................. 4A-47
IBRDA ........................................................................................................................ 4A-50
IBRDF.......................................................................................................................... 4A-54
IBRDI........................................................................................................................... 4A-57
IBRDIA........................................................................................................................ 4A-60
IBRPP.......................................................................................................................... 4A-64
IBRSC.......................................................................................................................... 4A-66
IBRSP.......................................................................................................................... 4A-68
IBRSV.......................................................................................................................... 4A-70
IBSAD.......................................................................................................................... 4A-71
IBSIC............................................................................................................................ 4A-73
IBSRE.......................................................................................................................... 4A-74
IBSTOP....................................................................................................................... 4A-76
IBTMO......................................................................................................................... 4A-78
IBTRAP....................................................................................................................... 4A-81
IBTRG.......................................................................................................................... 4A-83
IBWAIT....................................................................................................................... 4A-84
IBWRT........................................................................................................................ 4A-87
IBWRTA..................................................................................................................... 4A-90
IBWRTF..................................................................................................................... 4A-93
IBWRTI....................................................................................................................... 4A-95
IBWRTIA .................................................................................................................. 4A-99
BASICA/QuickBASIC GPIB
Programming Examples................................................................... 4A-103
BASICA Example Program - Device...................... 4A-105
BASICA Example Program - Board ........................ 4A-108
QuickBASIC Example Program - Device............. 4A-111
QuickBASIC Example Program - Board ............... 4A-114
Section Five - IBIC.............................................................................................. 5-1
Running IBIC................................................................................................. 5-2
Using HELP.................................................................................. 5-3
Using IBFIND.............................................................................. 5-3
Using IBWRT.............................................................................. 5-4
Using IBRD .................................................................................. 5-4
How to Exit IBIC ....................................................................... 5-5
Important Programming Note............................................... 5-5
Using SET ..................................................................................... 5-6
IBIC Functions and Syntax..................................................................... 5-7
Other IBIC Functions and Syntax........................................................ 5-8
Status Word................................................................................................. 5-10
Error Code.................................................................................................... 5-11
©National Instruments Corp. xiii GPIB-PC User Manual
Contents
Byte Count................................................................................................... 5-12
Auxiliary Functions ................................................................................. 5-12
SET (Select Device or Board)......................................... 5-13
HELP (Display Help Information).................................. 5-13
! (Repeat Previous Function) ........................................... 5-14
- (Turn OFF Display)............................................................ 5-14
+ (Turn ON Display)............................................................. 5-15
n* (Repeat Function n Times)......................................... 5-16
$ (Execute Indirect File) .................................................... 5-17
PRINT (Display the ASCII String) ................................ 5-18
E or Q (exit or quit)............................................................... 5-18
IBIC Sample Programs .......................................................................... 5-19
Device Function Calls......................................................... 5-19
Board Function Calls............................................................ 5-22
Section Six - Applications Monitor....................................................... 6-1
Installing the Applications Monitor .................................................... 6-2
IBTRAP.......................................................................................... 6-2
Applications Monitor Options................................................................ 6-5
Main Commands.......................................................................................... 6-6
Session Summary Screen ........................................................................ 6-7
Configuring the Trap Mask ..................................................................... 6-7
Configuring the Monitor Mode.............................................................. 6-7
Hiding and Showing the Monitor ....................................... 6-8
Appendix A - Multiline Interface Messages................................. A-1
Multiline Interface Messages................................................................ A-2
Interface Message Reference List....................................................... A-4
Appendix B - Common Errors and Their Solutions
EDVR(0).......................................................................................................... B-1
ECIC(1)............................................................................................................ B-1
ENOL(2).......................................................................................................... B-2
EADR(3).......................................................................................................... B-3
EARG(4).......................................................................................................... B-3
ESAC(5).......................................................................................................... B-4
EABO(6).......................................................................................................... B-4
ENEB(7).......................................................................................................... B-5
EOIP(10).......................................................................................................... B-5
ECAP(11)........................................................................................................ B-5
EFSO(12)........................................................................................................ B-5
EBUS(14)........................................................................................................ B-6
ESTB(15)........................................................................................................ B-6
GPIB-PC User Manual xiv ©National Instruments Corp.
............................................................................................. B-1
ESRQ(16)........................................................................................................ B-6
Other Error Conditions............................................................................... B-7
Appendix C - Differences Between Software Revisions
Revision B and Revision C .................................................................... C-1
Revision C and Revision D .................................................................... C-2
............................................................................................... C-1
Interrupts ........................................................................................ C-1
Startup Program.......................................................................... C-1
Configuration Program ............................................................ C-1
Interface Bus Interactive Control Program (IBIC) .... C-1
New Functions ............................................................................ C-2
Modified Functions................................................................... C-2
Language Interfaces ................................................................. C-2
General........................................................................................... C-2
Device Functions....................................................................... C-2
Non-Interrupt Mode................................................................... C-2
Asynchronous I/O....................................................................... C-3
DMA on the GPIB-PCIII ........................................................ C-3
Local Lockout ............................................................................. C-3
SRQI Status Bit.......................................................................... C-3
ATN and/or TIMO..................................................................... C-3
DCAS and DTAS Status Bits .............................................. C-3
Printer Support ............................................................................ C-3
Contents
Appendix D - Using your Printer with the GPIB-PC
Installation...................................................................................................... D-1
............................................................................................... D-1
Appendix E - Application Notes.............................................................. E-1
Application Note 1 - Computer to Computer
Data Transfer ................................................................................................. E-1
Step 1. Configure the Computers...................................... E-1
Step 2. Establish Communication .................................... E-1
Step 3. Transfer Data.............................................................. E-2
Appendix F - Customer Communication ....................................... F-1
Glossary......................................................................................................................... G-1
Index................................................................................................................................. I-1
©National Instruments Corp. xv GPIB-PC User Manual

Illustrations

List of Figures

Figure 1.1 - GPIB Connector and the Signal Assignment .........................1- 6
Figure 1.2 - Linear Configuration .......................................................................... 1-7
Figure 1.3 - Star Configuration ............................................................................... 1-8
Figure 3.1 - Multiboard GPIB System...............................................................3-11
Figure 6.1 - Applications Monitor Popup Screen...........................................6-1

List of Tables

Table 2.1 - Timeout Settings .................................................................................2-13
Table 2.2 - Functions that Alter Default Characteristics .........................2-17
Table 4.1 - Status Word Layout .............................................................................4-2
Table 4.2 - GPIB Error Codes..................................................................................4-6
Table 4A.1 - BASICA GPIB-PC Functions ..................................................4A-7
Table 4A.2 - QuickBASIC GPIB-PC Calls...................................................4A-8
Table 4A.3 - QuickBASIC GPIB-PC Calls.................................................4A-10
Table 4A.4 - QuickBASIC Version 4.0 GPIB-PC Functions .............. 4A-14
Table 5.1 - Syntax of GPIB Functions in IBIC ...............................................5-8
Table 5.2 - Status Word Layout ........................................................................... 5-11
Table 5.3 - Auxiliary Functions that IBIC Supports ...................................5-12
©National Instruments Corp. xvii GPIB-PC User Manual

Section One - Operation of the GPIB

Communication between interconnected devices is achieved by passing messages through the interface system.

Types of Messages

The GPIB carries two types of messages — device-dependent messages and interface messages.
• Device-dependent messages, often called data or data messages,
contain device-specific information such as programming instructions, measurement results, machine status, and data files.
• Interface messages manage the bus itself. They are usually
called commands or command messages. Interface messages perform such functions as initializing the bus, addressing and unaddressing devices, and setting device modes for remote or local programming.
The term command as used here should not be confused with some device instructions which can also be called commands. Such device­specific instructions are actually data messages.

Talkers, Listeners, and Controllers

A Talker sends data messages to one or more Listeners. The Controller manages the flow of information on the GPIB by sending commands to all devices.
Devices can be Listeners, Talkers, and/or Controllers. A digital voltmeter, for example, is a Talker and may be a Listener as well.
The GPIB is a bus like an ordinary computer bus except that the computer has its circuit cards interconnected via a backplane bus whereas the GPIB has standalone devices interconnected via a cable bus.
The role of the GPIB Controller can also be compared to the role of the computer's CPU, but a better analogy is to the switching center of a city telephone system.
©National Instruments Corp. 1-1 GPIB-PC User Manual
Operation of the GPIB Section One
The switching center (Controller) monitors the communications network (GPIB). When the Controller notices that a party (device) wants to make a call (send a data message), it connects the caller (Talker) to the receiver (Listener).
The Controller usually addresses a Talker and a Listener before the Talker can send its message to the Listener. After the message is transmitted, the Controller usually unaddresses both devices.
Some bus configurations do not require a Controller. For example, one device may always be a Talker (called a Talk-only device) and there may be one or more Listen-only devices.
A Controller is necessary when the active or addressed Talker or Listener must be changed. The Controller function is usually handled by a computer.
With the GPIB-PC interface board and its software, your personal computer plays all three roles:
Controller - to manage the GPIB,
Talker - to send data, and
Listener - to receive data.

The Controller-In-Charge and System Controller

Although there can be multiple Controllers on the GPIB, only one Controller at a time is active, or Controller-In-Charge (CIC). Active control can be passed from the current CIC to an idle Controller. Only one device on the bus, the System Controller, can make itself the CIC. The GPIB-PC is usually the System Controller.
GPIB-PC User Manual 1-2 ©National Instruments Corp.
Section One Operation of the GPIB

GPIB Signals and Lines

The interface system consists of 16 signal lines and 8 ground return or shield drain lines.
The 16 signal lines are divided into the following three groups:
8 data lines,
3 handshake lines, and
5 interface management lines.

Data Lines

The eight data lines, DIO1 through DIO8, carry both data and command messages. All commands and most data use the 7-bit ASCII or ISO code set, in which case the 8th bit, DIO8, is unused or used for parity.

Handshake Lines

Three lines asynchronously control the transfer of message bytes between devices:
NRFD,
NDAC, and
DAV.
The process is called a three-wire interlocked handshake and it guarantees that message bytes on the data lines are sent and received without transmission error.

NRFD (not ready for data)

NRFD indicates when a device is ready or not ready to receive a message byte. The line is driven by all devices when receiving commands and by Listeners when receiving data messages.
©National Instruments Corp. 1-3 GPIB-PC User Manual
Operation of the GPIB Section One

NDAC (not data accepted)

NDAC indicates when a device has or has not accepted a message byte. The line is driven by all devices when receiving commands and by Listeners when receiving data messages.

DAV (data valid)

DAV tells when the signals on the data lines are stable (valid) and can be accepted safely by devices. The Controller drives DAV lines when sending commands and the Talker drives DAV lines when sending data messages.

Interface Management Lines

Five lines are used to manage the flow of information across the interface:
ATN,
IFC,
REN,
SRQ, and
EOI.

ATN (attention)

The Controller drives ATN true when it uses the data lines to send commands and false when it allows a Talker to send data messages.

IFC (interface clear)

The System Controller drives the IFC line to initialize the bus and become CIC.

REN (remote enable)

The System Controller drives the REN line, which is used to place devices in remote or local program mode.
GPIB-PC User Manual 1-4 ©National Instruments Corp.
Section One Operation of the GPIB

SRQ (service request)

Any device can drive the SRQ line to asynchronously request service from the Controller.

EOI (end or identify)

The EOI line has two purposes. The Talker uses the EOI line to mark the end of a message string. The Controller uses the EOI line to tell devices to identify their response in a parallel poll.

Physical and Electrical Characteristics

Devices are usually connected with a cable assembly consisting of a shielded 24-conductor cable with both a plug and receptacle connector at each end. This design allows devices to be linked in either a linear or a star configuration, or a combination of the two. See Figures 1.1,
1.2, and 1.3. The standard connector is the Amphenol or Cinch Series 57
MICRORIBBON or AMP CHAMP type. An adapter cable using non­standard cable and/or connector is used for special interconnect applications.
The GPIB uses negative logic with standard TTL logic level. When DAV is true, for example, it is a TTL low-level ( 0.8V), and when DAV is false, it is a TTL high-level ( 2.0V).
©National Instruments Corp. 1-5 GPIB-PC User Manual
Operation of the GPIB Section One
DIO1 DIO2 DIO3 DIO4
EOI
DAV
NRFD
NDAC
IFC
SRQ
ATN
SHIELD
1
13
2
14
3
15
4
16
5
17
6
18
7
19
8
20
9
21
10
22
1 1
23
12
24
DIO5 DIO6
DIO7 DIO8
REN GND (TW PAIR W/DAV) GND (TW PAIR W/NRFD) GND (TW PAIR W/NDAC) GND (TW PAIR W/IFC)
GND (TW PAIR W/SRQ) GND (TW PAIR W/ATN) SIGNAL GROUND

Figure 1.1 - GPIB Connector and the Signal Assignment

GPIB-PC User Manual 1-6 ©National Instruments Corp.
Section One Operation of the GPIB

Figure 1.2 - Linear Configuration

©National Instruments Corp. 1-7 GPIB-PC User Manual
Operation of the GPIB Section One

Figure 1.3 - Star Configuration

GPIB-PC User Manual 1-8 ©National Instruments Corp.
Section One Operation of the GPIB

Configuration Requirements

To achieve the high data transfer rate that the GPIB was designed for, the physical distance between devices and the number of devices on the bus are limited.
The following restrictions are typical.
• A maximum separation of four meters between any two devices and an average separation of two meters over the entire bus.
• A maximum total cable length of 20 meters.
• No more than 15 devices connected to each bus, with at least two-thirds powered on.
Bus extenders are available from National Instruments and other manufacturers for use when these limits must be exceeded.

Related Documents

For more information on topics covered in this section consult the following related documents.
• IEEE Std. 488-1978, IEEE Standard Digital Interface for Programmable Instrumentation.
GPIB-PC Technical Reference Manual.
©National Instruments Corp. 1-9 GPIB-PC User Manual

Section Two - Installation and Configuration

The procedures for installing your GPIB-PC depend on your model of board and your make of computer. A supplement to Section Two contains information about your interface board. Section Two A, for example, contains information about the model GPIB-PCIIA for the IBM PC and compatible computers.

Installing the Hardware

To install your hardware, follow the instructions in the Section Two supplement for your interface board.
If you change the default settings of any switches, make a note of the new values so that you can refer to them when you configure your software.
Install the hardware before continuing.

The GPIB-PC Software Package

Before you install your software, you might wish to review the files on your GPIB-PC distribution diskette to gain an understanding of what they are.
The following files are the main files of the GPIB-PC software:
GPIB.COM - is a device handler file that is loaded at system
start-up by the DOS operating system. Handler is a term used by National Instruments to refer to a loadable device driver.
BIB.M - is a language interface file that provides an
application program access to the GPIB-PC handler. BIB.M is intended for use with programs written in BASICA.
QBIB*.OBJ - is a language interface file that provides an
application program access to the GPIB-PC handler. QBIB*.OBJ is intended for use with programs written in QuickBASIC.
©National Instruments Corp. 2-1 GPIB-PC User Manual
Installation and Configuration Section Two
DECL.BAS - is a declaration file that contains code to be
placed at the beginning of the BASICA and QuickBASIC application programs.
QBDECL.BAS - is a declaration file that contains code to be
placed at the beginning of the QuickBASIC application programs.

Additional Programs and Files

The following additional programs and files include installation, test, and example programs:
APPMON.COM - is the applications monitor program. It is a
resident program that is useful in debugging sequences of GPIB calls from within your application. The applications monitor provides the capability to trap on return from GPIB driver calls, allowing you to inspect function arguments, buffers, return values, GPIB global variables, and other pertinent data.
IBTRAP.EXE - is a program that configures the applications
monitor.
IBSTART.BAT - is a batch file used for installation and start-
up. It is a multipurpose program that performs the software installation. It copies files, modifies CONFIG.SYS (the DOS system configuration file) using MKCFG.EXE, and tests the hardware using IBDIAG.EXE.
IBDIAG.EXE - is a program that tests the hardware installation
before the GPIB software is configured and installed. After the handler is installed, IBTEST.BAT confirms that both the software and hardware are installed and functioning properly. The test is executed in two parts using IBTSTA.EXE and IBTSTB.EXE.
IBCONF.EXE - is a software configuration program that allows
you to change the software parameters and other data used by the handler.
IBIC.EXE - is an interactive control program that allows you
to execute the handler functions interactively from your keyboard. It helps you to learn the functions, to program your instrument or other GPIB device, and to develop your application program.
GPIB-PC User Manual 2-2 ©National Instruments Corp.
Section Two Installation and Configuration
DBSAMP.BAS, BBSAMP.BAS, DQBSAMP, BIBSAMP, and
DIBSAMP - are example programs for BASICA, QuickBASIC,
and IBIC. The BASICA and QuickBASIC supplement of the manual, Section Four A, contains additional examples.

Installing the Software

The term boot disk refers to the hard disk or floppy disk that contains DOS and that is read by your computer when it is booted. The term boot refers to the action of loading DOS into your system from your boot disk, either when power is applied or when the warm boot keys are pressed.

Step 1 - Preparation

Your first step is determined by whether you wish to boot from a floppy disk or a hard disk. Perform the step that applies to your system.

Booting from a Floppy Disk

If you boot DOS from a floppy diskette, you need a boot disk with enough free space to hold a copy of the GPIB-PC software contained on the distribution diskette.
Insert the boot diskette into the first drive (usually named A:) and the distribution diskette into the second drive (B:). Boot your system if you have not already done so.

Booting from a Hard Disk

If you boot DOS from a hard disk, you need a personal computer with one floppy drive. The hard disk must have enough free space to hold a copy of the GPIB-PC software contained on the distribution diskette.
Boot your system. Then, insert the distribution diskette into the floppy drive.
©National Instruments Corp. 2-3 GPIB-PC User Manual
Installation and Configuration Section Two

Step 2 - Run IBSTART

Run IBSTART from the distribution diskette by switching to the drive containing the distribution diskette and entering:
ibstart x:
replacing x with the letter of the boot drive. For example, if the distribution diskette is in drive B and you have booted from drive A, enter:
b:
to switch to drive B. Next, enter:
ibstart a:
to run IBSTART. IBSTART first creates a directory called GPIB-PC on the boot diskette,
and copies the GPIB software to that directory. If the insufficient disk space message appears, abort the IBSTART program by
pressing the control key while you enter:
c
Increase the free space in your boot area and run IBSTART again. Next, IBSTART creates or modifies the DOS system configuration file
CONFIG.SYS to contain the line:
DEVICE=GPIB.COM
By reading this file at boot time, DOS installs new device drivers and handlers.
Next, IBSTART switches to the boot drive to run the hardware diagnostic program, IBDIAG.
GPIB-PC User Manual 2-4 ©National Instruments Corp.
Section Two Installation and Configuration
Finally, IBSTART advises you to complete the following actions:
•Run IBCONF if you must reconfigure the software;
Reboot your system to load the handler into DOS; and
Run IBTEST to test the installation of the software.

Step 3 - Run IBCONF (optional)

The pamphlet Getting Started with your GPIB-PC that comes with your interface board explains when you must run IBCONF to reconfigure the software. You may also run IBCONF to examine how the software is configured.
See More About run IBCONF and on the configurable software parameters.
NOTE: You must run IBCONF if you have a PCIIA, or wish to change defaults.
IBCONF
later in this section for information on how to

Step 4 - Reboot

Reboot your computer from the drive you specified when you ran IBSTART so that DOS will load the GPIB-PC handler.

Step 5 - Test Software Installation

Run IBTEST from the directory GPIB-PC in your boot area by entering:
cd gpib-pc ibtest
IBTEST tests whether the handler is installed and functioning with the
GPIB-PC.
©National Instruments Corp. 2-5 GPIB-PC User Manual
Installation and Configuration Section Two
If errors occur, check the following:
Did you read Getting Started with your GPIB-PC and make any
required changes? If not, do so now.
Did you change hardware switch settings on your GPIB-PC
board? If so, run IBCONF and accurately input the new settings for the board.
Are the GPIB.COM and CONFIG.SYS files installed in the root
directory of your boot drive? If not, check and repeat the installation instructions.
Did you reboot your system before you ran IBTEST? If not, do
so now.
If you have performed these steps and IBTEST still fails, carefully note all error information and call National Instruments.
If no errors occur, proceed to the end of this section to learn how to use the software and to develop your application program.

More About IBCONF

IBCONF is a screen-oriented, interactive program that is included on the distribution diskette of the GPIB-PC package.
You use IBCONF to edit the description in the handler of characteristics of the devices and boards in the system. Running IBCONF to place this information directly in the handler eliminates the need to restate it inside each application program.
IBCONF passes two groups of features to the handler. The first group consists of the characteristics of the instruments or devices attached to your GPIB-PC. The second group consists of the characteristics of each GPIB-PC installed in the computer.
GPIB-PC User Manual 2-6 ©National Instruments Corp.
Section Two Installation and Configuration

Characteristics of the Instruments

Each instrument used with the GPIB-PC has the following characteristics:
A symbolic name of each device on the GPIB (such as DEV5 or
PS5010).
A GPIB-PC access board for each device (e.g., GPIB0). The
access board is discussed in Device Map Concepts and Terms later in this section.
A primary and, if used, secondary address for each device.
A time limit that is to be imposed when executing certain
functions. This is to ensure that accessing a powered-off device does not hang up the GPIB indefinitely.
A way to terminate I/O transmissions to and from the device.
Some devices require or append an end-of-string character, such as the ASCII line feed character, to data strings. Others use the GPIB END message, which is sent or received via the EOI signal line. Still others use both. Some terminate messages only when a predetermined number of bytes are sent or received.

Characteristics of each GPIB-PC

Each GPIB-PC has the following characteristics:
A symbolic name (such as GPIB0 and GPIB1).
A computer I/O or port address.
The capability to be designated as the System Controller of the
devices on its bus.
A time limit that is imposed when executing certain functions.
A way to terminate I/O transmissions to and from the board
when executing board calls, i.e., by an end-of-string character, an END message, and/or a byte count.
An interrupt level that the board uses.
©National Instruments Corp. 2-7 GPIB-PC User Manual
Installation and Configuration Section Two
What DMA channel, if any, the board uses.
Whether it uses high-speed or normal timing when transmitting
data to a device. With normal timing, there is a delay of at least 2 µsec after the data is placed on the GPIB before the Data Valid (DAV) line is asserted. With high-speed timing, this delay is decreased to about 500 nsec.
The Internal Clock Frequency for a PC-IIA. This is the value of
the internal PC bus clock.

Default Configurations

Just as the hardware has factory default settings for switches and jumpers, the software also has factory default configurations. For example, the default device names of the 16 GPIB devices are DEV1 through DEV16, but you might wish to assign more descriptive names to each device, such as METER for a digital multimeter.
You can also use IBCONF to look at the current default settings in the handler file.
If you do not make changes using IBCONF, the default characteristics of the software remain in effect.

Primary Default Characteristics

The following are the primary default characteristics of the handler.
There are 16 active devices with symbolic names DEV1 through
DEV16.
GPIB addresses of these devices are the same as the device
number; for example, DEV1 is at address 1.
The 16 devices are assigned to GPIB0 as their access board.
GPIB0 is the symbolic name of the first GPIB-PC board in your system. If you have an additional GPIB-PC in your system, its symbolic name is GPIB1.
Each GPIB-PC is System Controller of its independent bus and
has a GPIB address of 0.
The END message is sent with the last byte of each data
message to a device. Each data message that is read from a
GPIB-PC User Manual 2-8 ©National Instruments Corp.
Section Two Installation and Configuration
device is automatically terminated when END is received. No end-of-string character is recognized.
The time limit on I/O and wait function calls is approximately
10 seconds.
GPIB0 is a Model GPIB-PCII, is at base I/O address hex 02B8,
and uses DMA Channel 1 and TLC Interrupt Line 7.
You must run IBCONF if you are using a GPIB-PCIIA or if you
have changed the hardware switches/jumpers on any GPIB-PC from the factory settings. Otherwise, it is unnecessary to run IBCONF. Consult the appropriate supplement to Section Two of the user manual to find the factory settings of your GPIB-PC model.

Running IBCONF

When you ran IBSTART, a copy of IBCONF.EXE was placed on your boot drive.
To run IBCONF, go to the root directory of the boot drive and enter:
ibconf
If you have a color monitor, the configuration program will automatically appear in color. If you have a color monitor but want the configuration program to appear in monochrome, enter:
ibconf -m
IBCONF scans the handler file, GPIB.COM, and reads its data structures
into memory. After you press a key, the program displays the Device Map for board GPIB0.
©National Instruments Corp. 2-9 GPIB-PC User Manual
Installation and Configuration Section Two
IBCONF makes changes to the GPIB.COM file, which should also be in the root directory. If you want IBCONF to make changes to a different copy of GPIB.COM such as GPIB2.COM, enter the path and name of the GPIB.COM file you want modified:
ibconf c:\GPIB-PC\GPIB2.COM
This will have the effect of changing the parameters within the GPIB2.COM file in the GPIB-PC subdirectory.
Modify only the copy of GPIB.COM created by IBSTART in your boot directory. Never modify the master copy on the distribution diskette. This would happen if you ran IBCONF from the distribution diskette and if the distribution diskette were not write-protected.

Upper and Lower Levels of IBCONF

IBCONF operates at both an upper and a lower level. The upper level consists of the Device Maps and gives an overview of the GPIB system as defined within the handler being configured. The lower level consists of screens that describe each individual board and device in the system.

Upper Level - Device Map for Board GPIBx

This screen displays the names of all devices defined in the handler file, and indicates which devices, if any, are accessed through the interface board GPIBx. At this level, you may:
Rename a device;
Disconnect a device from its assigned GPIB-PC access board or
connect (reassign) it to a different access board; or
Proceed to the lower level to edit or examine the
characteristics of a particular board or device.
Instructions are given on the screen for selecting the individual devices and for changing from one device map to another, for example, from the map for GPIB0 to that for GPIB1.
GPIB-PC User Manual 2-10 ©National Instruments Corp.
Section Two Installation and Configuration

Device Map Concepts and Terms

Device Name - contains up to seven characters. The rules for
naming devices are the same as DOS rules for naming files, except that suffixes (.xxx) are not allowed. DOS treats uppercase and lowercase letters identically. The string "PLOTTER" is treated the same as the string "plotter". For this reason, the configuration program maps all lowercase letters to uppercase.
Device names must not be given the same names as files, directories, and/or subdirectories. If you name a device PLTR and your file system already contains the file PLTR.DAT or a subdirectory PLTR, a conflict results.
Access Board - all devices on the GPIB require an access board
within the computer. The access board is the GPIB-PC interface board that provides the hardware link to the computer. The access board name is of the form GPIBx, where x is a digit 0 or 1 representing the appropriate GPIB board number. The access board name is not alterable.
The string representing a device or board name is the first variable argument of the function IBFIND called at the beginning of your application program. Refer to Sections Three and Four for detailed explanations of IBFIND.

Lower Level - Device/Board Characteristics

The lower level screens display the currently defined values for characteristics such as addressing and timeout information of a device or board. Instructions are available on the screen for selecting a specific field and for modifying the current settings. The configuration settings selected for each device and each board are a means of customizing the communications and other options to be used with that board or device.
The settings for devices specify the characteristics to be used by the access board for that device when device functions are used.
The settings for boards specify the characteristics to be used with each board when board functions are used. In the following explanations of device and board characteristics, notice that some characteristics apply to both devices and boards and some apply only to boards.
©National Instruments Corp. 2-11 GPIB-PC User Manual
Installation and Configuration Section Two

Device and Board Characteristics

Primary GPIB Address

Each device and board must be assigned a unique primary address in the range hex 00 to hex 1E. A listen address is formed by adding hex 20 to the primary address; the talk address is formed by adding hex 40 to the primary address. Consequently, a primary address of hex 10 corresponds to a listen address of hex 30 and a talk address of hex 50. The GPIB primary address of any device is set within that device, either with hardware switches, or, in some cases, a software program. This address and the address listed in IBCONF must be the same. Refer to the device-specific documentation provided with your instrument for instructions about that device's address. The primary GPIB address of all GPIB-PC boards is 0, unless changed by IBCONF. There are no hardware switches on the GPIB-PC to select the GPIB address.

Secondary GPIB Address

Any device or board using extended addressing must be assigned a secondary address in the range hex 60 to hex 7E, or the option NONE may be selected to disable secondary addressing. As with primary addressing, the secondary GPIB address of any device is set within that device, either with hardware switches, or, in some cases, a software program. This address and the address listed in IBCONF must be the same. Refer to the device documentation for instructions. Secondary addressing is disabled for all devices and boards unless changed by IBCONF.

Timeout Settings

The timeout value is the approximate length of time that may elapse before I/O functions such as IBRD, IBWRT, and IBCMD complete. It is also the length of time that the IBWAIT function waits for an event before returning if the TIMO bit is set. Consequently, a wait for the SRQ line to be asserted will terminate after the time limit is reached if both the SRQI and TIMO bits are set in the mask passed to IBWAIT, and no SRQ signal is detected. Refer to the IBWAIT function description in Sections Three and Four for more information.
GPIB-PC User Manual 2-12 ©National Instruments Corp.
Section Two Installation and Configuration
This field is set to a code mnemonic which specifies the time limit as follows:

Table 2.1 - Timeout Settings

Code Actual Value Minim um Timeo ut
TNONE 0 disabled T10µsec 1 10 µsec T30µsec 2 30 µsec T100µsec 3 100 µsec T300µsec 4 300 µsec T1msec 5 1 msec T3msec 6 3 msec T10msec 7 10 msec T30msec 8 30 msec T100msec 9 100 msec T300 10 300 ms ec T1sec 11 1 sec T3sec 12 3 sec T10sec 13 10 sec T30sec 14 30 sec T100sec 15 100 sec T300sec 16 300 sec T1000sec 17 1000 sec
NOTE: If you select TNONE, no limit will be in effect.
©National Instruments Corp. 2-13 GPIB-PC User Manual
Installation and Configuration Section Two

EOS Byte

Some devices can be programmed to terminate a read operation when a selected character is detected. A linefeed character (hex 0A) is a popular one.
NOTE: To send the EOS character to a device in a write operation, you must explicitly include that byte in your data string.

EOS Modes

Terminate a Read on EOS - Some devices send an EOS byte
signaling the last byte of a data message. A yes response will cause the GPIB-PC to terminate read operations when it receives the EOS byte.
Set EOI with EOS on Write - A yes response will cause the
GPIB-PC to assert the EOI (send END) line when the EOS character is sent.
7- or 8-bit compare on EOS - Along with the designation of an
EOS character, you may specify whether all eight bits are compared to detect EOS, or just the seven least significant bits (ASCII or ISO format).

Set EOI with last byte of Write

Some devices, as Listeners, require that the Talker terminate a data message by asserting the EOI signal line (sending END) with the last byte. A yes response will cause the GPIB-PC to assert EOI on the last data byte.

GPIB-PC Model

The GPIB-PC Model must be specified so that the handler will use the appropriate hardware addressing scheme.

Board is System Controller (Boards Only)

This field appears on the board characteristics screen only. Generally, the GPIB-PC will be the System Controller. In some situations, such as in a network of computers linked by the GPIB, another device may be System Controller and the GPIB-PC will NOT be designated System Controller. A yes response designates the GPIB-PC to be System Controller. A no response designates it not to be System Controller.
GPIB-PC User Manual 2-14 ©National Instruments Corp.
Section Two Installation and Configuration

Local Lockout on all Devices (Boards Only)

It is desirable to place many devices in the local lockout state while they are being remotely accessed. If yes is selected, the access board will place all of its devices in local lockout state while accessing them.

Disable Auto Serial Polling (Boards Only)

This option allows you to disable automatic serial polls if this feature is incompatible with certain devices on the bus. While this feature is on, the handler conducts serial polls of the devices and stores positive responses whenever the GPIB Service request (SRQ) line is asserted. Refer to Automatic Serial Polling of Section Four for further information. Normally, this feature will not conflict with devices that conform to the IEEE-488 specification.

High-Speed Timing (Boards Only)

Some devices are unable to read data messages at high-speed (Tri­state) timing. If your GPIB system has slower devices, you may want to select a longer data setting time by selecting no for this field.

Interrupt Jumper Setting (Boards Only)

This field must be set to the same value as the interrupt level jumper setting on the GPIB-PC board itself. For most personal computers, this jumper setting reflects the actual interrupt level selected. Any exception is explained in the Getting Started with your GPIB-PC pamphlet that comes with the interface board. Any valid interrupt level may be selected, provided the level does not conflict with other equipment.

Base I/O Address (Boards Only)

The GPIB-PC may be assigned any one of the legal base I/O or port addresses as described in the appropriate supplement to this section. The value entered must match the hardware setting selected during hardware configuration. If it does not match, the handler cannot communicate with the GPIB-PC.
©National Instruments Corp. 2-15 GPIB-PC User Manual
Installation and Configuration Section Two

DMA Channel (Boards Only)

This field appears only on computers supporting DMA capability. The GPIB-PC may use any of the three DMA channels, 1, 2, or 3, provided that another device is not already using that channel. If a DMA channel is not available, programmed I/O can be enabled by selecting NONE.

Internal Clock Frequency (Boards Only)

For the GPIB-PCII, this value is equal to the frequency of the PC bus signal OSC divided by 2 and rounded up. Since OSC is fixed at 14.14 MHz for all IBM PCs and compatibles, this field is always set to 8.
For the GPIB-PCIIA, this value is equal to the frequency of the PC bus signal CLK and rounded up. Since the signal CLK varies according to the machine, this field varies as well. Typical examples are:
Ma ch i ne PCII ICF value PCIIA ICF value
IBM PC, XT, and compatibles 8 5 IBM XT (new) 8 8 IBM AT and compatibles 8 6 Compaq Deskpro 8 5,8 Compaq Deskpro 286 8 6,8 Compaq Portable 286 8 6,8
Notice that on some computers the CLK frequency depends on whether the CPU is operated at normal or high-speed mode. If you want to operate the GPIB-PC under both modes, either reconfigure the software or use the higher value. If you are in doubt as to what value to enter, use 8.

Exiting IBCONF

Once all changes have been made, you may exit IBCONF by typing the function key indicated on the screen. The program will first ask if it should save any changes before exiting. Typing a y response causes the changes to be written to the file on disk. Before exiting, the program will check for situations that may cause problems.
GPIB-PC User Manual 2-16 ©National Instruments Corp.
Section Two Installation and Configuration
Situations which are checked are as follows:
GPIB addressing conflict between a device and its access
board;
GPIB boards not present in the host machine at the specified
address; and
Timeouts disabled on a device or board.
If any of these situations is encountered, you will be notified and given the option of re-entering or exiting IBCONF. To disable auto-checking, call IBCONF -E.
After exiting, the system MUST be rebooted for the new values to take effect.
Some functions may be called during the execution of an application program to change some of the configured values temporarily. These functions are shown in Table 2.2.

Table 2.2 - Functions that Alter Default Characteristics

Characteristic Dynamically Changed by
Primary GPIB address IBPAD Secondary GPIB address IBSAD End-of-string (EOS) byte IBEOS 7- or 8- bit compare on EOS IBEOS Set EOI with EOS on Write IBEOS Terminate a Read on EOS IBEOS Set EOI w/last byte of Write IBEOT Change board assignment IBBNA Enable or disable DMA IBDMA Change or disable time limit IBTMO Request/release system control IBRSC
©National Instruments Corp. 2-17 GPIB-PC User Manual
Installation and Configuration Section Two

Using Your GPIB-PC

Now that your software and hardware are installed, read Section Three for an introduction to the functions available for the GPIB-PC. The functions are described in the order that you will most likely use them. Pay special attention to Group I, Group II, and Group III.
After reading about these functions, practice using them with your programmable instrument or device in an interactive environment using the IBIC program described in Section Five. IBIC allows you to program your instrument interactively from the computer keyboard rather than from an application program. This helps you understand how the device and the handler work. It also familiarizes you with status information that is returned by each function and that is also available to your application program in the form of global variables.
While running IBIC, study the descriptions of each function given in Section Four to fully understand the purpose and syntax of each function.
Finally, referring to the appropriate language supplement of Section Four, write your application program. Whenever possible, use IBIC to test the sequence of the GPIB-PC function calls your application program makes. Trying your function calls from IBIC is especially helpful if your application program responds in an unexpected manner.
GPIB-PC User Manual 2-18 ©National Instruments Corp.

Section Three - GPIB-PC Functions — Introduction

This section introduces you to the GPIB-PC handler functions and their capabilities. They are described in the order you will most likely use them.
Application environments for which the functions are designed are described. Short examples illustrate how the functions operate.

Introduction to the GPIB-PC Functions

The GPIB-PC functions are high-level and low-level functions that communicate with and control devices on the GPIB. The functions are divided into six groups, and each group is distinguished by the type of applications it serves. The functions contained in the first three groups are mostly high-level, while those of the last three are mostly low-level.

High-Level Functions

High-level functions are easy to learn and use. They automatically execute sequences of commands that handle bus management operations required to perform activities such as reading from and writing to devices and polling them for status. These functions free you from having to know the GPIB protocol or bus management details involved. Most device functions (functions that specify a device) are high-level functions.

Low-Level Functions

In contrast, low-level functions perform rudimentary or primitive operations that require that you know something about GPIB protocol to use them effectively. They are needed because high-level functions do not always meet the requirements of applications. In such cases, low­level functions offer the flexibility you need to solve most of your application problems. All board functions (functions that specify a board) are low-level functions.

Calling Syntax

The calling syntax for GPIB-PC functions varies according to the language used. In this section, a generic syntax is used to identify the function and its arguments.
©National Instruments Corp. 3-1 GPIB-PC User Manual
GPIB-PC Functions — Introduction Section Three

Group I

Group I functions may be the only functions you need for many of your instrument control applications. Group I functions are as follows:
IBRD,
IBWRT, and
IBFIND.
They are suitable for your applications under the following conditions:
Communication is between the Controller (computer) and one
device at a time. Messages are not broadcast to several devices at once, and devices do not talk to each other directly.
Devices do not require special services or operations, such as
polling or triggering, to send or receive data.
IBRD and IBWRT are high-level input/output (I/O) functions. IBFIND is a start-up function that opens the device.

IBRD (bd,buf,cnt)

IBRD reads a specified number of bytes from a device and stores them in memory. The device is automatically addressed before reading and unaddressed afterward. If not done previously, the GPIB is initialized on entering the function and the device is placed in remote programming mode.
When programming in BASIC, IBRD performs string transfers. IBRDI is available for binary transfers to an integer array.

IBWRT (bd,buf,cnt)

IBWRT writes a specified number of bytes from the memory buffer to a device. The device is automatically addressed before writing and unaddressed afterward. If not done previously, the GPIB is initialized on entering the function, and the device is placed in remote programming mode.
When programming in BASIC, IBWRT performs string transfers. IBWRTI is available for binary transfers from an integer array.
GPIB-PC User Manual 3-2 ©National Instruments Corp.
Section Three GPIB-PC Functions — Introduction

IBFIND (bdname,bd)

IBFIND returns a unit descriptor associated with the name of the device. When the software is installed, a description of each device is placed in an internal reference table accessible by the handler. This description includes the GPIB address, end-of-string (EOS) modes, timeout selection, and a name for the device.

Group II

Group II functions offer additional high-level device services often needed in common instrument control applications. Group II functions are as follows:
IBRSP,
IBCLR,
IBTRG, and
IBLOC.

IBRSP (bd,spr)

IBRSP serially polls a device and returns its status response. The response consists of a single byte in which the hex 40 bit is set if the device is requesting service and asserting Service Request (SRQ).
Here are examples of a Tektronix 4041 BASIC SRQ handler call and the corresponding IBRSP call. In this case, the device being polled is the plotter and is at GPIB address 7:
POLL STATUS, ADDRESS; 7
CALL IBRSP (PLTR%,STATUS%)
In both cases, the plotter's status response is stored in the variable STATUS.
Unless disabled during software configuration, any device function call will automatically conduct serial polls if SRQ is asserted on GPIB. This automatic serial polling is discussed in Section Four.
©National Instruments Corp. 3-3 GPIB-PC User Manual
GPIB-PC Functions — Introduction Section Three

IBCLR (bd)

IBCLR clears the device by sending to it the Selected Device Clear (SDC) and appropriate addressing commands.

Clearing the Device Versus Clearing the GPIB

There is a difference between clearing or initializing devices and clearing or initializing the GPIB itself.

Clearing the Device

The Selected Device Clear (SDC) command that is sent by the IBCLR function resets internal functions of the device, such as causing a digital multimeter to change its function, range, and trigger mode back to default settings.

Clearing the GPIB

The Interface Clear (IFC) command initializes the GPIB and the bus interface circuits of all attached devices without affecting internal functions. IFC is sent automatically when the first device function is called.
A device function is a function that references a device such as the four already described: IBRD, IBWRT, IBRSP, and IBCLR.

IBTRG (bd)

IBTRG triggers the device by sending to it the Group Execute Trigger (GET) and appropriate addressing commands.

IBLOC (bd)

IBLOC places the device in local program mode by sending the Go To Local (GTL) and appropriate addressing commands to the device.

Placing a Device in Remote Mode

The first device function call after power-on, in addition to sending the IFC command as previously described, also places the device in remote program mode by setting the GPIB Remote Enable (REN) line and addressing the device to listen.
GPIB-PC User Manual 3-4 ©National Instruments Corp.
Section Three GPIB-PC Functions — Introduction

Placing a Device in Local Mode

Devices must usually be placed in remote program mode before they can be programmed from the GPIB. This operation is done automatically by the handler. The IBLOC function is then used when that device must be returned to local program mode.
In addition, unless disabled using the configuration program (IBCONF), the handler places devices in local lockout mode, which prevents you from returning a device to local mode using the device's front-panel control.
The seven previously described functions will be sufficient to meet your application needs, in most cases. They are the most important functions for you to learn.

Group III

The functions of Group III are more flexible for controlling and communicating with devices. Group III functions are as follows:
IBRDA,
IBWRTA,
IBRDF,
IBWRTF,
IBWAIT,
IBSTOP,
IBTMO,
IBONL, and
IBPCT.
©National Instruments Corp. 3-5 GPIB-PC User Manual
GPIB-PC Functions — Introduction Section Three
These functions are used under the following conditions:
Program execution must proceed in parallel with GPIB I/O –
often called asynchronous operation.
I/O is to or from a file rather than a memory buffer.
Controller-In-Charge authority must be transferred to another
GPIB device.
The timeout value must be changed.
The handler must be reinitialized with respect to certain
devices.

IBRDA (bd,buf,cnt) and IBWRTA (bd,buf,cnt)

These functions are similar to IBRD and IBWRT except that the operation is asynchronous. This means that the function returns after starting the I/O operation without waiting for it to complete.
When programming in BASIC, IBRDA and IBWRTA perform string transfers. IBRDIA and IBWRTIA are available for transfers to and from an integer array.

IBRDF (bd,buf,cnt) and IBWRTF (bd,buf,cnt)

These functions are similar to IBRD and IBWRT except that data is read into a file.

IBWAIT (bd,mask)

IBWAIT waits for one or more events to occur. For the IBRDA and IBWRTA functions, the event to wait for is the completion of the
operation.

IBSTOP (bd)

IBSTOP aborts any asynchronous operation associated with the device.
GPIB-PC User Manual 3-6 ©National Instruments Corp.
Section Three GPIB-PC Functions — Introduction

IBTMO (bd,v)

IBTMO changes the time limit in which operations with the device must complete.

IBONL (bd,v)

IBONL re-initializes the device and cancels any asynchronous I/O in progress. All reconfigurable software parameters, such as the time limit just discussed, are reset to their power-on values. See the discussion of software configuration in Section Two for further information on reconfigurable software parameters.
The last function in this group allows the computer to pass control to another device capable of being the Controller.

IBPCT (bd)

IBPCT passes Controller-In-Charge authority to the specified device by sending the Take Control (TCT) commands and appropriate addressing commands.
Most GPIB-compatible instruments or other types of devices can be programmed using the high-level functions of Groups I, II, or III. Not all devices, however, are completely compatible with the IEEE-488 specification, nor are the combinations of bus management and/or I/O operations contained in the high-level functions suitable for all applications.
Some operations, such as interprocessor networks and peripheral sharing, require additional capabilities and flexibility in controlling the GPIB. This is achieved, in part, with low-level functions that perform single GPIB activities, each with a limited scope or objective. Powerful and versatile routines can be developed using these functions. Groups IV, V, and VI consist mostly of low-level functions.
©National Instruments Corp. 3-7 GPIB-PC User Manual
GPIB-PC Functions — Introduction Section Three

Group IV

The functions described previously have been device functions; that is, the bd argument referred to a device on the GPIB. This section introduces board functions, where bd refers to a specific GPIB-PC interface board in the computer. Group IV functions are as follows:
IBFIND,
IBCMD,
IBCMDA,
IBRD,
IBRDA,
IBWRT,
IBWRTA,
IBSTOP,
IBWAIT,
IBTMO,
IBONL,
IBSIC,
IBSRE,
IBGTS,
IBCAC,
IBRPP, and
IBPPC.
GPIB-PC User Manual 3-8 ©National Instruments Corp.
Section Three GPIB-PC Functions — Introduction
Group IV functions can be used under the following conditions:
Messages are broadcast to more than one device at a time.
Messages are sent directly from one device to another, without
passing through the Controller.
GPIB lines, such as Attention (ATN), must be turned off or on
in a particular fashion to ensure proper operation of a device.
Devices must be polled in parallel rather than in serial.

Purpose of Board Functions

The handler software can control or communicate over the GPIB only by manipulating a GPIB-PC interface board. Remote devices are accessed indirectly by programming the interface board to do specific things. Device functions are selected sequences of some basic board functions.
Board functions provide the precise control of the GPIB that is needed for special applications.

Multiboard Capability

The handler can control or manipulate more than one interface board. This type of handler is commonly called a multiboard handler, as opposed to a single board handler in which one copy of the handler can control only one board.
Figure 3.1 shows a multiboard GPIB system with board GPIB0 connected to two devices, an oscilloscope and a digital voltmeter; and with board GPIB1 connected to two other devices, a printer and a plotter.
Each board is called the access board for its attached devices because the board is used automatically by the device functions to access those devices. More information about board and device functions is provided in More About Device and Board Functions at the end of this section.
©National Instruments Corp. 3-9 GPIB-PC User Manual
GPIB-PC Functions — Introduction Section Three

IBFIND (bdname,bd)

This is the same as the Group I function except that boards are assigned names at configuration time in the form GPIBn, where n is a board's decimal number (0, 1, 2, ...) within the computer. For instance, in a system with two GPIB boards, the first is named GPIB0 and the second GPIB1.

IBCMD (bd,buf,cnt) and IBCMDA (bd,buf,cnt)

Both functions use the specified board to write commands from memory to the GPIB. The messages are sent synchronously using IBCMD and asynchronously using IBCMDA. These command functions are used, for example, to address and unaddress GPIB devices and to send interface messages that enable and disable devices for serial and parallel polls, that clear and trigger devices, and that lock out front panel control of devices.

IBRD (bd,buf,cnt) and IBRDA (bd,buf,cnt)

Both functions use the specified board to read from a device that has already been addressed to talk (for example, by the IBCMD or IBCMDA function). The syntax for these low-level functions is the same as their high-level counterparts of Group I and III. The software automatically differentiates bd descriptors that refer to devices from those that refer to boards, and executes the read operations appropriately.
IBRDI and IBRDIA are also available in BASIC for binary transfers to an integer array.
GPIB-PC User Manual 3-10 ©National Instruments Corp.
Section Three GPIB-PC Functions — Introduction
Boards Devices
GPIB
Board
GPIB0
Digital Voltmeter
DVM
GPIB
Board
GPIB1
Printer
PRTR
Oscilloscope
SCOPE
Plotter
PLTR

Figure 3.1 - Multiboard GPIB System

One
GPIB
Another
GPIB
©National Instruments Corp. 3 -11 GPIB-PC User Manual
GPIB-PC Functions — Introduction Section Three

IBWRT (bd,buf,cnt) and IBWRTA (bd,buf,cnt)

Both functions use the specified board to write to one or more devices that have already been addressed to listen (for example, by the IBCMD or IBCMDA function). The syntax for these low-level functions is the same as their high-level counterparts of Group I and III. The software automatically differentiates between bd descriptors that refer to devices and those that refer to boards, and executes the write operations appropriately.
IBWRTI and IBWRTIA are also available in BASIC for binary transfers from an integer array.

IBSTOP (bd)

IBSTOP aborts any asynchronous operation associated with the board.

IBWAIT (bd,mask)

IBWAIT waits for the specified board to detect one of the events selected in the mask bit vector to occur. These events include the completion of asynchronous input/output (CMPL); the board becoming a talker (TACS), listener (LACS), or Controller-In-Charge (CIC); detection of a GPIB Service Request (SRQI); assertion of the Attention signal (ATN); detection of the END message (END); or detection of a time limit (TIMO) or other error condition (ERR).

IBTMO (bd,v)

IBTMO changes the time limit in which operations with the board must complete.

IBONL (bd,v)

IBONL performs the same initialization function for boards as the Group III IBONL function does for devices. In addition, the hardware as well as the software is reset and the board is placed online (enabled) or offline (disabled).

IBSIC (bd)

IBSIC uses the board to initialize the GPIB by sending the Interface Clear (IFC) message.
GPIB-PC User Manual 3-12 ©National Instruments Corp.
Section Three GPIB-PC Functions — Introduction

IBSRE (bd,v)

IBSRE uses the board to set or clear the GPIB Remote Enable (REN) line.

IBGTS (bd,v)

IBGTS causes the board to go from Active Controller to Standby Controller, and in so doing to turn the ATN signal off. This function is generally used to allow two external devices to talk to each other directly. The board can selectively participate in the handshake of the data transfer and hold off the handshake when the END message is detected. The board may then take control synchronously without corrupting the transfer.

IBCAC (bd,v)

IBCAC causes the board to take control of the GPIB by setting ATN and going from Standby to Active Controller. The board can take control synchronously or asynchronously.

IBRPP (bd,buf)

IBRPP conducts a parallel poll and returns the result.

IBPPC (bd,v)

IBPPC remotely configures or unconfigures the devices for parallel polls.
©National Instruments Corp. 3 -13 GPIB-PC User Manual
GPIB-PC Functions — Introduction Section Three

More About Device and Board Functions

Before proceeding to the next group of functions, you will find it helpful to compare how a high-level device function can be replaced by several low-level board functions. Conducting a serial poll is a good example. In the discussion of the IBRSP function of Group II, this BASIC example of the device function was used:
CALL IBRSP (PLTR%,STATUS%)
This is equivalent to the following sequence using the board functions just described:
CMD$ = "?" + CHR$(&H18) + "G!" CALL IBCMD (GPIB0%,CMD$) STATUS$ = SPACE$(1) CALL IBRD (GPIB0%,STATUS$) CMD$ = "_?" + CHR$(&H19) CALL IBCMD (GPIB0%,CMD$)
The first IBCMD function is used to send the string of ASCII commands assigned in the first program line. These are Unlisten (?), Serial Poll Enable (CHR$(&H18)), talk address of the plotter (G), and listen address of the board (!). Now that the plotter is enabled to send its status byte and the board is addressed to receive it, the IBRD function is called to read the byte and store it in the variable STATUS. The final IBCMD function completes the poll by sending the command string consisting of three messages: Untalk (_), Unlisten (? ), and Serial Poll Disable (CHR$(&H19)).
You can see that a high-level device function is easier to use. However, when an application requires a more complex serial poll routine than the one just described, such as a serial poll routine which polls several devices in succession and provides other servicing operations at the same time, low-level board functions can be used to create such a routine.
GPIB-PC User Manual 3-14 ©National Instruments Corp.
Section Three GPIB-PC Functions — Introduction

Group V

Group V functions are used when the GPIB-PC is not CIC. An example is a system where the computer in which the board is installed performs as an instrument, but is controlled by another device on the GPIB. Group V functions are as follows:
IBRSV,
IBLOC,
IBPPC,
IBIST, and
IBWAIT.
These functions are used to:
Request service from the CIC.
Simulate a front panel "return to local" switch.
Reconfigure a board or device for a parallel poll.
Locally configure for parallel polls and change the parallel poll
flag.
Wait for the CIC to execute certain actions.

IBRSV (bd,v)

IBRSV requests service from the CIC and to set the status byte that is sent when the board is serially polled by the controller.

IBLOC (bd)

IBLOC sends a return to local message to the board. The message clears an internal remote status condition if it is set and the internal lockout status condition is not set. These conditions can be checked with the IBWAIT function. How the application program interprets this action is system dependent.
©National Instruments Corp. 3 -15 GPIB-PC User Manual
GPIB-PC Functions — Introduction Section Three

IBPPC (bd,v)

IBPPC locally configures or unconfigures the board for parallel polls.

IBIST (bd,v)

IBIST sets or clears the board's parallel poll flag (also known as the individual status bit).

IBWAIT (bd,mask)

This function is described in Group IV. It is included here to describe the additional events associated with noncontroller operations that the function can detect. These include being triggered (DTAS) or cleared (DCAS) by the controller, being placed in remote programming mode (REM) by the controller, or being placed in a lockout state (LOK) by the controller.
GPIB-PC User Manual 3-16 ©National Instruments Corp.
Section Three GPIB-PC Functions — Introduction

Group VI

Group VI functions are used only when the default values of the configuration parameters set during software installation need to be changed dynamically or temporarily during execution of the application program. Group VI functions are as follows:
IBEOT,
IBEOS,
IBBNA,
IBDMA,
IBPAD,
IBSAD,
IBRSC, and
IBTMO.
They are used to accomplish the following actions:
Change the way I/O transmissions are terminated.
Associate a device with a different access board.
Change from DMA to programmed I/O.
Change the GPIB address of a board or device.
Request or release System Control.

IBEOT (bd,v)

IBEOT enables or disables sending the END message (EOI) with the last byte written by the board.
©National Instruments Corp. 3 -17 GPIB-PC User Manual
GPIB-PC Functions — Introduction Section Three

IBEOS (bd,v)

IBEOS assigns the end of string (EOS) character to use with subsequent IBRD and IBWRT operations. This character is compared with incoming
bytes from the device and may be used to terminate a read operation. It is also compared with outgoing bytes to the device and may be used to generate the END message (EOI).

IBBNA (bd,"GPIBn")

IBBNA assigns board n to be the access board for device bd.

IBDMA (bd,v)

IBDMA selects DMA or programmed I/O for the board. This function is only appropriate for boards with DMA capability.

IBPAD (bd,v)

IBPAD sets the primary GPIB address of the device or board.

IBSAD (bd,v)

IBSAD sets the board's or device's secondary GPIB address or disables secondary addressing.

IBRSC (bd,v)

IBRSC causes the board to request or release System Control authority.

IBTMO (bd,v)

IBTMO sets the time limit in which operations with a device or board must complete.
Another important feature of the GPIB-PC functions is that they return status information about the boards and devices in the system. This information is returned in the form of three global status variables, IBSTA, IBERR, and IBCNT. The beginning of Section Four fully describes these variables.
GPIB-PC User Manual 3-18 ©National Instruments Corp.

Section Four - GPIB-PC Functions — Overview

This section consists of Section Four and a BASIC supplement. Section Four contains a discussion of the important characteristics common to all programming languages. The BASIC supplement lists the GPIB functions for BASICA and QuickBASIC languages.
When you order a language other than BASIC, you receive a separate supplement unless your language is very similar to BASICA. Insert any new supplements in place of or in addition to Section Four A.

General Programming Information

The following characteristics are common to all programming languages:
A Status Word,
Error Codes,
A Count Variable,
Read and Write Termination,
Device Function Calls, and
Automatic Serial Polling.
A thorough understanding of the concepts presented here is essential to the implementation of a GPIB system.
The next several paragraphs explain the status word (IBSTA), the error variable (IBERR), and the count variable (IBCNT). These variables are updated with each function call to reflect the status of the most recently referenced device or board.
©National Instruments Corp. 4-1 GPIB-PC User Manual
GPIB-PC Functions — Overview Section Four

Status Word

All functions return a status word containing information about the state of the GPIB and the GPIB-PC. You should test for the conditions reported in the status word to make decisions about continued processing. The status word is returned in the variable IBSTA.
The status word contains 16 bits, of which 14 are meaningful. A bit value of 1 indicates the corresponding condition is in effect. A bit value of zero indicates the condition is not in effect.
Table 4.1 lists the conditions and the bit position to be tested for that condition. Some bits are set only on device function calls (d); some bits are set only on board function calls (b); and some bits are set on either type (db).

Table 4.1 - Status Word Layout

Mnemonics Bit Hex Function Description
Pos. Value Type
ERR 15 8000 db GPIB error TIMO 14 4000 db Time limit exceeded END 13 2000 db END or EOS detected SRQI 12 1000 b SRQ interrupt received RQS 11 800 d Device requesting
service CMPL 8 100 db I/O completed LOK 7 80 b Lockout State REM 6 40 b Remote State CIC 5 20 b Controller-In-Charge ATN 4 10 b Attention is asserted TACS 3 8 b Talker LACS 2 4 b Listener DTAS 1 2 b Device Trigger State DCAS 0 1 b Device Clear State
A description of each status word and its condition follows.
GPIB-PC User Manual 4-2 ©National Instruments Corp.
Section Four GPIB-PC Functions — Overview
ERR (db) ERR is set in the status word following any call that results
in an error; the particular error may be determined by examining the IBERR variable. It is cleared following any call that does not result in an error.
NOTE: Always check for an error condition after each call. An error made early in your application program may not become apparent until a later instruction. At that time, the error can be more difficult to locate.
TIMO (db) TIMO specifies whether a timeout has occurred. It is set in
the status word following a call to IBWAIT if the TIMO bit of the IBWAIT mask parameter is also set and if the wait has exceeded the time limit value that is set by the IBTMO call. It is also set following a call to any of the synchronous I/O functions (e.g., IBRD, IBWRT, and IBCMD) if a timeout occurs during a call. TIMO is cleared in the status word in all other circumstances.
END (db) END specifies whether the END or EOS message has been
received. It is set in the status word following a read function if the END or EOS message was detected during the read. While the GPIB-PC is performing a shadow handshake as a result of the IBGTS function, any other function call may return a status word with the END bit set if the END or EOS message occurred before or during that call. It is cleared in the status word when any I/O operation is initiated.
SRQI (b) SRQI specifies whether a device is requesting service. It is
set in the status word whenever the GPIB-PC is CIC and the GPIB SRQ line is asserted. It is cleared whenever the GPIB-PC ceases to be the CIC, or the GPIB SRQ line is unasserted. The bit is also cleared when executing board functions and the GPIB-PC is an active talker, i.e., it is addressed to talk and ATN is unasserted.
In Revision D software, the SRQI status bit always reflects the current level of the SRQ line whether or not the GPIB­PC is CIC.
©National Instruments Corp. 4-3 GPIB-PC User Manual
GPIB-PC Functions — Overview Section Four
RQS (d) RQS appears only in the status word of a device function
call. Indicates that the device is requesting service. It is set in the status word whenever the hex 40 bit is asserted in the device's serial poll status byte. The serial poll which obtains the status byte may be the result of an IBRSP call, or it may be done automatically by the handler. It is cleared when the user has called IBRSP to read the serial poll status byte that caused the RQS. An IBWAIT on RQS should only be done on devices that respond to serial polls.
CMPL (db) CMPL specifies the condition of outstanding I/O operations.
It is set in the status word whenever I/O is not in progress; that is, whenever I/O is complete. It is cleared while I/O is in progress.
LOK (b) LOK specifies whether the board is in a lockout state.
While LOK is set, the function IBLOC is effectively inoperative for that board. It is set whenever the GPIB-PC detects the Local Lockout (LLO) message has been sent either by the GPIB-PC or by another Controller. It is cleared when the Remote Enable (REN) GPIB line becomes unasserted either by the GPIB-PC or by another Controller.
REM (b) REM specifies whether the board is in remote state. It is
set whenever the Remote Enable (REN) GPIB line is asserted and the GPIB-PC detects its listen address has been sent either by the GPIB-PC or by another Controller. It is cleared whenever REN becomes unasserted, or when the GPIB-PC as a Listener detects the Go to Local (GTL) command has been sent either by the GPIB-PC or by another Controller, or when the IBLOC function is called while the LOK bit is cleared in the status word.
CIC (b) CIC specifies whether the GPIB-PC is the Controller-In-
Charge. It is set whenever the IBSIC function is called while the GPIB-PC is System Controller, or when another Controller passes control to the GPIB-PC. It is cleared whenever the GPIB-PC detects Interface Clear (IFC) from the System Controller, or when the GPIB-PC passes control to another device.
ATN (b) ATN specifies the state of the GPIB Attention (ATN) line.
It is set whenever the GPIB ATN line is asserted and cleared when the ATN line is unasserted.
TACS (b) TACS specifies whether the GPIB-PC has been addressed
GPIB-PC User Manual 4-4 ©National Instruments Corp.
Section Four GPIB-PC Functions — Overview
as a Talker. It is sent either by the GPIB-PC itself or by another Controller. It is cleared whenever the GPIB-PC detects the Untalk (UNT) command, a talk address other than its own talk address, or Interface Clear (IFC).
LACS (b) LACS specifies whether the GPIB-PC has been addressed
as a Listener. It is set whenever the GPIB-PC detects its listen address (and secondary address, if enabled) has been sent either by the GPIB-PC itself or by another Controller. It is also set whenever the GPIB-PC shadow handshakes as a result of the IBGTS function. It is cleared whenever the GPIB-PC detects the Unlisten (UNL) command, its own talk address, Interface Clear (IFC), or IBGTS is called without shadow handshake.
DTAS (b) DTAS specifies whether the GPIB-PC has detected a
device trigger command. It is set whenever the GPIB-PC, as a Listener, detects the Group Execute Trigger (GET) command has been sent by another Controller. It is cleared in the status word on any call immediately following an IBWAIT call if the DTAS bit is set in the IBWAIT mask parameter.
DCAS (b) DCAS specifies whether the GPIB-PC has detected a
device clear command. It is set whenever the GPIB-PC detects the Device Clear (DCL) command has been sent by another Controller, or whenever the GPIB-PC as a Listener detects the Selected Device Clear (SDC) command has been sent by another Controller. It is cleared in the status word on any call immediately following an IBWAIT call if the DCAS bit was set in the IBWAIT mask parameter, or on any call immediately following a read or write.
In addition to the above, the following situations also affect the status word bits:
A call to the function IBONL clears the following bits:
END LOK REM CIC TACS LACS DTAS DCAS
A call to IBONL affects bits other than those listed here
according to the rules explained above.
In the event that a function call returns an ENEB or EDVR error, all status word bits except the ERR bit are cleared, since these error codes indicate that it is not possible to obtain the status of the GPIB-PC.
©National Instruments Corp. 4-5 GPIB-PC User Manual
GPIB-PC Functions — Overview Section Four

Error Codes

When the ERR bit is set in the status word, a GPIB error has occurred. The error code is returned in the variable IBERR.
There are 14 possible error codes. Table 4.2 lists these codes, a recommended mnemonic to be associated with that type of error, and the numeric value of the code.

Table 4.2 - GPIB Error Codes

Suggested Decimal Explanation
Mnemonic Value
EDVR 0 DOS error ECIC 1 Function requires GPIB-PC to be CIC ENOL 2 N o Listener on write function EADR 3 GPIB-PC not addressed correctly EARG 4 Invalid argument to function call ESAC 5 GPIB-PC not System Controller as required EABO 6 I/O operation aborted ENEB 7 Non-existent GPIB-PC board EOIP 10 I/O started before previous operation
completed ECAP 11 No capability for operation EFSO 12 File system error EBUS 14 Command error during device call ESTB 15 Serial Poll status byte lost ESRQ 16 SRQ stuck in ON position
A description of each error and some conditions under which it may occur follows:
EDVR (0) EDVR is returned by the language interface when the
device or board name passed in an IBFIND call is not configured in the handler. In this case, the variable IBCNT will contain the DOS error code 2, "Device not found." The remedy is to replace the argument to IBFIND with a valid board or device name, or reconfigure the handler using the IBCONF utility to recognize the name.
GPIB-PC User Manual 4-6 ©National Instruments Corp.
Section Four GPIB-PC Functions — Overview
It is also returned when an invalid unit descriptor is passed to any function call. In this case, the variable IBCNT will contain the DOS error code 6, "Invalid handle." The remedy is to be sure that IBFIND has been called and that it returned successfully. Also note that following a call to IBONL with a second argument of 0, which places bd "offline," an IBFIND is required before any subsequent calls with that device or board.
EDVR is also returned when the handler (GPIB.COM) is not installed. The remedy is to check the CONFIG.SYS file in the root directory and make sure it contains the line:
DEVICE=GPIB.COM
ECIC (1) ECIC is returned when one of the following board level
calls is made while the board is not CIC of the GPIB:
IBCMD,
IBRPP,
IBCAC, and
IBGTS.
In cases when the GPIB-PC should always be the CIC, the remedy is to be sure to call IBSIC to send Interface Clear before attempting any of these calls, and to avoid sending the command byte TCT (hex 09, Take Control). In multiple CIC situations, the remedy is to always be certain that the CIC bit appears in the status word IBSTA before attempting these calls. If it is not, it is possible to perform an IBWAIT (CIC) call to delay further processing until control is passed to the board.
ENOL (2) ENOL usually occurs when a write operation was attempted
with no listeners addressed. For a device write, this error indicates that the GPIB address configured for that device in the handler does not match the GPIB address of any device connected to the bus. This situation may be corrected by either attaching the appropriate device to the GPIB, by modifying the address of an already attached device, by altering the switches on the device, by calling IBPAD (and IBSAD if necessary) to make the configured address match the device switch settings, or by using the IBCONF configuration utility to reassign the proper GPIB
©National Instruments Corp. 4-7 GPIB-PC User Manual
GPIB-PC Functions — Overview Section Four
address to the device in the handler. For a board write, an IBCMD call is generally necessary to
address devices before an IBWRT. Be sure that the proper listen address is in the IBCMD argument string and that no Unlisten (hex 3F) command follows it.
ENOL may occur in situations in which the GPIB-PC is not the CIC and the Controller asserts ATN before the write call in progress has ended. The remedy is either to reduce the write byte count to that which is expected by the Controller, or to resolve the situation on the Controller's end.
EADR (3) EADR occurs when the GPIB-PC is CIC and is not
addressing itself before read and write calls are made. This error is extremely unlikely to occur on a device call. For a board call the remedy is to be sure to send the appropriate Talk or Listen address using IBCMD before attempting the IBWRT or IBRD.
EADR is also returned by the function IBGTS when the shadow-handshake feature is requested and the GPIB ATN line is already unasserted. In this case, the shadow handshake is not possible and the error is returned to notify you of that fact. IBGTS should almost never be called except immediately after an IBCMD call. (IBCMD causes ATN to be asserted.)
EARG (4) EARG results when an invalid argument is passed to a
function call. The following are some examples:
IBTMO called with a value not in the range 0-17. IBEOS called with meaningless bits set in the high byte of
the second parameter.
IBPAD or IBSAD called with illegal addresses. IBPPC called with illegal parallel poll configurations.
A board-only call made with a valid device descriptor, or a device-only call made with a valid board descriptor.
(NOTE: EDVR is returned if the descriptor is invalid.)
ESAC (5) ESAC results when IBSIC or IBSRE is called when the
GPIB-PC User Manual 4-8 ©National Instruments Corp.
Section Four GPIB-PC Functions — Overview
GPIB-PC does not have System Controller capability. The remedy is to give the GPIB-PC that capability by calling IBRSC or by using IBCONF to configure that capability into the handler.
EABO (6) EABO indicates that I/O has been canceled, usually due to
a timeout condition. Other causes are IBSTOP being called or the Device Clear message being received from the CIC.
To remedy a timeout error, if I/O is actually progressing but times out anyway, lengthen the timeout period with IBTMO. More frequently, however, the I/O is stuck (the Listener is not continuing to handshake or the Talker has stopped talking), or the byte count in the call which timed out was more than the other device was expecting. Be sure that both parties to the transfer understand what byte count is expected; or if possible, have the Talker use the END message to assist in early termination.
ENEB (7) ENEB occurs when there is no GPIB-PC at the I/O address
specified in the configuration program. This happens when the board is not physically plugged into the system, when the I/O address specified during configuration does not match the actual board setting, or when there is a conflict in the system with the BASE I/O address. If there is a mismatch between the actual board setting and the value specified at configuration time, either reconfigure the software or change the board switches to match the configured value.
EOIP (10) EOIP occurs when asynchronous I/O has not completed
before some other call was made. During asynchronous I/O, until the CMPL bit is set in IBSTA, only IBSTOP and IBWAIT calls are allowed. EOIP is returned when any other call is attempted before the I/O completes. The remedy is to use IBWAIT to wait for the CMPL status and then attempt the other call.
ECAP (11) ECAP results when a particular capability has been
disabled in the handler, and a call is made which attempts to make use of that capability. For example, if you use
IBCONF to disable DMA for a board, and then try to call IBDMA to turn DMA back on, you will get this error. The
remedy is not to deny capabilities which may be needed later, and to avoid making calls which attempt to alter or make use of capabilities that are unalterable at runtime.
©National Instruments Corp. 4-9 GPIB-PC User Manual
GPIB-PC Functions — Overview Section Four
EFSO (12) EFSO results when an IBRDF or IBWRTF call encounters a
problem performing a file operation. Specifically, this error indicates the function was unable to open, create, seek, write, or close the file being accessed. The specific DOS error code for this condition is contained in IBCNT.
EBUS (14) EBUS results when certain GPIB bus errors occur during
device-level calls. It is necessary in all device calls for the handler to send command bytes to perform addressing, serial polls, and to send other bus management information. Devices are expected to accept these command bytes within the time limit specified by the configuration program or by IBTMO. EBUS occurs if a timeout occurred during the sending of these command bytes. Under normal operating circumstances, the remedy would be to find out which GPIB device is accepting commands abnormally slowly and fix the problem with that device. In situations in which slow handshaking of the commands is desirable, lengthen the time limit either with the configuration program or the IBTMO function.
ESTB (15) ESTB occurs only during the IBRSP call. This indicates
that one or more serial poll status bytes which were received due to automatic serial polls have been discarded for lack of room to store them. Several older status bytes are available; however, the oldest is being returned by the IBRSP call. If an occasional lost status byte is not important in your application, you may consider this error code informative only and ignore it. If your application cannot tolerate missing even one status byte, the remedy is to disable Automatic Serial Polling using IBCONF.
ESRQ (16) ESRQ occurs only during the IBWAIT call. This indicates
that a wait for RQS is not possible because the GPIB SRQ line is stuck on. The usual reason for this situation is that some device that the handler is unaware of is asserting SRQ. Since the handler does not know of this device, it will never be serially polled and SRQ will never go away. Another reason for the situation would be that a GPIB bus tester or similar equipment was forcing the SRQ line to be asserted, or that there is a cable problem involving the SRQ line. Although the occurrence of ESRQ signals a definite GPIB problem, it will affect no GPIB operations whatever except that the RQS bit cannot be depended on while the condition lasts.
GPIB-PC User Manual 4-10 ©National Instruments Corp.
Section Four GPIB-PC Functions — Overview

Count Variable

The IBCNT variable is updated after each read, write, or command function call with the number of bytes actually transferred by the operation.

Read and Write Termination

The IEEE-488 specification defines two methods of identifying the last byte of device-dependent (data) messages. The two methods permit a Talker to send data messages of any length without the Listener(s) knowing in advance the number of bytes in the transmission. The two methods are as follows:
END message. In this method, the Talker asserts the EOI (End
Or Identify) signal simultaneously with transmission of the last data byte. By design, the Listener stops reading when it detects a data message accompanied by EOI, regardless of the value of the byte.
End-of-string (EOS) character. In this method, the Talker uses
a special character at the end of its data string. By prior arrangement, the Listener stops receiving data when it detects that character. Either a 7-bit ASCII character or a full 8-bit binary byte may be used.
The methods can be used individually or in combination. However, it is important that the Listener be properly configured to unambiguously detect the end of a transmission.
The GPIB-PC always terminates IBRD operations on the END message. Using the configuration program, you can accommodate all permissible forms of read and write termination. The default configuration settings for read and write termination can be changed at run time using the IBEOS and IBEOT functions, if necessary.
©National Instruments Corp. 4-11 GPIB-PC User Manual
GPIB-PC Functions — Overview Section Four

Device Function Calls

Device functions are those functions in which the unit descriptor identifies a device rather than an interface board. There are some activities common to all device functions that should be understood thoroughly.
In a single board configuration in which there is only one GPIB-PC in use, when the first device function of the program is executed, the GPIB is initialized by its controlling access board with the Interface Clear (IFC) command. The Remote Enable (REN) line on that GPIB is also asserted. If selected in the configuration program, the Local Lockout (LLO) command is also sent to all devices on the GPIB to place them in a lockout state. Furthermore, the device may be addressed to listen and then unaddressed before certain functions are executed. This is to ensure that the device is in remote program mode.
In a multiboard configuration in which there is more than one GPIB-PC, the process is the same as previously described, with the exception that each GPIB is initialized by its access board when the first device on that GPIB is accessed by a device function call.
The previous descriptions assume that the GPIB-PC is the System Controller of its GPIB, which is the usual configuration. If the GPIB-PC is not the System Controller, it must be passed CIC authority from the System Controller to execute device functions. If the access board is not CIC when a device function is called, the board requests service from the current CIC by asserting the Service Request (SRQ) line and passing the status response byte hex 41 when serially polled by the CIC. The handler then waits indefinitely for control to be passed to the access board. The computer system hangs if there is not another CIC that will pass control. This might happen, for example, if the access board is supposed to be System Controller, but it was not configured as such during software installation.
In Revision D software, if the access board is not CIC when the device call is made, the ECIC error is returned.
Also in Revision D software, because of multitasking, board-level reconfiguration functions must not be called during device-level calls.
GPIB-PC User Manual 4-12 ©National Instruments Corp.
Section Four GPIB-PC Functions — Overview

Automatic Serial Polling

If this feature is enabled, the handler automatically conducts serial polls when SRQ is asserted. The handler polls all active devices and stores each positive response, i.e., those responses that have the Request Service (RQS) or hex 40 bit set in the device status byte, in a queue associated with each device. 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 undetected.
If the handler cannot locate the device requesting service (no known device responds positively to the poll), or if SRQ becomes stuck on (due to a faulty instrument or cable), then a GPIB system error exists which will interfere with the proper evaluation of the RQS bit in the device's status words. The error (ESRQ) will be reported to you if and when you issue an IBWAIT call with the RQS bit included in the wait mask. Should the error condition clear itself up, you will notice this by calling IBWAIT with the RQS bit set in the mask, where the ESRQ error will not be reported. Aside from the difficulty caused by this error in waiting for RQS, the error will have no detrimental effects on other GPIB operations.
If the serial poll function IBRSP is called and one or more responses have been received previously via the automatic serial poll feature, then the first queued response is returned by the IBRSP function in FIFO (first in-first out) fashion. If the RQS bit of the status word is not set when IBRSP is called, the function conducts a serial poll and returns whatever response is received.
If your application requires that requests for service be noticed, you should examine the RQS bit in the status word and call the IBRSP function to examine the status byte whenever it appears. It is possible for a device's serial poll response queue to get clogged with old status bytes when you neglect to call IBRSP to empty the queue. This error condition (ESTB) is returned only by IBRSP when it becomes necessary to report that status bytes have been discarded due to a full queue. If your application has no interest in SRQ or status bytes, you may ignore the occurrence of the automatic polls. The polls occur rarely, and the error conditions described will not occur unless you use the feature.
©National Instruments Corp. 4-13 GPIB-PC User Manual
GPIB-PC Functions — Overview Section Four
If the handler is configured with automatic serial polling enabled, this feature will be disabled after a board-level I/O function call, and resumed after a device-level I/O function call. However, if any device­level I/O call results in a timeout error, this feature will be disabled until the next I/O call completes.
NOTE: If the RQS bit of the device status word is still set after IBRSP is called, the response byte queue has at least one more response byte remaining. IBRSP should be called until RQS is cleared to gather all stored response bytes and to guard against queue overflow.
GPIB-PC User Manual 4-14 ©National Instruments Corp.
Section Four A ­BASICA/QuickBASIC GPIB-PC Function Calls
This section contains information for programming the GPIB-PC in BASICA and QuickBASIC, Versions 4.0 and earlier. The term BASICA, as used in this section, refers to Advanced IBM Interpretive BASIC for the IBM Personal Computer. The term QuickBASIC refers to Microsoft QuickBASIC.
The programming information in this supplement can be used with all versions of BASICA and QuickBASIC unless specified otherwise. When different programming information is required that is specific to a particular version, this information is separated and identified by a frame with the respective version number in the upper left corner. An example of this appears as follows:
If information is required that is specific to two versions, this information is separated and identified by a frame with the two version numbers in the upper left corner. An example of this appears as follows:
©National Instruments Corp. 4A-1 GPIB-PC User Manual
BASICA/QuickBASIC GPIB-PC Function Calls Section Four A
If information is required that is specific to three versions, this information is separated and identified by a frame with the three version numbers in the upper left corner. An example of this appears as follows:
Information that is not located in a frame can be used to program the GPIB-PC in all versions of BASICA and QuickBASIC (that is, Version
4.0 and earlier).

BASICA Files

The GPIB-PC distribution diskette contains four files relevant to programming in BASICA:
DECL.BAS - A file containing required initialization code.
BIB.M - The BASICA language interface which gives your
application program access to the handler.
DBSAMP.BAS - A sample program using device calls.
BBSAMP.BAS - A sample program using board calls.

QuickBASIC Files

The GPIB-PC distribution diskette contains four files relevant to programming in QuickBASIC. These files were copied to a subdirectory called GPIB-PC when you ran the installation program IBSTART.BAT.
QBDECL.BAS - A file containing required initialization code.
QBIB1.OBJ - Version 1.0 language interface.
GPIB-PC User Manual 4A-2 ©National Instruments Corp.
Section Four A BASICA/QuickBASIC GPIB-PC Function Calls
QBIB2.OBJ - Version 2.0 and 3.0 without coprocessor.
QBIB_87.OBJ - Version 3.0 with coprocessor.
QBIB_87E.OBJ - Version 3.0 coprocessor emulator mode.
QBIB4.OBJ - Version 4.0 language interface..
QBDECL4.BAS - Version 4.0 required initialization code..
The appropriate language interface depends on the version of QuickBASIC used:
DQBSAMP.BAS - A sample program using device calls.
BQBSAMP.BAS - A sample program using board calls.

Programming Preparations for BASICA

A BASICA language code block must be executed before the main body of your application program.
Place the file DECL.BAS, which contains this code block, at the beginning of the application program, with appropriate adjustments to line numbers. Refer to the BASICA MERGE command. DECL.BAS contains code which loads the file BIB.M into memory. The file BIB.M contains the BASICA language interface to the GPIB-PC handler, and must exist in the directory currently in use.
©National Instruments Corp. 4A-3 GPIB-PC User Manual
BASICA/QuickBASIC GPIB-PC Function Calls Section Four A
You may change function and variable names defined in the code block if they conflict with names the application program is using. The substitution must be done consistently and carefully throughout. Instructions provided in this section assume that no name substitution is necessary and that the recommended names are used.
The GPIB status, error, and count information is returned in the variables IBSTA%, IBERR%, and IBCNT% as described at the beginning of Section Four.
In accordance with BASICA language protocol, all function arguments are variables, either integer or string, and their values must be assigned before the function call is made.
The CLEAR statement in line 1 of DECL.BAS contains a constant which is used to determine the memory requirements of the BASICA language interface. For the great majority of users this constant is correct. The constant may be incorrect, however, if you are using a system with an extremely small amount of memory. If after BASICA is invoked it reports that there are fewer than 60000 bytes free, you may need to adjust the constant to a smaller value.

Programming Preparations for QuickBASIC

Include the following QuickBASIC statement at the beginning of your application program:
COMMON SHARED IBSTA%, IBERR%, IBCNT%
This statement is included in the file QBDECL.BAS on the distribution diskette.
The GPIB status, error, and count information is returned in the variables IBSTA%, IBERR%, and IBCNT% as described at the beginning of Section Four.
The file QBIB*.OBJ contains the QuickBASIC language interface to the GPIB-PC handler. Link compiled GPIB application programs written in QuickBASIC with QBIB*.OBJ to produce an executable file permitting access to the handler.
In accordance with QuickBASIC language protocol, all function arguments are variables, either integer or string, and their values must be assigned before the function call is made.
GPIB-PC User Manual 4A-4 ©National Instruments Corp.
Section Four A BASICA/QuickBASIC GPIB-PC Function Calls
To run your program from within the QuickBASIC editor use the QuickBASIC BUILDLIB command to add QBIB*.OBJ to your user library, and load that library when loading QuickBASIC. For example, if you are already using a library called USERLIB.EXE, add
QBIB2.OBJ to it by entering:
BUILDLIB USERLIB.OBJ QBIB2.OBJ;
Then to run QuickBASIC enter:
QB /L USERLIB.EXE
To run your program from within the QuickBASIC interactive environment, use the LINK command to create a QuickLibrary. For example, to create a QuickLibrary called QBIB4.QLB, enter:
LINK /Q QBIB4.OBJ,,,BQLB40.LIB;
Then to run QuickBASIC enter:
QB /L QBIB4.QLB
To run your program from MS DOS, follow the instructions in the QuickBASIC User's Manual which pertain to compiling and linking programs. Use the file QBIB4.OBJ for linking purposes.

BASICA/QuickBASIC GPIB-PC I/O Functions

The most commonly needed I/O functions are IBRD and IBWRT. In BASICA, these functions read and write from a character string that may be up to 255 bytes long.
In addition, integer I/O functions (IBRDI and IBWRTI) are provided for users whose data strings are longer than 255 bytes, or who need to
©National Instruments Corp. 4A-5 GPIB-PC User Manual
BASICA/QuickBASIC GPIB-PC Function Calls Section Four A
perform arithmetic operations on the data and want to avoid the overhead of converting the character bytes of IBRD and IBWRT into integer format and back again.
IBRDI and IBWRTI are passed data in the form of an integer array, instead of a character string whose maximum length is limited to 255 bytes. Using these functions, you may store more than 255 bytes in a single buffer and do not have to convert each pair of data bytes to an integer before doing arithmetic operations on the data. Internally, the IBWRTI function sends each integer to the GPIB in low-byte, high-byte order. The IBRDI function reads a series of data bytes from the GPIB and stores them into the integer array in low-byte, high-byte order.
In addition to IBRDI and IBWRTI, the asynchronous functions IBRDIA and IBWRTIA are provided to perform asynchronous integer reads and writes.
The functions are listed alphabetically by function name in this section. Table 4A.1 provides a summary of the BASICA GPIB-PC functions and Table 4A.2 provides a summary of the QuickBASIC GPIB-PC functions.

BASICA/QuickBASIC "ON SRQ" Capability

BASICA programs may be interrupted on the occurrence of the GPIB SRQ signal. When the interrupt occurs, a branch can be taken to a service routine which determines the cause of the SRQ and takes the appropriate action.
National Instruments uses this statement to intercept SRQ interrupt and make them available to user programs. For more complete information regarding the operation of "ON PEN", refer to the IBM BASICA User's Manual and Microsoft QuickBASIC under the "ON PEN Statement." All the information in that section applies to both the light pen and to the GPIB SRQ signal.
Statements such as "ON PEN" which intercept interrupts are a special feature of some versions of BASIC, including BASICA and QuickBASIC. These statements, however, are not usually a feature of non-BASIC languages and are not necessarily supported in other National Instruments language interfaces. To determine if this feature is supported in languages other than BASICA and QuickBASIC, refer to the manual supplement that comes with that language.
GPIB-PC User Manual 4A-6 ©National Instruments Corp.
Section Four A BASICA/QuickBASIC GPIB-PC Function Calls

Table 4A.1 - BASICA GPIB-PC Functions

Description CALL Function Syntax
Change access board of device IBBNA (BD%,BNAME$) Become Active Controller IBCAC (BD%,V%) Clear specified device IBCLR (BD%) Send commands from string IBCMD (BD%,CMD$) Send commands asynchronously from
string IBCMDA (BD%,CMD$) Enable/disable DMA IBDMA (BD%,V%) Change/disable EOS mode IBEOS (BD%,V%) Enable/disable END message IBEOT (BD%,V%) Open device and return unit descriptor IBFIND (BDNAME$,BD%) Go from Active Controller to standby IBGTS (BD%,V%) Set/clear ist IBIST (BD%,V%) Go to local IBLOC (BD%) Place device online/offline IBONL (BD%,V%) Change primary address IBPAD (BD%,V%) Pass control IBPCT (BD%) Parallel poll configure IBPPC (BD%,V%) Read data to string IBRD (BD%,RD$) Read data asynchronously to string IBRDA (BD%,RD$) Read data to file IBRDF (BD%,FLNAME$) Read data to integer array IBRDI
(BD%,IARR%(0),CNT%)
Read data asynch to integer array IBRDIA
(BD%,IARR%(0),CNT%)
Conduct a parallel poll IBRPP (BD%,PPR%) Request/release system control IBRSC (BD%,V%) Return serial poll byte IBRSP (BD%,SPR%) Request service IBRSV (BD%,V%) Change secondary address IBSAD (BD%,V%) Send interface clear IBSIC (BD%) Set/clear remote enable line IBSRE (BD%,V%) Abort asynchronous operation IBSTOP (BD%) Change/disable time limit IBTMO (BD%,V%) Configure applications monitor IBTRAP (MASK%,V%) Trigger selected device IBTRG (BD%)
(continues)
©National Instruments Corp. 4A-7 GPIB-PC User Manual
BASICA/QuickBASIC GPIB-PC Function Calls Section Four A
Table 4A.1 - BASICA GPIB-PC Functions (continued)
Description CALL Function Syntax
Wait for selected event IBWAIT (BD%,MASK%) Write data from string IBWRT (BD%,WRT$) Write data asynchronously from string IBWRTA (BD%,WRT$) Write data from file IBWRTF (BD%,FLNAME$) Write data from integer array IBWRTI
(BD%,IARR%(0),CNT%)
Write data asynch from integer array IBWRTIA
(BD%,IARR%(0),CNT%)
The first argument of all function calls except IBFIND is the integer variable BD%, which serves as a unit descriptor. Refer to the IBFIND function description and Section Three for additional information on the use of this unit descriptor.
Table 4A.2 contains a complete list of the QuickBASIC GPIB calls, their parameters, and a short description of each.

Table 4A.2 - QuickBASIC GPIB-PC Calls

Description CALL Function Syntax
Change access board of device IBBNA (BD%,BNAME$) Become Active Controller IBCAC (BD%,V%) Clear specified device IBCLR (BD%) Send commands from string IBCMD (BD%,CMD$) Send commands asynchronously from
string IBCMDA (BD%,CMD$) Enable/disable DMA IBDMA (BD%,V%) Change/disable EOS mode IBEOS (BD%,V%) Enable/disable END message IBEOT (BD%,V%) Open device and return unit descriptor IBFIND (BDNAME$,BD%) Go from Active Controller to standby IBGTS (BD%,V%) Set/clear ist IBIST (BD%,V%) Go to local IBLOC (BD%) Place device online/offline IBONL (BD%,V%) Change primary address IBPAD (BD%,V%)
(continues)
GPIB-PC User Manual 4A-8 ©National Instruments Corp.
Section Four A BASICA/QuickBASIC GPIB-PC Function Calls
Table 4A.2 - QuickBASIC GPIB-PC Calls (cont.)
Description CALL Function Syntax
Pass control IBPCT (BD%) Parallel poll configure IBPPC (BD%,V%) Read data to string IBRD (BD%,RD$) Read data asynchronously to string IBRDA (BD%,RD$) Read data to file IBRDF (BD%,FLNAME$) Read data to integer array IBRDI (BD%,VARPTR
(IARR%(0)),CNT%)
Read data asynch to integer array IBRDIA (BD%,VARPTR
(IARR%(0)),CNT%
Conduct a parallel poll IBRPP (BD%,PPR%) Request/release system control IBRSC (BD%,V%) Return serial poll byte IBRSP (BD%,SPR%) Request service IBRSV (BD%,V%) Change secondary address IBSAD (BD%,V%) Send interface clear IBSIC (BD%) Set/clear remote enable line IBSRE (BD%,V%) Abort asynchronous operation IBSTOP (BD%) Change/disable time limit IBTMO (BD%,V%) Configure applications monitor IBTRAP (MASK%,V%) Trigger selected device IBTRG (BD%) Wait for selected event IBWAIT (BD%,MASK%) Write data from string IBWRT (BD%,WRT$) Write data asynchronously from string IBWRTA (BD%,WRT$) Write data from file IBWRTF (BD%,FLNAME$) Write data from integer array IBWRTI (BD%,VARPTR
(IARR%(0)),CNT%
Write data asynch from integer array IBWRTIA (BD%,VARPTR
(IARR%(0)),CNT%
©National Instruments Corp. 4A-9 GPIB-PC User Manual
BASICA/QuickBASIC GPIB-PC Function Calls Section Four A

Table 4A.3 - QuickBASIC GPIB-PC Calls

Description CALL Function Syntax
Change access board of device IBBNA (BD%,BNAME$) Become Active Controller IBCAC (BD%,V%) Clear specified device IBCLR (BD%) Send commands from string IBCMD (BD%,CMD$) Send commands asynchronously from
string IBCMDA (BD%,CMD$) Enable/disable DMA IBDMA (BD%,V%) Change/disable EOS mode IBEOS (BD%,V%) Enable/disable END message IBEOT (BD%,V%) Open device and return unit descriptor IBFIND (BDNAME$,BD%) Go from Active Controller to Standby IBGTS (BD%,V%) Set/clear ist IBIST (BD%,V%) Go to local IBLOC (BD%) Place device online/offline IBONL (BD%,V%) Change primary address IBPAD (BD%,V%) Pass control IBPCT (BD%) Parallel poll configure IBPPC (BD%,V%) Read data to string IBRD (BD%,RD$) Read data asynchronously to string IBRDA (BD%,RD$) Read data to file IBRDF (BD%,FLNAME$) Read data to integer array IBRDI
(BD%,IARR%(),CNT%)
Read data asynch to integer array IBRDIA
(BD%,IARR%(),CNT%
Conduct a parallel poll IBRPP (BD%,PPR%) Request/release system control IBRSC (BD%,V%) Return serial poll byte IBRSP (BD%,SPR%) Request service IBRSV (BD%,V%) Change secondary address IBSAD (BD%,V%) Send interface clear IBSIC (BD%) Set/clear remote enable line IBSRE (BD%,V%) Abort asynchronous operation IBSTOP (BD%)
(continues)
GPIB-PC User Manual 4A-10 ©National Instruments Corp.
Section Four A BASICA/QuickBASIC GPIB-PC Function Calls
Table 4A.3 - QuickBASIC GPIB-PC Calls (continued)
Description CALL Function Syntax
Change/disable time limit IBTMO (BD%,V%) Configure applications monitor IBTRAP (MASK%,V%) Trigger selected device IBTRG (BD%) Wait for selected event IBWAIT (BD%,MASK%) Write data from string IBWRT (BD%,WRT$) Write data asynchronously from string IBWRTA (BD%,WRT$) Write data from file IBWRTF (BD%,FLNAME$) Write data from integer array IBWRTI
(BD%,IARR%(),CNT%
Write data asynch from integer array IBWRTIA
(BD%,IARR%(),CNT%
©National Instruments Corp. 4A-11 GPIB-PC User Manual
BASICA/QuickBASIC GPIB-PC Function Calls Section Four A

New GPIB-PC Functions

Since QuickBASIC Version 4.0 now supports true functions, the language interface has been expanded to include function versions of the existing GPIB calls. Here are some important points to be aware of:
All existing subroutines are still available via the CALL
statement, and existing applications do not require any changes.
The names of the new functions are identical to the existing
subroutines, except that the second letter of each name has been changed from B to L. For example, the subroutine IBSIC is now also available as the function ILSIC.
GPIB subroutine and function calls may be freely mixed
throughout a program.
The include file QBDECL4.BAS contains a complete list of
both subroutine and function declarations, complete with parameter list specifications to aid in type checking at compile time. You must include this file in all application programs using GPIB calls.
In general, the functions behave identically to the subroutines
with the few exceptions noted in the following paragraph. The description of each subroutine found in the GPIB-PC User Manual can be applied to the new functions, except for the syntax-specific information.
GPIB-PC User Manual 4A-12 ©National Instruments Corp.
Section Four A BASICA/QuickBASIC GPIB-PC Function Calls
There are a few differences between the existing subroutines and the new functions:
ILFIND returns a descriptor associated with the specified device.
Use this value in all subsequent functions calls that access that device. Normal usage would resemble the following:
BD% = ILFIND ("GPIB0")
ILCMD, ILCMDA, ILRD, ILRDA, and ILWRTA require a third
parameter which specifies the number of bytes to transfer. The function syntax is as follows:
ILCMD (BD%, CMD$, CNT%) ILCMDA (BD%, CMD$, CNT%) ILRD (BD%, RD$, CNT%) ILRDA (BD%, RD$, CNT%) ILWRT (BD%, WRT$, CNT%) ILWRTA (BD%, WRT$, CNT%)
All functions except ILFIND return the value of IBSTA. This
permits the following construct:
IF IBRD (BD%, RD%, CNT%) < 0 THEN CALL GPIBERROR
Table 4A.4 contains a complete list of the new QuickBASIC GPIB functions, their parameters, and a short description of each.
©National Instruments Corp. 4A-13 GPIB-PC User Manual
BASICA/QuickBASIC GPIB-PC Function Calls Section Four A

Table 4A.4 - QuickBASIC Version 4.0 GPIB-PC Functions

Description Function Syntax
Change access board of device ILBNA (BD%,BNAME$) Become Active Controller ILCAC (BD%,V%) Clear specified device ILCLR (BD%) Send commands from string ILCMD (BD%,CMD$,CNT%) Send commands asynchronously from
string ILCMDA (BD%,CMD$,CNT%) Enable/disable DMA ILDMA (BD%,V%) Change/disable EOS mode ILEOS (BD%,V%) Enable/disable END message ILEOT (BD%,V%) Open device and return unit descriptor ILFIND (BDNAME$,BD%) Go from Active Controller to standby ILGTS (BD%,V%) Set/clear ist ILIST (BD%,V%) Go to local ILLOC (BD%) Place device online/offline ILONL (BD%,V%) Change primary address ILPAD (BD%,V%) Pass control ILPCT (BD%) Parallel poll configure ILPPC (BD%,V%) Read data to string ILRD (BD%,RD$,CNT%) Read data asynchronously to string ILRDA (BD%,RD$,CNT%) Read data to file ILRDF (BD%,FLNAME$) Read data to integer array ILRDI
(BD%,IARR%(),CNT%)
Read data asynch to integer array ILRDIA
(BD%,IARR%(),CNT%)
Conduct a parallel poll ILRPP (BD%,PPR%) Request/release system control ILRSC (BD%,V%) Return serial poll byte ILRSP (BD%,SPR%) Request service ILRSV (BD%,V%) Change secondary address ILSAD (BD%,V%) Send interface clear ILSIC (BD%) Set/clear remote enable line ILSRE (BD%,V%) Abort asynchronous operation ILSTOP (BD%) Change/disable time limit ILTMO (BD%,V%) Trigger selected device ILTRG (BD%)
(continues)
GPIB-PC User Manual 4A-14 ©National Instruments Corp.
Section Four A BASICA/QuickBASIC GPIB-PC Function Calls
Table 4A.4 - QuickBASIC Version 4.0 GPIB-PC Functions
(continued)
Description Function Syntax
Configure applications monitor ILTRAP (MASK%,V%) Wait for selected event ILWAIT (BD%,MASK%) Write data from string ILWRT (BD%,WRT$,CNT%) Write data asynchronously from string ILWRTA (BD%,WRT$,CNT%) Write data from file ILWRTF (BD%,FLNAME$) Write data from integer array ILWRTI
(BD%,IARR%(),CNT%)
Write data asynch from integer array ILWRTIA
(BD%,IARR%(),CNT%)

GPIB-PC Function Descriptions

The remainder of this section provides a detailed description of each GPIB-PC function.
©National Instruments Corp. 4A-15 GPIB-PC User Manual
BASICA/QuickBASIC GPIB-PC Function Calls Section Four A
BASICA/QuickBASIC BASICA/QuickBASIC IBBNA IBBNA
Purpose: Change access board of device Format: CALL IBBNA (BD%,BNAME$) Remarks: BD% specifies a device. BNAME$ specifies the new access

board to be used in all device calls to that device. IBBNA is needed only to alter the board assignment from its configuration setting.

The IBBNA function identifies the board that will be used in subsequent device functions to access the specified device. IBBNA permits you to alter the association of devices and interface boards from the settings originally configured with the configuration program.
The assignment made by this function remains in effect until IBBNA is called again, the IBONL or IBFIND function is called, or the system is rebooted. The original configuration established with the configuration program is not permanently changed.
Refer also to Table 2.1.
Device Example:
1. Associate the device DVM% with the interface board "GPIB0".
100 REM DVM is a name assigned using 110 REM IBCONF. 120 REM (GPIB0 is a factory default board 130 REM name which cannot be changed). 140 BDNAME$ = "DVM" 150 CALL IBFIND (BDNAME$,DVM%) 160 REM This call to IBBNA establishes 170 REM GPIB0 as the access board for the 180 REM device DVM%. 190 BNAME$ = "GPIB0" 200 CALL IBBNA (DVM%,BNAME$)
GPIB-PC User Manual 4A-16 ©National Instruments Corp.
Section Four A BASICA/QuickBASIC GPIB-PC Function Calls

BASICA/QuickBASIC BASICA/QuickBASIC IBCAC IBCAC

Purpose: Become Active Controller Format: CALL IBCAC (BD%,V%) Remarks: BD% specifies an interface board. If V% is non-zero, the
GPIB-PC takes control synchronously with respect to data transfer operations; otherwise, the GPIB-PC takes control immediately (and possibly asynchronously).
To take control synchronously, the GPIB-PC asserts the ATN signal in such a way as to ensure that data being transferred on the GPIB is not corrupted. If a data handshake is in progress, the take control action is postponed until the handshake is complete; if a handshake is not in progress, the take control action is done immediately. Synchronous take control is not guaranteed if an IBRD or IBWRT operation completed with a timeout or error.
Asynchronous take control should be used in situations where it appears to be impossible to gain control synchronously (e.g., after a timeout error).
It is generally not necessary to use the IBCAC function in most applications. Functions such as IBCMD and IBRPP, which require that the GPIB-PC take control, do so automatically.
The ECIC error results if the GPIB-PC is not CIC.
Board Examples:
1. Take control immediately without regard to any data handshake
in progress.
100 V% = 0 110 CALL IBCAC (BRD0%,V%) 120 REM IBSTA% should show that the 130 REM interface board is now CAC, i.e., 140 REM CIC with ATN asserted.
©National Instruments Corp. 4A-17 GPIB-PC User Manual
BASICA/QuickBASIC GPIB-PC Function Calls Section Four A
2. Take control synchronously and assert ATN following a read
operation.
100 CALL IBRD (BRD0%,RD$) 110 V% = 1 120 CALL IBCAC (BRD0%,V%)
GPIB-PC User Manual 4A-18 ©National Instruments Corp.
Section Four A BASICA/QuickBASIC GPIB-PC Function Calls
BASICA/QuickBASIC BASICA/QuickBASIC IBCLR IBCLR
Purpose: Clear specified device Format: CALL IBCLR (BD%) Remarks: BD% specifies a device.

The IBCLR function clears the internal or device functions of a specified device. On exit, all devices are unaddressed.

IBCLR calls the board IBCMD function to send the following commands using the designated access board:
Listen address of the device;
Secondary address of the device, if applicable;
Selected Device Clear (SDC); and
Untalk (UNT) and Unlisten (UNL) Other command bytes may be sent as necessary. Refer to IBCMD for additional information. Refer also to
the discussion of device functions and the discussion clearing the device and clearing the GPIB in Section Three.
Device Example:
1. Clear the device VMTR%.
100 CALL IBCLR (VMTR%)
©National Instruments Corp. 4A-19 GPIB-PC User Manual
BASICA/QuickBASIC GPIB-PC Function Calls Section Four A
BASICA/QuickBASIC BASICA/QuickBASIC IBCMD IBCMD
Purpose: Send commands from string Format: CALL IBCMD (BD%,CMD$) Remarks: BD% specifies an interface board. CMD$ contains the

commands to be sent over the GPIB. The IBCMD function is used to transmit interface messages

(commands) over the GPIB. These commands, which are listed in Appendix A, include device talk and listen addresses, secondary addresses, serial and parallel poll configuration messages, and device clear and trigger instructions. The IBCMD function is also used to pass GPIB control to another device. This function is NOT used to transmit programming instructions to devices. Programming instructions and other device-dependent information are transmitted with the read and write functions.
The IBCMD operation terminates on any of the following events:
All commands are successfully transferred;
Error is detected;
Time limit is exceeded;
Take Control (TCT) command is sent; or
Interface Clear (IFC) message is received from the
System Controller (not the GPIB-PC).
After termination, the IBCNT% variable contains the number of commands sent. A short count can occur on any event but the first.
An ECIC error results if the GPIB-PC is not CIC. If it is not Active Controller, it takes control and asserts ATN prior to sending the command bytes. It remains Active Controller afterward.
GPIB-PC User Manual 4A-20 ©National Instruments Corp.
Section Four A BASICA/QuickBASIC GPIB-PC Function Calls
In the examples that follow, GPIB commands and addresses are coded as printable ASCII characters. When the values to be sent over the GPIB correspond to printable ASCII characters, this is the simplest means of specifying the values. Refer to Appendix A for conversions of numeric values to ASCII characters.
Board Examples:
1. Unaddress all Listeners with the Unlisten (UNL or ASCII ?) command and address a Talker at &H46 (ASCII F) and a Listener at &H31 (ASCII 1).
100 CMD$ = "?F1" ' UNL TAD1 LAD2 110 CALL IBCMD (BRD0%,CMD$)
2. Same as Example 1, except the Listener has a secondary address of &H6E (ASCII n).
100 CMD$ = "?F1n" ' UNL TAD1 LAD2 SAD2 110 CALL IBCMD (BRD0%,CMD$)
3. Clear all GPIB devices (i.e., reset internal functions) with the Device Clear (DCL or &H14) command.
100 CMD$ = CHR$ (&H14) ' DCL 110 CALL IBCMD (BRD0%,CMD$)
4. Clear two devices with listen addresses of &H21 (ASCII !) and &H28 (ASCII ( (left parenthesis)) with the Selected Device Clear (SDC or &H04) command.
100 CMD$ = "!(" + CHR$(&H04) ' LAD1 LAD2 SDC 110 CALL IBCMD (BRD0%,CMD$)
5. Trigger any devices previously addressed to listen with the Group Execute Trigger (GET or &H08) command.
100 CMD$ = CHR$(&H08) ' GET 110 CALL IBCMD (BRD0%,CMD$)
©National Instruments Corp. 4A-21 GPIB-PC User Manual
BASICA/QuickBASIC GPIB-PC Function Calls Section Four A
6. Unaddress all Listeners and serially poll a device at talk address &H52 (ASCII R) using the Serial Poll Enable (SPE or &H18) and Serial Poll Disable (SPD or &H19) commands (the GPIB-PC listen address is &H20 or ASCII space).
100 CMD$ ="?R " + CHR$(&H18)'UNL TAD MLA SPE 110 CALL IBCMD (BRD0%,CMD$) 120 RD$ = SPACE$(1) ' Declare RD buffer. 130 CALL IBRD (BRD0%,RD$) 140 REM After checking the status byte in 150 REM RD$, disable this device and 160 REM unaddress it with the Untalk. 160 REM (UNT or ASCII _) command before 170 REM polling the next one. 180 CMD$ = CHR$(&H19) + "_" ' SPD UNT 190 CALL IBCMD (BRD0%,CMD$)
GPIB-PC User Manual 4A-22 ©National Instruments Corp.
Section Four A BASICA/QuickBASIC GPIB-PC Function Calls
BASICA/QuickBASIC BASICA/QuickBASIC IBCMDA IBCMDA
Purpose: Send commands asynchronously from string Format: CALL IBCMDA (BD%,CMD$) Remarks: BD% specifies an interface board. CMD$ contains the

commands to be sent over the GPIB. The IBCMDA function is used to transmit interface

messages (commands) over the GPIB. These commands, which are listed in Appendix A, include device talk and listen addresses, secondary addresses, serial and parallel poll configuration messages, and device clear and trigger instructions. The IBCMDA function is also used to pass GPIB control to another device. This function is NOT used to transmit programming instructions to devices. Programming instructions and other device-dependent information are transmitted with the write and read functions.
IBCMDA is used in place of IBCMD when the application program must perform other functions while processing the GPIB I/O operation. IBCMDA returns after starting the I/O operation. If the number of bytes to send is small and the bytes are accepted quickly by the GPIB device(s), the operation may complete on the initial call. In this case, the CMPL bit will be set in IBSTA%. If the operation does not complete on the initial call, you should monitor the IBSTA% variable after subsequent calls (usually IBWAIT calls) to know that the I/O is completed. When CMPL becomes set in IBSTA%, indicating that the I/O is complete, the number of bytes sent is reported in the IBCNT% variable.
Between the issuing of the IBCMDA call and the corresponding CMPL, other GPIB function calls to this board will return the error EOIP, with the following exceptions:
IBSTOP - to cancel the asynchronous I/O;
IBWAIT - to monitor other GPIB conditions; and
©National Instruments Corp. 4A-23 GPIB-PC User Manual
BASICA/QuickBASIC GPIB-PC Function Calls Section Four A
IBONL - to cancel the I/O and reset the interface. The asynchronous I/O started by IBCMDA terminates for the
same reasons IBCMD terminates. An ECIC error results if the GPIB-PC is not CIC. If it is not
Active Controller, the GPIB-PC takes control and asserts ATN prior to sending the command bytes. It remains Active Controller afterward. The ENOL error does NOT occur if there are no Listeners.
Board Example:
1. Address several devices for a broadcast message to follow while testing for a high priority event to occur.
100 REM The interface board BRD0% at talk 110 REM address &H40 (ASCII @), addresses 120 REM nine Listeners at addresses &H31­130 REM &H39 (ASCII 1-9) to receive the 140 REM broadcast message. 150 CMD$ = "?@123456789" ' UNL MTA 160 ' LAD1...LAD9 170 CALL IBCMDA (BRD0%,CMD$) 180 MASK% = $4100 ' Wait for timeout or 190 ' I/O completion. 200 CALL EVENTTST ' Unspecified routine 210 ' to test and process 220 ' a high priority 230 ' event. 240 CALL IBWAIT (BRD0%,MASK%) 250 REM Loop until complete while no error 260 REM has occurred. 270 IF (IBSTA% AND &H100) = 0 GOTO 180
GPIB-PC User Manual 4A-24 ©National Instruments Corp.
Section Four A BASICA/QuickBASIC GPIB-PC Function Calls

BASICA/QuickBASIC BASICA/QuickBASIC IBDMA IBDMA

Purpose: Enable or disable DMA Format: CALL IBDMA (BD%,V%) Remarks: BD% specifies an interface board. If V% is non-zero, DMA
transfers between the GPIB-PC and memory are used for read and write operations. If V% is zero, programmed I/O is used in place of DMA I/O.
If you enabled DMA at configuration time, assigning DMA channel 1, 2, or 3, this function can be used to switch between programmed I/O and DMA using the selected channel. If you disabled DMA at configuration time, calling this function with V% equal to a non-zero value results in an ECAP error.
The assignment made by this function remains in effect until IBDMA is called again, the IBONL or IBFIND function is called, or the system is rebooted.
When IBDMA is called and an error does not occur, the previous value of V% is stored in IBERR%.
On machines without DMA capability, calling this function with V% = 0 has no effect, and calling it with a non-zero V% results in an ECAP error.
Refer also to Table 2.1.
Board Examples:
1. Enable DMA transfers using the previously configured channel.
100 V% = 1 ' Any non-zero value will do. 110 CALL IBDMA (BRD0%,V%)
2. Disable DMAs and use programmed I/O exclusively.
100 V% = 0 110 CALL IBDMA (BRD0%,V%)
©National Instruments Corp. 4A-25 GPIB-PC User Manual
Loading...