The reader should consult National Instruments if errors are suspected. In no event shall National Instruments be liable for any damages arising out of or related to this document or the information contained in it.
Page 4
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;...
Page 5
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...
Page 6
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...
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.
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.
Page 15
ATN and/or TIMO... C-3 DCAS and DTAS Status Bits ... C-3 Printer Support... C-3 Appendix D - Using your Printer with the GPIB-PC Installation... D-1 Appendix E - Application Notes Application Note 1 - Computer to Computer Data Transfer... E-1 Step 1.
Page 16
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...
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: •...
• 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.
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.
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:).
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: Increase the free space in your boot area and run IBSTART again.
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.
Installation and Configuration 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.
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. •...
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.
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...
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.
• 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 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...
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.
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.
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.
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.
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.
GPIB-PC Functions — Introduction 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: •...
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.
GPIB-PC Functions — Introduction 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.
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.
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: •...
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.
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.
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.
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.
GPIB-PC Functions — Introduction 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.
Section Three 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.
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.
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.
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.
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.
Page 64
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...
Page 65
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.
Page 66
Section Four 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).
IBCONF utility to recognize the name. GPIB-PC User Manual Explanation DOS error Function requires GPIB-PC to be CIC No Listener on write function GPIB-PC not addressed correctly Invalid argument to function call GPIB-PC not System Controller as required...
Page 68
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...
Page 69
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...
Page 70
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...
Page 71
GPIB-PC Functions — Overview 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.
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.
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.
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.
Page 75
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.
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.
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).
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.
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.
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.
Section Four A Table 4A.1 - BASICA GPIB-PC Functions Description Change access board of device Become Active Controller Clear specified device Send commands from string Send commands asynchronously from string Enable/disable DMA Change/disable EOS mode Enable/disable END message Open device and return unit descriptor IBFIND (BDNAME$,BD%)
BASICA/QuickBASIC GPIB-PC Function Calls Table 4A.1 - BASICA GPIB-PC Functions (continued) Description Wait for selected event Write data from string Write data asynchronously from string IBWRTA (BD%,WRT$) Write data from file Write data from integer array Write data asynch from integer array The first argument of all function calls except IBFIND is the integer variable BD%, which serves as a unit descriptor.
BASICA/QuickBASIC GPIB-PC Function Calls Table 4A.3 - QuickBASIC GPIB-PC Calls Description Change access board of device Become Active Controller Clear specified device Send commands from string Send commands asynchronously from string Enable/disable DMA Change/disable EOS mode Enable/disable END message Open device and return unit descriptor IBFIND (BDNAME$,BD%)
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.
BASICA/QuickBASIC GPIB-PC Function Calls Table 4A.4 - QuickBASIC Version 4.0 GPIB-PC Functions Description Change access board of device Become Active Controller Clear specified device Send commands from string Send commands asynchronously from string Enable/disable DMA Change/disable EOS mode Enable/disable END message...
Section Four A Table 4A.4 - QuickBASIC Version 4.0 GPIB-PC Functions Description Configure applications monitor Wait for selected event Write data from string Write data asynchronously from string ILWRTA (BD%,WRT$,CNT%) Write data from file Write data from integer array Write data asynch from integer array...
BASICA/QuickBASIC GPIB-PC Function Calls BASICA/QuickBASIC 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.
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: Take control immediately without regard to any data handshake in progress.
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.
Page 97
&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). CMD$ ="?R " + CHR$(&H18)'UNL TAD MLA SPE CALL IBCMD (BRD0%,CMD$)
Page 99
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.
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.
BASICA/QuickBASIC GPIB-PC Function Calls BASICA/QuickBASIC IBEOS Purpose: Change or disable end-of-string termination mode Format: CALL IBEOS (BD%,V%) Remarks: BD% specifies a device or an interface board. V% specifies the EOS character and the data transfer termination method according to Table 4A.5. IBEOS is needed only to alter the value from its configuration setting.
Page 103
BASICA/QuickBASIC GPIB-PC Function Calls Board Examples: Program the interface board BRD0% to terminate a read on detection of the linefeed character (&H0A) that is expected to be received within 200 bytes. EOSV% = &H0A V% = EOSV% + &H0400 CALL IBEOS (BRD0%,V%)
BASICA/QuickBASIC GPIB-PC Function Calls BASICA/QuickBASIC IBEOT Purpose: Enable or disable END termination message on write operations Format: CALL IBEOT (BD%,V%) Remarks: BD% specifies a device or an interface board. If V% is non- zero, the END message is sent automatically with the last byte of each write operation.
BASICA/QuickBASIC GPIB-PC Function Calls BASICA/QuickBASIC IBFIND Purpose: Open device and return the unit descriptor associated with the given name Format: CALL IBFIND (BDNAME$,BD%) Remarks: BDNAME$ is a string containing a default or configured device or board name. BD% is a variable containing the unit descriptor returned by IBFIND.
GPIB. If V% is zero, no shadow handshake or holdoff is done. The IBGTS function causes the GPIB-PC to go to the Controller Standby state and to unassert the ATN signal if it initially is the Active Controller. IBGTS permits GPIB devices to transfer data without the GPIB-PC being a party to the transfer.
GPIB data line either true or false, depending on the value of its local ist bit. The GPIB-PC, for example, can be assigned to drive the DIO3 data line true if ist=1 and false if ist=0;...
BASICA/QuickBASIC GPIB-PC Function Calls BASICA/QuickBASIC IBLOC Purpose: Go to Local Format: CALL IBLOC (BD%) Remarks: BD% specifies a device or an interface board. Unless the Remote Enable line has been unasserted with the IBSRE function, all device functions automatically place the specified device in remote program mode.
BASICA/QuickBASIC GPIB-PC Function Calls BASICA/QuickBASIC IBONL Purpose: Place the device or interface board online or offline Format: CALL IBONL (BD%,V%) Remarks: BD% specifies a device or an interface board. If V% is non- zero, the device or interface board is enabled for operation (i.e., online).
BASICA/QuickBASIC GPIB-PC Function Calls BASICA/QuickBASIC IBPAD Purpose: Change Primary Address Format: CALL IBPAD (BD%,V%) Remarks: BD% specifies a device or an interface board. V% specifies the primary GPIB address of the device or interface board. IBPAD is needed only to alter the value from its configuration setting.
BASICA/QuickBASIC GPIB-PC Function Calls BASICA/QuickBASIC IBPCT Purpose: Pass Control Format: CALL IBPCT (BD%) Remarks: BD% specifies a device. The IBPCT function passes CIC authority to the specified device from the access board assigned to that device. The board automatically goes to Controller Idle State (CIDS).
Page 121
BASICA/QuickBASIC GPIB-PC Function Calls Which PPE and PPD messages are sent and the meaning of a particular parallel poll response are all system dependent protocol matters to be determined by you. On exit, all devices are unaddressed. Board IBPPC Function:...
Page 123
BASICA/QuickBASIC GPIB-PC Function Calls If the access board is Active Controller, the board is first placed in Standby Controller state with ATN off and remains there after the read operation is completed. Otherwise, the read operation commences immediately. An EADR error results if the board is CIC but has not been addressed to listen with the IBCMD function.
Page 124
Section Four A Board Examples: Read 56 bytes of data from a device at talk address &H4C (ASCII L) and then unaddress it (the GPIB-PC listen address is &H20 or ASCII space). CMD$ = "? L" ' UNL MLA TAD...
Page 125
BASICA/QuickBASIC GPIB-PC Function Calls BASICA/QuickBASIC IBRDA Purpose: Read data asynchronously to string Format: CALL IBRDA (BD%,RD$) Remarks: BD% specifies a device or an interface board. RD$ identifies the storage buffer for data bytes that are read from the GPIB. The IBRDA function reads from 1 to 255 bytes of data from a GPIB device.
Page 127
BASICA/QuickBASIC GPIB-PC Function Calls Device Example: Read 56 bytes of data from the device TAPE% while performing other processing. RD$ = SPACE$(56) CALL IBRDA (TAPE%,RD$) MASK% = &H4100 CALL IBWAIT (TAPE%,MASK%) IF (IBSTA% AND &H100) = 0 GOTO 130 GPIB-PC User Manual Perform device read.
Page 128
Section Four A Board Examples: Read 56 bytes of data from a device at talk address &H4C (ASCII L) and then unaddress it (the GPIB-PC listen address is &H20 or ASCII space). CMD$ = "? L" CALL IBCMD (BRD0%,CMD$) RD$ = SPACE$(56) CALL IBRDA (BRD0%,RD$) MASK% = &H4100...
BASICA/QuickBASIC GPIB-PC Function Calls BASICA/QuickBASIC IBRDF Purpose: Read data from GPIB into file Format: CALL IBRDF (BD%,FLNAME$) Remarks: BD% specifies a device or an interface board. FLNAME$ is the filename under which the data is stored. FLNAME$ may be up to 50 characters long, including a drive and path designation.
Page 131
Read data from a device at talk address &H4C (ASCII L) to the file RDGS on the current disk drive and then unaddress it (the GPIB-PC listen address is &H20 or ASCII space). CMD$ = "?L " ' UNL TAD MLA CALL IBCMD (BRD0%,CMD$) FLNAME$ = "RDGS"...
Page 133
BASICA/QuickBASIC GPIB-PC Function Calls Device Example: Read 56 bytes of data from the device TAPE% and store in the integer array RD%. CNT% = 56 DIM RD% (28) CALL IBRDI (TAPE%,RD%(0),CNT%) CALL IBRDI (TAPE%,VARPTR(RD%(0)),CNT%) CALL IBRDI (TAPE%,RD%(), CNT%) GPIB-PC User Manual Array size is equal to CNT% divided by 2.
Page 134
Read 56 bytes of data into the integer array RD% from a device at talk address &H4C (ASCII L) and then unaddress it (the GPIB-PC listen address is &H20 or ASCII space). CMD$ = "? L" ' UNL MLA TAD...
BASICA/QuickBASIC GPIB-PC Function Calls BASICA/QuickBASIC IBRDIA Purpose: Read data asynchronously to integer array Format: Call IBRDIA (BD%,IARR%(0),CNT%) Call IBRDIA (BD%, VARPTR(IARR%(0)),CNT%) Call IBRDIA (BD%, IARR%(), CNT%) Remarks: BD% specifies a device or an interface board. IARR% specifies an integer array into which data is read asynchronously from the GPIB.
Page 136
I/O operation. Refer to the IBRDA function and to the BASICA and QuickBASIC GPIB-PC I/O Functions at beginning of this section. Device Example: Read 56 bytes of data into the integer array RD% from the device TAPE% while performing other processing.
Page 137
Read 56 bytes of data into the integer array RD% from a device at talk address &H4C (ASCII L) and then unaddress it (the GPIB-PC listen address is &H20 or ASCII space). CMD$ = "? L" ' UNL MLA TAD...
IDY message (ATN and EOI both asserted) and reading the response from the GPIB data lines. An ECIC error results if the GPIB-PC is not CIC. If the GPIB-PC is Standby Controller, it takes control and asserts ATN (becomes Active) prior to polling.
If V% is zero, functions requiring System Controller capability are disallowed. The IBRSC function is used to enable or disable the capability of the GPIB-PC to send the Interface Clear (IFC) and Remote Enable (REN) messages to GPIB devices using the IBSIC and IBSRE functions respectively.
BASICA/QuickBASIC GPIB-PC Function Calls BASICA/QuickBASIC IBRSP Purpose: Return serial poll byte Format: CALL IBRSP (BD%,SPR%) Remarks: BD% specifies a device. SPR% is the variable in which the poll response is stored. The IBRSP function is used to serially poll one device and obtain its status byte or to obtain a previously stored status byte.
Remarks: BD% specifies an interface board. V% specifies the response or status byte the GPIB-PC provides when serially polled by another device that is the GPIB CIC. If bit 6 (the &H40 bit) is set, the GPIB-PC additionally requests service from the Controller by asserting the GPIB SRQ line.
Page 147
BASICA/QuickBASIC GPIB-PC Function Calls Device Examples: Change the secondary GPIB address of the device PLOTTER% from its current value to &H6A. V% = &H6A CALL IBSAD (PLOTTER%,V%) Disable secondary addressing for the device DVM%. V% = 0 CALL IBSAD (DVM%,V%)
CALL IBSIC (BD%) Remarks: BD% specifies an interface board. The IBSIC function causes the GPIB-PC to assert the IFC signal for at least 100 microseconds, provided the GPIB-PC has System Controller capability. This action initializes the GPIB and makes the interface board CIC and Active Controller with ATN asserted, and is generally used when a bus fault condition is suspected.
REN enables the remote mode. A device does not actually enter remote mode until it receives its listen address. The ESAC error occurs if the GPIB-PC is not System Controller. When IBSRE is called and an error does not occur, the previous value of V% is stored in IBERR%.
BASICA/QuickBASIC GPIB-PC Function Calls BASICA/QuickBASIC IBSTOP Purpose: Abort asynchronous operation Format: CALL IBSTOP (BD%) Remarks: BD% specifies a device or an interface board. IBSTOP terminates any asynchronous read, write, or command operation in progress. Device IBSTOP Function: If BD% specifies a device, IBSTOP attempts to terminate any unfinished asynchronous I/O operation to that device that had been started with a device function for that device.
BASICA/QuickBASIC GPIB-PC Function Calls BASICA/QuickBASIC IBTMO Purpose: Change or disable time limit Format: CALL IBTMO (BD%,V%) Remarks: BD% specifies a device or an interface board. V% is a code specifying the time limit as follows: NOTE: If V% is zero, no limit is in effect.
Page 155
BASICA/QuickBASIC GPIB-PC Function Calls Device Example: Change the time limit for calls involving the device TAPE% to approximately 300 msec. V% = 10 CALL IBTMO (TAPE%,V%) Board Example: Change the time limit for calls directed to the interface board BRD0% to approximately 10 msec.
BASICA/QuickBASIC GPIB-PC Function Calls BASICA/QuickBASIC IBWAIT Purpose: Wait for selected event Format: CALL IBWAIT (BD%,MASK%) Remarks: BD% specifies a device or an interface board. MASK% is a bit mask with the same bit assignments as the status word, IBSTA%. Each MASK% bit is set or cleared to wait or not wait, respectively, for the corresponding event to occur.
Page 160
I/O completed GPIB-PC is in lockout state GPIB-PC is in remote state GPIB-PC is CIC Attention is asserted GPIB-PC is Talker GPIB-PC is Listener GPIB-PC is in device trigger state GPIB-PC is in device clear state 4A-85 GPIB-PC User Manual...
Page 161
BASICA/QuickBASIC GPIB-PC Function Calls Device Example: Wait indefinitely for the device LOGGER% to request service. MASK% = &H800 CALL IBWAIT (LOGGER%,MASK%) Board Examples: Wait for a service request or a timeout. MASK% = &H5000 CALL IBWAIT (BD%,MASK%) Update the current status for IBSTA%.
Page 163
BASICA/QuickBASIC GPIB-PC Function Calls If the access board is Active Controller, the board is first placed in Standby Controller state with ATN off and remains there after the write operation is completed. Otherwise, the write operation commences immediately. An EADR error results if the board is CIC but has not been addressed to talk with the IBCMD function.
Page 164
Section Four A Board Example: Write 10 instruction bytes to a device at listen address &H2F (ASCII /) and then unaddress it (the GPIB-PC talk address is &H40 or ASCII @). CMD$ = "?@/" CALL IBCMD (BRD0%,CMD$) WRT$ = "F3R1X5P2G0"...
BASICA/QuickBASIC GPIB-PC Function Calls BASICA/QuickBASIC IBWRTA Purpose: Write data asynchronously from string Format: CALL IBWRTA (BD%,WRT$) Remarks: BD% specifies a device or an interface board. WRT$ contains the data to be sent over the GPIB. This is a special case of the IBWRTA function which in BASICA writes a maximum of 255 bytes from a character string to the GPIB.
Page 167
Write 10 instruction bytes to a device at listen address &H2F (ASCII /), while testing for a high priority event to occur, and then unaddress it (the GPIB-PC talk address is &H40 or ASCII CMD$ = "?@/" CALL IBCMD (BRD0%,CMD$) WRT$ = "F3R1X5P2G0"...
Page 169
BASICA/QuickBASIC GPIB-PC Function Calls The board IBWRTF operation terminates on any of the following events: • All bytes sent; • Error is detected; • Time limit is exceeded; or • Device Clear (DCL) or Selected Device Clear (SDC) command is received from another device which is the CIC.
Page 171
BASICA/QuickBASIC GPIB-PC Function Calls Device Examples: Write 10 instruction bytes from the integer array WRT% to the device DVM%. DIM WRT%(4) WRT%(0) = ASC("F") + ASC("3") * 256 WRT%(1) = ASC("R") + ASC("1") * 256 WRT%(2) = ASC("X") + ASC("5") * 256 WRT%(3) = ASC("P") + ASC("2") * 256...
Page 172
Board Example: Write 10 instruction bytes from the integer array WRT% to a device at listen address &H2F (ASCII /) and then unaddress it (the GPIB-PC talk address is &H40 or ASCII @). CMD$ = "?@/" CALL IBCMD (BRD0%,CMD$) DIM WRT%(4) WRT%(0) = ASC("F") + ASC("3") * 256...
BASICA/QuickBASIC GPIB-PC Function Calls BASICA/QuickBASIC IBWRTIA Purpose: Write data asynchronously from integer array Format: BASICA and QuickBASIC Version 1.0: Call IBWRTIA (BD%,IARR%(0),CNT%) Call IBWRTIA (BD%, VARPTR(IARR%(0)), CNT%) Call IBWRTIA (BD%, IARR%(), CNT%) Remarks: BD% specifies a device or an interface board. IARR% is an array from which integer data is written.
Page 175
Board Example: Write 10 instruction bytes from the integer array WRT% to a device at listen address &H2F (ASCII /) and then unaddress it (the GPIB-PC talk address is &H40 or ASCII @). CMD$ = "?@/" CALL IBCMD (BRD0%,CMD$) DIM WRT%(4) WRT%(0) = ASC("F") + ASC("3") * 256...
This section illustrates the programming steps that could be used to program a representative IEEE-488 instrument from your personal computer using the GPIB-PC handler functions. The applications are written in BASICA and QuickBASIC. The target instrument is a digital voltmeter (DVM). This instrument is otherwise unspecified (that is, it is not a DVM manufactured by any particular manufacturer).
Page 177
The only changes made to the software parameters are those necessary to define the device DVM at primary address 3. • There is only one GPIB-PC in use, which is designated GPIB0. • Its primary listen and talk addresses are &H20 (ASCII space character) and &H40 (ASCII @ character), respectively.
Page 179
BASICA/QuickBASIC GPIB-PC Function Calls CALL IBRSP (DVM%,SPR%) IF IBSTA% < 0 THEN GOTO 3000 Now test the status byte (SPR%). If SPR% is &HC0, the DVM has valid data to send; otherwise, it has a fault condition to report. IF SPR% <> &HC0 THEN GOTO 4000 If the data is valid, read the measurement.
Page 181
IBWAIT must have returned on SRQ. unaddress bus devices and send the Serial Poll Enable (SPE) command, then send the DVM's talk address and the GPIB-PC listen address &H20 (ASCII space). CMD$ = "?_" + CHR$(&H18) + "C " CALL IBCMD (BRD0%,CMD$) IF IBSTA% <...
Page 182
Section Four A Since the DVM and GPIB-PC are still addressed to talk and listen, the measurement can be read REM as follows. RD$ = SPACE$(16) : CALL IBRD (BRD0%,RD$) IF IBSTA% < 0 THEN GOTO 3000 To close out a programming sequence, send...
BASICA/QuickBASIC GPIB-PC Function Calls QuickBASIC Example Program - Device QuickBASIC - Using device function calls. COMMON SHARED IBSTA%, IBERR%, IBCNT% Assign a unique identifier to device and store in variable DVM%. BDNAME$ = "DVM" CALL IBFIND (BDNAME$,DVM%) Check for error on IBFIND call.
Page 187
BASICA/QuickBASIC GPIB-PC Function Calls IF IBSTA% < 0 THEN GOSUB GPIB-ERROR: Send the GET message to trigger a measurement reading. CMD$ = CHR$(&H8) : CALL IBCMD (BRD0%,CMD$) IF IBSTA% < 0 THEN GOSUB GPIB-ERROR: Wait for the DVM to set SRQ or for a timeout;...
Page 188
Section Four A CMD$ = CHR$(&H19) : CALL IBCMD (BRD0%,CMD$) IF IBSTA% < 0 THEN GOSUB GPIB-ERROR: Since the DVM and GPIB-PC are still addressed to talk and listen, the measurement can be read as follows. RD$ = SPACE$(16) : CALL IBRD (BRD0%,RD$) IF IBSTA% <...
Page 189
This interactive method of data input and data/status output is designed to help you learn how to use the GPIB-PC functions to program your device. Once you develop a sequence of steps that works successfully for your system, you can easily incorporate the sequence into an application program using the appropriate language and syntax described in Section Four.
IBIC Running IBIC The IBIC program, IBIC.EXE, is an executable file that was copied from the distribution diskette to a subdirectory called GPIB-PC when you ran IBSTART at installation. To run IBIC, change directory to C:\GPIB-PC and enter: C:\GPIB-PC> National Instruments...
IBIC Other IBIC Functions and Syntax Table 5.1 summarizes the GPIB-PC functions and syntax when called from IBIC. Syntax rules for IBIC are explained in the table notes. Consult Section Four for detailed function descriptions and for syntax rules of the programming language you will use.
CMPL TACS LACS DTAS DCAS Error Code If a GPIB-PC function completes with an error, IBIC also displays the error mnemonic. The following example illustrates an error condition occurred in the data transfer. Example: dev1: [8100] (err cmpl) ERROR:...
Call IBFIND initially to open each device or board. If option is omitted, a menu of options appears. Replace function with correct IBIC function syntax. filename is the DOS pathname of a file that contains IBIC functions to be executed. GPIB-PC User Manual Function Syntax set bdname help...
The SET function specifies a previously opened device or board to be used for subsequent GPIB-PC functions executed from IBIC. SET eliminates the need to include the BD unit descriptor in each GPIB-PC function call. The argument bdname is any of the symbolic device or board names recognized by the handler.
[130] - (Turn OFF Display) The - function causes the GPIB-PC function output NOT to be displayed on the screen. This function is useful when you want to repeat a GPIB-PC I/O function quickly without waiting for screen output to be displayed.
Refer to Section Four A, BASICA/QuickBASIC GPIB Programming Examples, for a description of the programming steps that could be used to program a representative IEEE-488 instrument from your personal computer using the GPIB-PC handler functions. The applications are written using IBIC commands. Device Function Calls To communicate with a device, first "find"...
Page 211
GPIB-PC board's talk address. This was calculated using the Multiline Interface Message chart in Appendix A. The GPIB-PC board is at GPIB primary address 0. Moving across to the Talk address column, the appropriate ASCII character is an @ character.
Page 212
[0188] (cmpl lok cic atn tacs) count: 1 Wait for the DVM to set SRQ or for a timeout; if the current timeout limit is too short, use IBTMO to change it. Example: GPIB-PC User Manual ibwrt "F3R7T3" ibcmd "\x08" 5-24 Section Five...
Page 214
Example: GPIB0: ibcmd "\x19" [01F4] (cmpl lok rem cic atn lacs) count: 1 Since the DVM and the GPIB-PC are still addressed to talk and to listen, the measurement can be read. Example: ibrd 20 GPIB0: [01E4] (cmpl lok rem cic lacs) 0D 0A 4E 44 43 56 2D 30•...
Page 219
IBTRAP -dis IBTRAP -off See Section Four of the Programming Language Supplement for the appropriate syntax to use in your application program. GPIB-PC User Manual record all GPIB handler calls and display the monitor whenever attention is asserted or the GPIB- PC Controller-in-Charge.
Use the up and down arrow keys to highlight the new mode and press ENTER to record the change. Pressing ESCAPE will cancel this action and leave the mode unchanged. GPIB-PC User Manual scrolls summary up one line scrolls summary down one line...
[PPD] parallel poll disable [PPE] parallel poll enable PPRn parallel poll response n parallel poll unconfigure GPIB-PC User Manual Interface Function(s) L, LE L, LE L, LE SH, AH, T, TE, L, LE, SR, RL, PP, C AH, C T, TE...
Page 229
(via C) (via C) (via C) (via C) (via C) (via C) (via C) (via C) (via C) (via C) T, TE (via C) (via C) (via C) (via T, TE) (via C) (via C) (via C) GPIB-PC User Manual...
• Reboot your system after you install the software. ECIC(1) Error Condition: Function requires GPIB-PC to be Controller-In- Charge. Solutions: • Run IBCONF and make sure the board being used (GPIB0 or GPIB1) is configured to be the System Controller.
Appendix B EADR(3) Error Condition: GPIB-PC (GPIB0 or GPIB1) is not addressed correctly. Solutions: • Use IBCMD to send the appropriate Talk or Listen address before attempting an IBWRT or IBRD. • If calling IBGTS with the shadow handshake feature, call IBCMD to ensure that the GPIB ATN line is asserted.
Common Errors and Their Solutions ESAC(5) Error Condition: GPIB-PC not System Controller as required. Solutions: • Run IBCONF and make sure the board (GPIB0 or GPIB1) is configured to be System Controller. • Issue a board IBRSC function call with a value of 1 to request System Control.
Appendix B ENEB(7) Error Condition: Non-existent GPIB-PC board. Solution: • Run IBCONF and make sure the board type (GPIB-PCII, PCIIA or PCIII) and base I/O address match the hardware and address switch settings. If you make any changes, reboot after leaving IBCONF.
IBSTART. Solution: • IBSTART copies the files to the subdirectory \GPIB-PC on the boot disk. Only GPIB.COM and IBCONF.EXE are copied to the root directory. Change to the \GPIB-PC directory with the DOS command cd \GPIB-PC to run other programs.
Page 238
• When running a program check for errors after each GPIB-PC function call . If an early call failed but you did not check IBSTA, later functions will behave improperly and give misleading status data.
Revision B and Revision C Interrupts In Rev. C, the software is interrupt driven, improving its performance and taking advantage of the interrupt capabilities of the GPIB-PC interface board. Startup Program The Rev. C standard software package includes a startup program (IBSTART.BAT) to get you started faster.
GPIB-PC cards and systems. Revision C and Revision D Both Rev. C and Rev. D software are current and are actively supported. The one you receive depends on the GPIB-PC interface hardware you buy. Device Functions Device I/O functions do not unaddress devices at the end of the call.
SRQI Status Bit In Rev. D the SRQI status bit always reflects the current level of the SRQ line whether or not the GPIB-PC is CIC. ATN and/or TIMO With the IBWAIT function, it is not possible to wait for the ATN or TIMO conditions.
Appendix D - Using your Printer with the GPIB-PC The Serial/Parallel port redirection feature in the GPIB-PC software allows you to replace default printer drivers so that output can be redirected to a GPIB printer or plotter. After the appropriate configuration, these GPIB devices can be accessed through system calls and other language printer commands (e.g., LPRINT, LPRINT USING,...
NOTE: The read and write commands must be executed here within a certain time limit of each other; otherwise the timeout factor which comes at a default of ten seconds will abort the operation. GPIB-PC User Manual Slave GPIB0: Slave...
Page 246
Appendix F Customer Communication National Instruments provides comprehensive technical assistance around the world. In the U.S. and Canada, applications engineers are available Monday through Friday from 8:00 a.m. to 6:00 p.m. (central time). In other countries, contact the nearest branch office. You may fax questions to us at any time.
Page 247
National Instruments encourages you to comment on the documentation supplied with our products. This information helps us provide quality products to meet your needs. Title: GPIB-PC User Manual for the IBM Personal Computer and Compatibles Edition Date: April 1988 Part Number: 320014-01 Please comment on the completeness, clarity, and organization of the manual.
Page 248
Thank you for your help. Name Title Company Address Phone Mail to: Technical Publications National Instruments Corporation 6504 Bridge Point Parkway, MS 53-02 Austin, TX 78730-5039 Fax to: Technical Publications National Instruments Corporation MS 53-02 (512) 794-5678...
GPIB-PC interface board or other GPIB device that is the object of the function. See Unit Descriptor. BOARD - One of the GPIB-PC interface boards in the computer. See Device. BOARD FUNCTION - A function that operates on or otherwise pertains to one of the GPIB-PC interface boards in the computer.
Page 250
See Commands or Interface Message. DEVICE FUNCTION - A function that operates on or otherwise pertains to a GPIB device rather than to the GPIB-PC interface board in the computer. See Board Function. DIO1-DIO8 - The GPIB lines that are used to transmit command or data bytes from one device to another.
Page 251
GPIB ADDRESS - The address of a device on the GPIB, composed of a primary address (MLA and MTA) and perhaps a secondary address (MSA). The GPIB-PC has both a GPIB address and an I/O address. GPIB.COM - The GPIB-PC handler filename.
Page 252
GPIB-PC and other devices on the GPIB. I/O ADDRESS - The address of the GPIB-PC from the CPU's point of view, as opposed to the GPIB address of the GPIB-PC. Also called port address or board address.
Page 253
NRFD or NOT READY FOR DATA - One of the three GPIB handshake lines. See Handshake. ON PEN STATEMENT - National Instruments uses this statement to intercept SRQ interrupts and make them available to user programs. OPENED DEVICE OR BOARD - One that has been enabled or placed online by the IBFIND function.
Page 254
PPU or PARALLEL POLL UNCONFIGURE - A GPIB command used to disable any device from participating in polls. PROGRAMMED I/O - Low speed data transfer between the GPIB-PC and memory in which the CPU moves each data byte according to program instructions.
Page 255
TCT or TAKE CONTROL - A GPIB command used to pass control of the bus from the current Controller to an addressed Talker. TIMEOUT - A feature of the GPIB-PC handler that prevents I/O functions from hanging indefinitely when there is a problem on the GPIB.
Page 256
Auto serial polling (Boards Only), disable 2-15 Automatic serial polling 4-13 Auxiliary IBIC functions 5-12 Base I/O address (Boards Only) 2-15 BASICA Files 4A-2 GPIB-PC I/O Functions 4A-5 ON SRQ 4A-6 Programming Preparation 4A-3 Board base I/O address 2-15 characteristics 2-12...
Page 259
Index GPIB-PC characteristics of 2-7 functions introduction to 3-1 BASICA/QuickBASIC GPIB I/O 4A-2, 4A-5 IBIC 5-7, 5-8 Introduction, GPIB-PC Functions 3-1 model 2-14 software installation 2-3 Using 2-18 using your printer with D-1 Group I 3-2 Group II 3-3 Clearing the Device vs Clearing the GPIB 3-4...