background image

Section Four

GPIB-PC Functions — Overview

©National Instruments Corp.

4-13

GPIB-PC User Manual

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.

Summary of Contents for GPIB-PC

Page 1: ... Copyright 1984 1994 National Instruments Corporation All Rights Reserved GPIB PC User Manual for the IBM Personal Computer and Compatibles April 1988 Edition Part Number 320014 01 ...

Page 2: ...fices 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 ...

Page 3: ... 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 ho...

Page 4: ...sted 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 ca...

Page 5: ...eneral 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 GPI...

Page 6: ...sonal 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 c...

Page 7: ...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...

Page 8: ... 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 you...

Page 9: ...equest 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 IBST...

Page 10: ... 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 GP...

Page 11: ...nd 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 I...

Page 12: ... 11 Device Function Calls 4 12 Automatic Serial Polling 4 13 Section Four A BASICA QuickBASIC GPIB PC Function Calls 4A 1 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 IB...

Page 13: ...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 ...

Page 14: ...ls 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 Referen...

Page 15: ...2 General C 2 Revision C and Revision D 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 Appendix D Using your Printer with the GPIB PC D 1 Installation D 1 Appendix E Application Notes E 1 Application Note 1 Computer to Computer Data Transfer E ...

Page 16: ... 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...

Page 17: ...ice 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 device...

Page 18: ...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 t...

Page 19: ...sages 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 e...

Page 20: ...ontroller 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 ...

Page 21: ...evices 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 n...

Page 22: ...1 1 1 2 1 3 14 1 5 1 6 1 7 1 8 1 9 20 2 1 22 23 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 DIO1 DIO2 DIO3 DIO4 EOI DAV NRFD NDAC IFC SRQ ATN SHIELD Figure 1 1 GPIB Connector and the Signal Assignment ...

Page 23: ...Section One Operation of the GPIB National Instruments Corp 1 7 GPIB PC User Manual Figure 1 2 Linear Configuration ...

Page 24: ...Operation of the GPIB Section One GPIB PC User Manual 1 8 National Instruments Corp Figure 1 3 Star Configuration ...

Page 25: ... 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 consu...

Page 26: ... 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 operatin...

Page 27: ... 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...

Page 28: ...reparation 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 an...

Page 29: ... 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 C...

Page 30: ...ou must run IBCONF to reconfigure the software You may also run IBCONF to examine how the software is configured See More About IBCONF later in this section for information on how to run IBCONF and on the configurable software parameters NOTE You must run IBCONF if you have a PCIIA or wish to change defaults Step 4 Reboot Reboot your computer from the drive you specified when you ran IBSTART so th...

Page 31: ...s 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 characterist...

Page 32: ...te 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 ...

Page 33: ...t 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 ...

Page 34: ...om 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...

Page 35: ... 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...

Page 36: ...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 cha...

Page 37: ...elect 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 a...

Page 38: ...de Actual Value Minimum Timeout 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 msec 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 ef...

Page 39: ... 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...

Page 40: ...EE 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...

Page 41: ... rounded up Since the signal CLK varies according to the machine this field varies as well Typical examples are Machine 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 ...

Page 42: ...r 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 strin...

Page 43: ...rument 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...

Page 44: ...earn 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 ...

Page 45: ...D 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 transfer...

Page 46: ... 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 ...

Page 47: ... 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 ...

Page 48: ... 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 Gro...

Page 49: ... 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 functi...

Page 50: ...n 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 con...

Page 51: ...y 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 ...

Page 52: ...ific 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 c...

Page 53: ... 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 e...

Page 54: ...ntroduction National Instruments Corp 3 11 GPIB PC User Manual Boards Devices GPIB0 GPIB1 GPIB Board GPIB Board Oscilloscope Digital Voltmeter Plotter Printer Another GPIB One GPIB SCOPE DVM PLTR PRTR Figure 3 1 Multiboard GPIB System ...

Page 55: ...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 EN...

Page 56: ...alk 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 synchronous...

Page 57: ...D 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 functio...

Page 58: ...ront 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 Th...

Page 59: ...arallel 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 stat...

Page 60: ...cution 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 ena...

Page 61: ...ammed 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 w...

Page 62: ...lar 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 ...

Page 63: ...s 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 100...

Page 64: ... 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...

Page 65: ...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...

Page 66: ...mmand 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 dete...

Page 67: ...o 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 condit...

Page 68: ...d 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 p...

Page 69: ...emedy 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 imme...

Page 70: ...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...

Page 71: ...rogram 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...

Page 72: ...ast 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 us...

Page 73: ...he 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 ...

Page 74: ...ear 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 ...

Page 75: ...ed 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...

Page 76: ... 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 requir...

Page 77: ...rlier 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 diskett...

Page 78: ...uickBASIC 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 BA...

Page 79: ...erface 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 begin...

Page 80: ...ractive 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...

Page 81: ...on 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...

Page 82: ...lear 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 paral...

Page 83: ...iption 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 fro...

Page 84: ...rallel 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 ...

Page 85: ...AME 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 as...

Page 86: ...x 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 ...

Page 87: ...t 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 Yo...

Page 88: ... 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...

Page 89: ...er 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 ...

Page 90: ...ns 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 e...

Page 91: ...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...

Page 92: ...ction 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...

Page 93: ...SIC GPIB PC Function Calls Section Four A GPIB PC User Manual 4A 18 National Instruments Corp 2 Take control synchronously and assert ATN following a read operation 100 CALL IBRD BRD0 RD 110 V 1 120 CALL IBCAC BRD0 V ...

Page 94: ... 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 ...

Page 95: ...so 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 com...

Page 96: ...alker 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 li...

Page 97: ... 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 ...

Page 98: ...vice 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 I...

Page 99: ...ccur 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 1...

Page 100: ... 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 ...

Page 101: ...ntil IBEOS is called again the IBONL or IBFIND function is called or the system is rebooted When IBEOS is called and an error does not occur the previous value of V is stored in IBERR Table 4A 5 Data Transfer Termination Method Method Value of V High Byte Low Byte A Terminate read when EOS 00000100 EOS is detected B Set EOI with EOS on write 00001000 EOS function C Compare all 8 bits of EOS 000100...

Page 102: ...lly send that byte when performing IBWRTs To send the EOS byte your application program must include it in the data string it defines Device IBEOS Function When BD specifies a device the options coded in V are used for all device reads and writes in which that device is specified Board IBEOS Function When BD specifies a board the options coded in V become associated with all board reads and writes...

Page 103: ... do 130 REM board read 140 RD SPACE 200 150 CALL IBRD BRD0 RD 160 REM The END bit in IBSTA is set if the 170 REM read terminated on the EOS 180 REM character The value of IBCNT 190 REM shows the number of bytes received 2 To program the interface board BRD0 to terminate read operations on the 8 bit value H82 rather than the 7 bit character H0A change lines 10 and 100 in Example 1 10 EOSV H82 100 V...

Page 104: ...nvolving the interface board BRD0 10 EOSV H0A EOS info for IBEOS 100 V EOSV H0800 110 CALL IBEOS BRD0 V 120 REM Assume the board has been 130 REM addressed do board write 140 WRT 123 CHR H0A 150 CALL IBWRT BRD0 WRT 5 To send END with linefeeds and to terminate reads on linefeeds for operations involving the interface board BRD0 change line 100 in Example 4 100 V EOSV H0C00 ...

Page 105: ...fer and it is used to identify the last byte of a data string without having to use an end of string character IBEOT is used primarily to send variable length binary data The assignment made by this function remains in effect until IBEOT is called again the IBONL or IBFIND function is called or the system is rebooted When IBEOT is called and an error does not occur the previous value of V is store...

Page 106: ...e data to be written to the GPIB 140 CALL IBWRT PLOTTER WRT Board Examples 1 Stop sending END with the last byte for calls directed to the interface board BRD0 100 V 0 Disable sending of EOI 110 CALL IBEOT BRD0 V 2 Send the END message with the last byte of all subsequent write operations directed to the interface board BRD0 100 V 1 Enable sending of EOI 110 CALL IBEOT BRD0 V 120 REM It is assumed...

Page 107: ...articular default or configured device or board name The name used in the BDNAME argument must match exactly the default or configured device or board name The number returned referred throughout this manual as a unit descriptor is assigned here to the variable BD which is used in all references to that device or board in GPIB function calls IBFIND performs the equivalent of IBONL to open the spec...

Page 108: ...ital Voltmeter to the variable FSDVM 100 BDNAME FSDVM Device name 110 assigned at 120 configuration time 130 CALL IBFIND BDNAME FSDVM 140 IF FSDVM 0 GOTO 1000 ERROR ROUTINE Board Example 1 Assign the unit descriptor associated with the interface board GPIB0 to the variable BRD0 100 BDNAME GPIB0 Board name 110 assigned at 120 configuration time 130 CALL IBFIND BDNAME BRD0 140 IF BRD0 0 GOTO 1000 ER...

Page 109: ...f the shadow handshake option is activated the GPIB PC participates in data handshake as an Acceptor without actually reading the data It monitors the transfers for the END EOI or end of string character message and holds off subsequent transfers This mechanism allows the GPIB PC to take control synchronously on a subsequent operation such as IBCMD or IBRPP Before performing an IBGTS with shadow h...

Page 110: ...e ATN line off with the IBGTS function after unaddressing all Listeners with the Unlisten UNL or ASCII command addressing a Talker at H46 ASCII F and addressing a Listener at H31 ASCII 1 to allow the Talker to send data messages 100 CMD F1 UNL MTA1 MLA2 110 CALL IBCMD BRD0 CMD 120 V 1 Listen in continuous mode 130 CALL IBGTS BRD0 V ...

Page 111: ...rmined 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 conversely it can be assigned to drive DIO3 true if ist 0 and false if ist 1 The relationship between the value of ist the line that is driven and the sense at which the line is driven is determined by the Parall...

Page 112: ... PC Function Calls National Instruments Corp 4A 37 GPIB PC User Manual Board Examples 1 Set the individual status bit 100 V 1 Any non zero value will do 110 CALL IBIST BRD0 V 2 Clear the individual status bit 100 V 0 110 CALL IBIST BRD0 V ...

Page 113: ...ed on that device Device IBLOC Function IBLOC places the device indicated in local mode by calling IBCMD to send the command sequence Unlisten UNL Listen address of the device Secondary address of the device if necessary Go To Local GTL and Untalk UNT and Unlisten UNL Other command bytes may be sent as necessary On exit all devices are unaddressed Board IBLOC Function When BD specifies an interfac...

Page 114: ...C GPIB PC Function Calls National Instruments Corp 4A 39 GPIB PC User Manual Device Example 1 Return the device DVM to local state 100 CALL IBLOC DVM Board Example 1 Return the interface board BRD0 to local state 100 CALL IBLOC BRD0 ...

Page 115: ...e from the other devices IBONL can also be used to restore the default configuration settings of a device or interface board Calling IBONL with V non zero when the device or interface board is already online simply has the effect of restoring all configuration settings to their defaults Device Examples 1 Disable the device PLOTTER 100 V 0 110 CALL IBONL PLOTTER V 2 Enable the device PLOTTER after ...

Page 116: ... IBONL BRD0 V 2 Enable the interface board BRD0 after taking it offline temporarily 100 BDNAME GPIB0 Board name assigned 110 at configuration time 120 CALL IBFIND BDNAME BRD0 130 REM IBONL with V non zero is 140 REM automatically performed as part of 150 REM IBFIND 3 Reset the configuration settings of the interface board BRD0 to their defaults 100 V 1 110 CALL IBONL BRD0 V ...

Page 117: ...r the system is rebooted When IBPAD is called and an error does not occur the previous value of ist is stored in IBERR The previous primary address is returned in IBERR Device IBPAD Function When BD specifies a device IBPAD determines the talk and listen addresses based on the value of V for use in all I O directed to that device A device listen address is formed by adding H20 to the primary addre...

Page 118: ...k address of the device PLOTTER from the configuration setting to H2A and H4A respectively 100 V HA Lower 5 bits of GPIB address 110 CALL IBPAD PLOTTER V Board Example 1 Change the primary GPIB listen and talk address of the interface board BRD0 from the configuration setting to H27 and H47 respectively 100 V H7 Lower 5 bits of GPIB address 110 CALL IBPAD BRD0 V ...

Page 119: ...ce from the access board assigned to that device The board automatically goes to Controller Idle State CIDS The function assumes that the device has Controller capability IBPCT calls the board IBCMD function to send the following commands Talk address of the device Secondary address of the device if applicable and Take Control TCT Other command bytes may be sent as necessary Refer to IBCMD for add...

Page 120: ...ction to send the following commands Listen address of the device Secondary address of the device if applicable Parallel Poll Configure PPC and Parallel Poll Enable PPE or Disable PPD Other command bytes are sent if necessary Each of the 16 PPE messages specifies the GPIB data line DIO1 through DIO8 and sense one or zero that the device must use when responding to the Identify IDY message during a...

Page 121: ...ing its local poll enable lpe message to the value of V Refer also to IBCMD IBIST and Table 2 1 for additional information Device Examples 1 Configure the device DVM to respond to a parallel poll by sending data line DIO5 true ist 0 100 V H64 110 CALL IBPPC DVM V 2 Configure the device DVM to respond to a parallel poll by sending data line DIO1 true ist 1 100 V H68 110 CALL IBPPC DVM V 3 Cancel th...

Page 122: ...cess board to listen 2 The board IBRD function is called to read the data from the device as explained in the following discussion 3 The IBCMD function is called to unaddress the access board and unaddress all devices using the Untalk and Unlisten commands Other command bytes may be sent as necessary When the device IBRD function returns IBSTA holds the latest device status IBCNT is the actual num...

Page 123: ...ssed and or the operation does not complete for whatever reason within the time limit The board IBRD operation terminates on any of the following events Allocated buffer becomes full Error is detected Time limit is exceeded END message is detected EOS character is detected if this option is enabled or Device Clear DCL or Selected Device Clear SDC command is received from another device which is th...

Page 124: ...t the GPIB PC listen address is H20 or ASCII space 100 CMD L UNL MLA TAD 110 CALL IBCMD BRD0 CMD 120 RD SPACE 56 130 CALL IBRD BRD0 RD 140 REM Check IBSTA to see how the read 150 REM terminated on CMPL END TIMO or 160 REM ERR 170 REM Data is stored in RD 180 REM Unaddress the Talker and Listener 190 CMD _ UNT UNL 200 CALL IBCMD BRD0 CMD 2 To terminate the read on an end of string character see IBE...

Page 125: ...transmitted quickly by the GPIB device 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 read is r...

Page 126: ...rst 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 interface board is CIC but has not addressed itself as a Listener with the IBCMD function IBRDA returns immediately even when no error condition exists When you notice the CMPL bit set in IBSTA indicating that th...

Page 127: ...ead 110 RD SPACE 56 120 CALL IBRDA TAPE RD 130 MASK H4100 TIMO CMPL 140 REM Perform other processing here then 150 REM wait for I O completion or a 160 REM timeout 170 CALL IBWAIT TAPE MASK 180 REM Check IBSTA to see how the read 190 REM terminated on CMPL END TIMO or 200 REM ERR If CMPL is not set 210 REM continue processing 220 IF IBSTA AND H100 0 GOTO 130 230 REM Data is stored in RD 240 REM Al...

Page 128: ...NL MLA TAD 130 CALL IBCMD BRD0 CMD 140 REM Perform board read 150 RD SPACE 56 160 CALL IBRDA BRD0 RD 170 REM Perform other processing here then 180 REM wait for I O completion or a 190 REM timeout 200 MASK H4100 TIMO CMPL 210 CALL IBWAIT BRD0 MASK 220 REM Check IBSTA to see how the read 230 REM terminated on CMPL END TIMO or 240 REM ERR not done here Data is 250 REM stored in RD 260 REM Unaddress ...

Page 129: ...RDF Function When BD specifies a device the device IBRD function is called to read from the device When the device IBRDF function returns IBSTA holds the latest device status IBCNT is the actual number of data bytes read from the device modulo 65 536 and IBERR is the first error detected if the ERR bit in IBSTA is set Board IBRDF Function When BD specifies an interface board the board IBRD functio...

Page 130: ...s enabled or Device Clear DCL or Selected Device Clear SDC command is received from another device which is the CIC After termination IBCNT contains the number of bytes read modulo 65 536 Device Example 1 Read data from the device RDR into the file RDGS on disk drive B 100 REM Perform device read 110 FLNAME B RDGS 120 CALL IBRDF RDR FLNAME 130 REM Check IBSTA and IBCNT to see how 140 REM the read ...

Page 131: ...e and then unaddress it the GPIB PC listen address is H20 or ASCII space 100 REM Perform addressing in preparation 110 REM for board read 120 CMD L UNL TAD MLA 130 CALL IBCMD BRD0 CMD 140 REM Perform board read 150 FLNAME RDGS 160 CALL IBRDF BRD0 FLNAME 170 REM Check IBSTA and IBCNT to see how 180 REM the read completed not done here 190 REM Unaddress the Talker and Listener 200 CMD _ UNT UNL 210 ...

Page 132: ...ger array into which data is read from the GPIB CNT specifies the maximum number of bytes to be read VARPTR returns the address of the array so that it may be passed to the language interface Read up to CNT bytes of data from BD and store in IARR As the data is read each byte pair is treated as an integer and stored in IARR Unlike IBRD because IBRDI stores the data directly into an integer array n...

Page 133: ...tes of data from the device TAPE and store in the integer array RD 100 CNT 56 110 REM Array size is equal to CNT divided 120 REM by 2 130 DIM RD 28 140 CALL IBRDI TAPE RD 0 CNT QuickBASIC Version 2 0 or 3 0 replace line 140 with 140 CALL IBRDI TAPE VARPTR RD 0 CNT QuickBASIC Version 4 0 replace line 140 with 140 CALL IBRDI TAPE RD CNT ...

Page 134: ...T 56 130 REM Array size is equal to CNT divided 140 REM by 2 150 DIM RD 28 160 CALL IBRDI BRD0 RD 0 CNT 170 REM Check IBSTA to see how the read 180 REM terminated on CMPL END TIMO or 190 REM ERR 200 REM Data is stored in RD 210 REM Unaddress the Talker and Listener 220 CMD _ UNT UNL 230 CALL IBCMD BRD0 CMD QuickBASIC Version 2 0 and 3 0 replace line 160 with 160 CALL IBRDI TAPE VARPTR RD 0 CNT Qui...

Page 135: ...an interface board IARR specifies an integer array into which data is read asynchronously from the GPIB CNT specifies the maximum number of bytes to be read VARPTR returns the address of the array so that it may be passed to the language interface This is a special case of the IBRDA function which stores a maximum of 255 data bytes into a character string variable in BASICA In QuickBASIC this func...

Page 136: ...is section Device Example 1 Read 56 bytes of data into the integer array RD from the device TAPE while performing other processing 100 REM Perform device read 110 CNT 56 120 REM Array size is equal to CNT divided 130 REM by 2 140 DIM RD 28 150 CALL IBRDIA TAPE RD 0 CNT 160 MASK H4100 TIMO CMPL 170 REM Perform other processing here then 180 REM wait for I O completion or a 190 REM timeout 200 CALL ...

Page 137: ... CMD L UNL MLA TAD 130 CALL IBCMD BRD0 CMD 140 REM Perform board read 150 CNT 56 160 REM Array size is equal to CNT divided 170 REM by 2 180 DIM RD 28 190 CALL IBRDIA BRD0 RD 0 CNT 200 MASK H4100 TIMO CMPL 210 REM Perform other processing here then 220 REM wait for I O completion or a 230 REM timeout 240 CALL IBWAIT BRD0 MASK 250 REM Check IBSTA to see how the read 260 REM terminated on CMPL END T...

Page 138: ...ruments Corp 4A 63 GPIB PC User Manual QuickBASIC Version 2 0 or 3 0 replace line 190 with 190 CALL IBRDIA TAPE VARPTR RD 0 CNT QuickBASIC Version 4 0 replace line 190 with 190 CALL IBRDIA BD RD CNT 2 To terminate the read on an end of string character see IBEOS examples ...

Page 139: ...ied Board IBRPP Function When BD specifies a board the IBRPP function causes the identified board to conduct a parallel poll of previously configured devices by sending the 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 ...

Page 140: ... H6A 110 CALL IBPPC LCRMTR V 120 CALL IBRPP LCRMTR PPR Board Examples 1 Remotely configure the device BRD0 at listen address H23 ASCII to respond positively on DI03 if its individual status bit is 1 and then parallel poll all configured devices 100 REM Send LAD PPC PPE and UNL 110 CMD CHR H05 j 120 CALL IBCMD BRD0 CMD 130 CALL IBRPP BRD0 PPR 2 Disable and unconfigure all GPIB devices from parallel...

Page 141: ...ages to GPIB devices using the IBSIC and IBSRE functions respectively The interface board must not be System Controller to respond to Interface Clear sent by another Controller In most applications the GPIB PC will always be the System Controller In other applications the GPIB PC will never be the System Controller In either case the IBRSC function is used only if the computer is not going to be S...

Page 142: ...IB PC Function Calls National Instruments Corp 4A 67 GPIB PC User Manual Board Example 1 Request to be System Controller if the interface board BRD0 is not currently so designated 100 V 1 Any non zero value will do 110 CALL IBRSC BRD0 V ...

Page 143: ...atic serial polling is enabled the specified device may have been polled previously If it has been polled and a positive response was obtained the RQS bit of that device s status word is set and in this case a call to IBRSP returns the previously acquired status byte If the RQS bit of the status word is not set when IBRSP is called the device is serially polled When a poll is actually conducted th...

Page 144: ...ific For example the polled device might set a particular bit in the response byte to indicate that it has data to transfer and another bit to indicate a need for reprogramming Consult the device documentation for interpretation of the response byte Refer to IBCMD and IBRD for additional information Device Example 1 Obtain the Serial Poll response SPR byte from the device TAPE 100 CALL IBRSP TAPE ...

Page 145: ...tionally requests service from the Controller by asserting the GPIB SRQ line The IBRSV function is used to request service from the Controller using the Service Request SRQ signal and to provide a system dependent status byte when the Controller serially polls the GPIB PC When IBRSV is called and an error does not occur the previous value of ist is stored in IBERR Refer also to Table 2 1 Board Exa...

Page 146: ...ment made by this function remains in effect until IBSAD is called again the IBONL or IBFIND function is called or the system is rebooted When IBSAD is called and an error does not occur the previous value of ist is stored in IBERR Device IBSAD Function When BD specifies a device the function enables or disables extended GPIB addressing for the device When secondary addressing is enabled IBSAD rec...

Page 147: ... value to H6A 100 V H6A 110 CALL IBSAD PLOTTER V 2 Disable secondary addressing for the device DVM 100 V 0 0 or H7F may be used 110 CALL IBSAD DVM V Board Examples 1 Change the secondary GPIB address of the interface board BRD0 from its current value to H6A 100 V H6A 110 CALL IBSAD BRD0 V 2 Disable secondary addressing for the interface board BRD0 100 V 0 0 or H7F may be used 110 CALL IBSAD BRD0 V...

Page 148: ...e GPIB and makes the interface board CIC and Active Controller with ATN asserted and is generally used when a bus fault condition is suspected The IFC signal resets only the GPIB interface functions of bus devices and not the internal device functions Device functions are reset with the Device Clear DCL and Selected Device Clear SDC commands To determine the effect of these messages consult the de...

Page 149: ... on and off REN is used by devices to select between local and remote modes of operation 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 Refer also to IBRSC and Table 2 1 Board Example...

Page 150: ...e the local ability of the device to return to local mode send the Local Lockout LLO or H11 command or include it in the command string at 120 in Example 1 100 CMD CHR H11 110 CALL IBCMD BRD0 CMD or 100 CMD CHR H11 110 CALL IBCMD BRD0 CMD 3 Return all devices to local mode 100 V 0 Set REN to false 110 CALL IBSRE BRD0 V ...

Page 151: ...e function for that device If the operation is aborted before completion the ERR bit in the status word is set and an EABO error is returned No error indication results if the operation successfully completes before IBSTOP is called Board IBSTOP Function If BD specifies a board IBSTOP attempts to terminate any unfinished asynchronous I O operation that had been started with a board function using ...

Page 152: ...Four A BASICA QuickBASIC GPIB PC Function Calls National Instruments Corp 4A 77 GPIB PC User Manual Board Example 1 Stop any asynchronous operations associated with the interface board BRD0 100 CALL IBSTOP BRD0 ...

Page 153: ...e time limit as follows Value Minimum of V Timeout 0 disabled 1 10 µsec 2 30 µsec 3 100 µsec 4 300µsec 5 1 msec 6 3 msec 7 10 msec 8 30 msec 9 100 msec 10 300 msec 11 1 sec 12 3 sec 13 10 sec 14 30 sec 15 100 sec 16 300 sec 17 1000 sec NOTE If V is zero no limit is in effect IBTMO is needed only to alter the value from its configuration setting The assignment made by this function remains in effec...

Page 154: ...o changes the length of time that device functions wait for commands to be accepted If a device does not accept commands within the time limit the EBUS error will be returned When IBTMO is called and an error does not occur the previous value of ist is stored in IBERR Device IBTMO Function When BD specifies a device the new time limit is used in subsequent device functions directed to that device ...

Page 155: ...l Instruments Corp Device Example 1 Change the time limit for calls involving the device TAPE to approximately 300 msec 100 V 10 110 CALL IBTMO TAPE V Board Example 1 Change the time limit for calls directed to the interface board BRD0 to approximately 10 msec 100 V 7 110 CALL IBTMO BRD0 V ...

Page 156: ...fter a GPIB call If all the bits are set then every GPIB call is trapped MODE determines when the recording and trapping occur The valid values are 1 Turn monitor off No recording or trapping occurs 2 Turn record on All calls are recorded but no trapping occurs 3 Turn record and trap on All calls are recorded and the monitor is displayed whenever a trap condition occurs If an error occurs during t...

Page 157: ...Calls Section Four A GPIB PC User Manual 4A 82 National Instruments Corp Device Example 1 Configure applications monitor to record and trap on SRQ or CMPL 100 MASK H1100 SRQ or CMPL 110 MODE 3 Record and trap on 120 CALL IBTRAP MASK MODE ...

Page 158: ...tion addresses and triggers the specified device then unaddresses all devices on the GPIB IBTRG calls the board IBCMD function to send the following commands Listen address of the device Secondary address of the device if applicable Group Execute Trigger GET and Untalk UNT and Unlisten UNL Other command bytes may be sent as necessary Refer to the IBCMD function for additional information Device Ex...

Page 159: ...ng event to occur The IBWAIT function is used to monitor the events selected in MASK and to delay processing until any of them occur These events and bit assignments are shown in Table 4A 4 IBWAIT also updates all conditions of the status word which may be read in the IBSTA variable If MASK 0 or MASK H8000 the ERR bit the function returns immediately If the TIMO bit is 0 or the time limit is set t...

Page 160: ...Function When BD specifies a device only the ERR TIMO END RQS and CMPL bits of the wait mask and status word are applicable On an IBWAIT for RQS each time the GPIB SRQ line is asserted the access board of the specified device serially polls all devices on its GPIB and saves the responses until the status byte returned by the device being waited for indicates that it was the device requesting servi...

Page 161: ...ples 1 Wait for a service request or a timeout 100 MASK H5000 TIMO SRQI 110 CALL IBWAIT BD MASK 120 REM Check IBSTA here to see which 130 REM occurred 2 Update the current status for IBSTA 100 MASK 0 110 CALL IBWAIT BD MASK 3 Wait indefinitely until control is passed from another CIC 100 MASK H20 CIC 110 CALL IBWAIT BD MASK 4 Wait indefinitely until addressed to talk or listen by another CIC 100 M...

Page 162: ...rd to talk 2 The board IBWRT function is called to write the data to the device as explained in the following discussion 3 The IBCMD function is called to unaddress the access board using the Untalk command and all devices using the Unlisten command Other command bytes may be sent as necessary When the device IBWRT function returns IBSTA holds the latest device status IBCNT is the actual number of...

Page 163: ...ccurs if there are no listeners on the bus when the data bytes are sent Note that if you want to send an EOS character at the end of your data string you must place it there explicitly See Device Example 2 The board IBWRT operation terminates on any of the following events All bytes are transferred Error is detected Time limit is exceeded or Device Clear DCL or Selected Device Clear SDC command is...

Page 164: ...ction bytes to a device at listen address H2F ASCII and then unaddress it the GPIB PC talk address is H40 or ASCII 100 REM Perform addressing 110 CMD UNL MTA LAD 120 CALL IBCMD BRD0 CMD 130 REM Perform board write 140 WRT F3R1X5P2G0 150 CALL IBWRT BRD0 WRT 160 REM Unaddress the Talker and Listener 170 CMD _ UNT UNL 180 CALL IBCMD BRD0 CMD ...

Page 165: ...s after starting the I O operation If the number of bytes to write is small and the bytes are received quickly by the GPIB device 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 ...

Page 166: ...t perform the addressing If the 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 An ENOL error occurs if there are no listeners on the bus when t...

Page 167: ... is not set 200 REM continue processing 210 IF IBSTA AND H100 0 GOTO 130 Board Example 1 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 100 REM Perform addressing in preparation 110 REM for board write 120 CMD UNL MTA LAD 130 CALL IBCMD BRD0 CMD 140 REM Perform board ...

Page 168: ... called to write to the device When the device IBWRTF function returns IBSTA holds the latest device status IBCNT is the actual number of data bytes written to the device modulo 65 536 and IBERR is the first error detected if the ERR bit in IBSTA is set Board IBWRTF Function When BD specifies an interface board the board IBWRT function is called which attempts to write to a GPIB device that is ass...

Page 169: ...f bytes written modulo 65 536 Device Example 1 Write data to the device RDR from the file Y DAT on the current disk drive 100 FLNAME Y DAT 110 CALL IBWRTF RDR FLNAME Board Example 1 Write data to the device at listen address H2C ASCII from the file Y DAT on the current drive and then unaddress the interface board BRD0 100 REM Perform addressing in preparation 110 REM for board write 120 CMD UNL MT...

Page 170: ...nterface board IARR is an integer array from which data is written to the GPIB CNT specifies the maximum number of bytes to be written Write CNT bytes of data from IARR to the GPIB The data stored as two byte integers in IARR is sent in low byte high byte order to the GPIB This is a special case of the IBWRT function which writes a maximum of 255 bytes from a character string to the GPIB This func...

Page 171: ... 150 WRT 4 ASC G ASC 0 256 160 CNT 10 170 CALL IBWRTI DVM WRT 0 CNT QuickBASIC Version 2 0 and 3 0 replace line 170 with CALL IBWRTI PTR VARPTR WRT 0 CNT QuickBASIC Version 4 0 replace line 170 with CALL IBWRTI BD WRT CNT 2 Write 5 instruction bytes from integer array WRT terminated by a carriage return and a linefeed to device PTR Linefeed is the device s eos character 100 DIM WRT 3 110 WRT 0 ASC...

Page 172: ...g 120 CMD UNL MTA LAD 130 CALL IBCMD BRD0 CMD 140 REM Perform board write 150 DIM WRT 4 160 WRT 0 ASC F ASC 3 256 170 WRT 1 ASC R ASC 1 256 180 WRT 2 ASC X ASC 5 256 190 WRT 3 ASC P ASC 2 256 200 WRT 4 ASC G ASC 0 256 210 CNT 10 220 CALL IBWRTI BRD0 WRT 0 CNT 230 REM Unaddress all Talkers and 240 REM Listeners 250 CMD _ UNT UNL 260 CALL IBCMD BRD0 CMD QuickBASIC Version 2 0 and 3 0 replace line 22...

Page 173: ...es a device or an interface board IARR is an array from which integer data is written CNT specifies the maximum number of bytes to be written Write asynchronously CNT bytes of integer data from IARR to the GPIB The data is sent in low byte high byte order This is a special case of the IBWRTA function which writes in BASICA a maximum of 255 bytes from a character string to the GPIB In QuickBASIC th...

Page 174: ...SC 3 256 120 WRT 1 ASC R ASC 1 256 130 WRT 2 ASC X ASC 5 256 140 WRT 3 ASC P ASC 2 256 150 WRT 4 ASC G ASC 0 256 160 CNT 10 170 CALL IBWRTIA DVM WRT 0 CNT 180 MASK H4100 TIMO CMPL 190 REM Perform other processing here then 200 REM wait for I O completion or timeout 210 CALL IBWAIT DVM MASK 220 REM Check IBSTA to see how the write 230 REM terminated on CMPL END TIMO or 240 REM ERR 250 REM If CMPL i...

Page 175: ...ite 140 DIM WRT 4 150 WRT 0 ASC F ASC 3 256 160 WRT 1 ASC R ASC 1 256 170 WRT 2 ASC X ASC 5 256 180 WRT 3 ASC P ASC 2 256 190 WRT 4 ASC G ASC 0 256 200 CNT 10 210 CALL IBWRTIA BRD0 WRT 0 CNT 220 REM Perform other processing here then 230 REM wait for I O completion or timeout 240 MASK H4100 TIMO CMPL250 260 CALL IBWAIT BRD0 MASK 270 REM Unaddress the Talker and Listener 280 CMD _ UNT UNL 290 CALL ...

Page 176: ...es the format and syntax of the messages used in this example are unique to this device Furthermore the interface messages or bus commands that must be sent to devices will also vary but to a lesser degree The exact sequence of messages to program and to control a particular device are contained in its documentation For example the following sequence of actions is assumed to be necessary to progra...

Page 177: ...d read 16 bytes from the DVM 6 End the session The example programs that follow are based on these assumptions The GPIB PC is the designated System Active Controller of the GPIB There is no change to the GPIB PC default hardware settings 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 desig...

Page 178: ...REM Check for an error on each GPIB call to 210 REM be safe 215 REM 220 IF IBSTA 0 THEN GOTO 3000 230 REM 240 REM Write the function range and trigger 250 REM source instructions to the DVM 255 REM 260 WRT F3R7T3 CALL IBWRT DVM WRT 270 IF IBSTA 0 THEN GOTO 3000 280 REM 290 REM Trigger the device 295 REM 300 CALL IBTRG DVM 310 IF IBSTA 0 THEN GOTO 3000 320 REM 330 REM Wait for the DVM to set RQS or...

Page 179: ...M 585 CALL IBCLR DVM 590 V 0 CALL IBONL DVM V STOP 2000 REM A routine at this location would 2010 REM notify you that the IBFIND call 2020 REM failed and refer you to the handler 2030 REM software configuration procedures 2040 PRINT IBFIND ERROR STOP 3000 REM An error checking routine at this 3010 REM location would among other things 3020 REM check IBERR to determine the exact 3030 REM cause of t...

Page 180: ...IBSIC BRD0 190 REM 200 REM Check for an error on each GPIB call 215 REM 220 IF IBSTA 0 THEN GOTO 3000 230 REM 240 REM Turn on the Remote Enable REN signal 245 REM 250 V 1 CALL IBSRE BRD0 V 260 IF IBSTA 0 THEN GOTO 3000 270 REM 280 REM Inhibit front panel control with the 290 REM Local Lockout LLO command place the 300 REM DVM in remote mode by addressing it to 310 REM listen send the Device Clear ...

Page 181: ... REM Poll Enable SPE command then send the 610 REM DVM s talk address and the GPIB PC listen 615 REM address H20 ASCII space 620 REM 630 CMD _ CHR H18 C 640 CALL IBCMD BRD0 CMD 650 IF IBSTA 0 THEN GOTO 3000 660 REM 670 REM Now read the status byte If it is HC0 680 REM the DVM has valid data to send 690 REM otherwise it has a fault condition to 695 REM report 700 REM 710 RD SPACE 1 CALL IBRD BRD0 R...

Page 182: ...at this location would 2010 REM notify you that the IBFIND call 2015 REM failed and refer you to the handler 2020 REM software configuration procedures 2040 PRINT IBFIND ERROR STOP 3000 REM An error checking routine at this 3010 REM location would among other things 3020 REM check IBERR to determine the exact 3015 REM cause of the error condition and then 3030 REM take action appropriate to the 30...

Page 183: ...REM Check for an error on each GPIB call REM to be safe REM IF IBSTA 0 THEN GOSUB GPIB ERROR REM REM Write the function range and trigger REM source instructions to the DVM REM WRT F3R7T3 CALL IBWRT DVM WRT IF IBSTA 0 THEN GOSUB GPIB ERROR REM REM Trigger the device REM CALL IBTRG DVM IF IBSTA 0 THEN GOSUB GPIB ERROR REM REM Wait for the DVM to set RQS or for a REM timeout if the current time limi...

Page 184: ... programming sequence REM reset the device and call IBONL REM to place the device offline REM CALL IBCLR DVM V 0 CALL IBONL DVM V STOP END IBFIND ERROR REM A routine at this location would notify REM you that the IBFIND call failed and REM refer you to the handler software REM configuration procedures PRINT IBFIND ERROR STOP GPIB ERROR REM An error checking routine at this REM location would among...

Page 185: ...lls Section Four A GPIB PC User Manual 4A 110 National Instruments Corp DEVICE ERROR REM A routine at this location would analyze REM the fault code returned in the DVM s status REM byte and take appropriate action PRINT DVM ERROR STOP END ...

Page 186: ...devices REM CALL IBSIC BRD0 REM REM Check for an error on each GPIB call REM to be safe REM IF IBSTA 0 THEN GOSUB GPIB ERROR REM REM Turn on the Remote Enable REN signal REM V 1 CALL IBSRE BRD0 V IF IBSTA 0 THEN GOSUB GPIB ERROR REM REM Inhibit fron panel control with the REM Local Lockout LLO command place the REM DVM in remote by addressing it to listen REM send the Device Clear DCL message to c...

Page 187: ...oll REM First unaddress bus devices and send REM the Serial Poll Enable SPE command REM then send the DVM s talk address and REM the GPIB0 listen address H20 ASCII REM space REM CMD _ CHR H18 C CALL IBCMD BRD0 CMD IF IBSTA 0 THEN GOSUB GPIB ERROR REM REM Now read the status byte If it is REM HC0 the DVM has a valid data to send REM otherwise it has a fault condition REM to report REM RD SPACE 1 CA...

Page 188: ...L BRD0 V STOP END FIND ERROR REM A routine at this location would REM notify you that the IBFIND call REM failed and refer you to the REM handler software configuration REM procedures PRINT IBFIND ERROR STOP GPIB ERROR REM An error checking routine at this REM location would among other things REM check IBERR to determine the exact REM cause of the error condition and REM then take action appropri...

Page 189: ...er can send data and GPIB commands to a device from the keyboard and display data on the screen received from a device After each GPIB PC function is executed the numeric value and mnemonic representation of the status word IBSTA is displayed The byte count IBCNT and error code IBERR are also shown when appropriate This interactive method of data input and data status output is designed to help yo...

Page 190: ...GPIB PC ibic National Instruments Interface Bus Interactive Control Program IBIC Copyright c 1984 National Instru ments Inc All Rights Reserved Type help for help Use IBFIND to initially open a boa rd or device Use SET to select an already opene d board or device Messages will appear on the screen that give you information about the HELP IBFIND and SET commands The first input prompt to IBIC is a ...

Page 191: ...irst use IBFIND to open the device or board you wish to use When the device or board is opened the symbolic name of that device or board is added to the prompt The following examples show IBFIND opening dev1 Example 1 and gpib0 Example 2 The user s inputs are italicized Example 1 ibfind dev1 dev1 Example 2 ibfind gpib0 gpib0 The name used with the IBFIND function must be a valid symbolic name know...

Page 192: ...mmand sends the string F3R5T1 to device called dev1 The returned Status Word 0100 indicates a successful I O completion while the Byte Count indicates that all six characters were sent from the computer and received by the device Using IBRD The IBRD command causes a GPIB device to receive data from another GPIB device The following example illustrates the use of the IBRD function Example N D C V 0...

Page 193: ...quire special termination characters or End of String EOS characters to indicate to the device the end of transmission If your device requires any EOS characters you must add these to the end of the data string sent out by the IBWRT statement The following example illustrates the addition of the two most commonly used EOS characters the carriage return and the linefeed Example dev1 0100 cmpl count...

Page 194: ...ned device or board to access SET changes the prompt to the new symbolic name Example dev1 plotter set plotter This example assumes that IBCONF was used to give a device the name plotter The following example summarizes the use of IBFIND and SET in a typical program Example dev1 plotter ibwrt F3T7G0 0100 cmpl count 6 plotter set dev1 dev1 ibwrt X7Y39G0 0100 cmpl count 7 dev1 ibfind plotter ibfind ...

Page 195: ...ng languages of Section Four differ in the syntax of the function call These differences are shown in Table 5 1 The main differences are that IBWRT IBWRTA IBCMD and IBCMDA messages are entered as strings from the keyboard The BD unit descriptor is not explicitly a part of IBIC function syntax Before using any device or board first call IBFIND to open that unit and to pass the unit descriptor to IB...

Page 196: ...r d Send commands from string ibcmd string b 4 Send commands asynch from string ibcmda string b 4 Enable disable DMA ibdma v b 2 3 Change disable EOS message ibeos v db 2 3 Enable disable END message ibeot v db 2 3 Return unit desciptor ibfind bdname db 5 Go from active controller to standby ibgts v b 2 3 Set clear ist ibist v b 2 3 Go to local iblo db Place device online or offline ibonl v db 2 3...

Page 197: ...square brackets are optional The default value is 0 for ibwait and 1 for all other functions 3 v is a hex octal or decimal integer Hex numbers must be preceded by zero and x e g 0xD Octal numbers must be preceded by zero only e g 015 Other numbers are assumed to be decimal 4 string consists of a list of ASCII characters octal or hex bytes or special symbols The entire sequence of characters must b...

Page 198: ...he DOS pathname of the file to be read or written e g test meter or printr buf 8 mask is a hex octal or decimal integer see note 3 or a mask bit mnemonic Status Word All IBIC functions return the status word IBSTA in two forms a hex value in square brackets and a list of mnemonics in parentheses Example dev1 900 rqs cmpl COUNT 5 dev1 ibwrt f2t3x In this example the status word shows that the devic...

Page 199: ...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 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 ...

Page 200: ...name 1 2 Display help information help option 3 Repeat previous function Turn OFF display Turn ON display Execute function n times n function 4 Execute previous function n times n Execute indirect file filename 5 Display string on screen print string 6 Exit or quit e Exit or quit q Notes 1 bdname is the symbolic name of the new device or board for example ibfind dev1 or set gpib0 2 Call IBFIND ini...

Page 201: ...e carriage return and linefeed characters into the string as shown in this string F3R5T1 r n Since the carriage return can be represented equally well in hex xD and r are equivalent strings SET Select Device or Board 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...

Page 202: ...reen Image Comments gpib0 ibsic Send Interface Clear 130 cmpl cic atn gpib0 Repeat ibsic 130 cmpl cic atn gpib0 Repeat ibsic again 130 cmpl cic atn 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 ...

Page 203: ...d The following example shows how the and functions are used Twenty four consecutive letters of the alphabet are read from a device using three IBRD calls Example dev1 4100 end cmpl COUNT 8 61 62 63 64 65 66 67 68 a b c d e f g h dev1 dev1 dev1 dev1 4100 end cmpl COUNT 8 71 72 73 74 75 76 77 78 q r s t u v w x ibrd 8 ibrd 8 ibrd 8 ...

Page 204: ...mple the message Hello will be sent to the printer five times Example printer 5 ibwrt Hello The function name can be replaced with the function Thus if this example is done the following way the word Hello will be sent 20 more times then 10 more times Example printer printer 20 10 Notice that the multiplier does not become part of the function name that is ibwrt Hello is repeated 20 times not 5 ib...

Page 205: ...same way This function reads the specified indirect file and executes the IBIC functions in sequence as if they were entered in that order from the keyboard Example gpib0 usrfile executes the IBIC functions listed in the file usrfile and gpib0 3 usrfile repeats that operation three times The display mode in effect before this function is executed is restored afterward but may be changed by functio...

Page 206: ...ello dev1 and goodbye print hello print and r n x67 x6f x6f x64 x62 x79 x65 PRINT can be used to display comments from indirect files The print strings will appear even if the display is suppressed with the function The second PRINT example illustrates the use of hex values in IBIC strings E or Q exit or quit The DOS exit command or the IBIC function E or Q returns you to DOS ...

Page 207: ...rogram 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 the device name which was given to the device in the IBCONF program Example DVM ibfind dvm Clear the device The user should check for ERR after each GPIB function call to be safe Ex...

Page 208: ...ange and trigger source instructions to the DVM Example DVM 0100 cmpl count 6 ibwrt F3R7T3 Trigger the device Example DVM 0100 cmpl ibtrg Wait for the DVM to request service or for a timeout if the current timeout limit is too short use ibtmo to change it Example DVM 800 rqs ibwait TIMO RQS ...

Page 209: ...ll status byte will vary depending on the device used Example DVM 0100 cmpl Poll 0x40 decimal 32 ibrsp The read command displays the data on the screen both in hex values and their ASCII equivalents Example DVM 0100 cmpl count 18 4E 44 43 56 20 30 30 30 N D C V 0 0 0 2E 30 30 34 37 45 28 30 0 0 4 7 E 0 OA OA ibrd 18 ...

Page 210: ... Function Calls Make the interface board the current board Example ibfind gpib0 GPIB0 Send the interface clear message IFC to all devices This clears the bus and asserts attention ATN on the bus The user should check for ERR after each GPIB function call to be safe Example GPIB0 0130 cmpl cic atn ibsic ...

Page 211: ... bus addressing The character represents the 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 In a similar manner the character represents the listen address of the device which in this case is assumed to b...

Page 212: ...ng with the sample program Example GPIB0 01A8 cmpl lok cic tacs count 6 ibwrt F3R7T3 Send the group execute trigger message GET to trigger a measurement reading The GET message is represented by the hex value 8 Example GPIB0 0188 cmpl lok cic atn tacs count 1 ibcmd x08 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 ...

Page 213: ...lk UNT characters respectively and reset the address The hex value 18 represents the serial poll enable function while the A represents the device s talk address Example GPIB ibcmd _ x18A Read the status byte The status byte returned may vary depending on the device used Example GPIB0 01E4 cmpl lok rem cic atn lacs count 1 50P ibrd 1 Complete the serial poll by sending the serial poll disable mess...

Page 214: ...B PC are still addressed to talk and to listen the measurement can be read Example GPIB0 01E4 cmpl lok rem cic lacs 0D 0A 4E 44 43 56 2D 30 N D C V 0 30 30 2E 30 30 34 37 450 0 0 0 4 7 E 2B 30 0D 0A 0 ibrd 20 To close out a programming sequence send the interface clear message IFC to initialize the bus Example GPIB 0160 cmpl lok rem cic ibsic Return to DOS ...

Page 215: ...Section Five IBIC National Instruments Corp 5 27 GPIB PC User Manual Example GPIB0 e ...

Page 216: ...ariables and other pertinent data You may select the trap so that it occurs on return from every GPIB handler call returns only on those calls which return an error indication or occurs only on those calls which are returned with particular bit patterns in the GPIB status word While trapped you will see a popup screen Figure 6 1 that provides details of the call being trapped In addition you can v...

Page 217: ...ll remain resident in memory until you reboot the system Should you later desire that you no longer wish to devote memory to the resident applications monitor simply reboot your system the monitor will no longer be loaded IBTRAP The applications monitor provides the capability to trap on GPIB handler calls which have particular bits set in the GPIB status word The trap options are set by the speci...

Page 218: ... GPIB calls err GPIB error timo timeout end GPIB PC detected END or EOS srqi SRQ on rqs device requesting service cmpl I O completed lok GPIB PC is in Lockout State rem GPIB PC is in Remote State cic GPIB PC is Controller In Charge atn attention is asserted tacs GPIB PC is Talker lacs GPIB PC is Listener dtas GPIB PC is in Device Trigger State dcas GPIB PC is in Device Clear State ...

Page 219: ...iguration By selecting various flags for the mask and monitor parameters you may achieve a variety of trapping configurations The following are some examples IBTRAP cic atn dis record all GPIB handler calls and display the monitor whenever attention is asserted or the GPIB PC Controller in Charge IBTRAP srq rec record all GPIB handler calls and set the trap mask to trap when SRQ is on Do not displ...

Page 220: ...t have a count as their third parameter this contains its value otherwise it is undefined IBSTA contains the GPIB status information IBERR contains the GPIB error information or the previous value of the value parameter if no error occurred IBCNT contains the number of bytes transferred Buffer for functions that have a buffer as a parameter this Value displays its contents Each byte of the buffer ...

Page 221: ...IBIC Section Six GPIB PC User Manual 6 6 National Instruments Corp NOTE All numbers are displayed in hexadecimal Also the monitor is unable to record IBFIND or IBTRAP calls ...

Page 222: ...ations program F2 display session summary F5 configure trap mask F6 configure monitor mode F7 hide show monitor F8 clear session summary buffer F10 display command key list Cursor Up scroll buffer up one character Cursor Down scroll buffer down one character Page Up scroll buffer up one page Page Down scroll buffer down one page Home scroll to beginning of buffer End scroll to end of buffer ...

Page 223: ...rent configuration of the trap mask It yields a popup menu with each of the status bits displayed along with their current state either ON or OFF Use the UP and DOWN arrow keys to highlight the desired bit and press F1 to toggle its state Pressing ENTER will record the changes Pressing ESCAPE will cancel this action and leave the mask unchanged Selecting all bits has the effect of trapping on ever...

Page 224: ...PC User Manual Hiding and Showing the Monitor Pressing F7 will hide the monitor and restore the contents of the screen This allows you to view program output written to the screen while active within the monitor Pressing F7 again will restore the monitor ...

Page 225: ...ultiline Interface Messages The following tables are multiline interface messages sent and received with ATN TRUE The subsequent pages contain an interface message reference list which describes the mnemonics and messages which correspond to the interface functions ...

Page 226: ...LF 2A 052 42 MLA10 0B 013 11 VT 2B 053 43 MLA11 0C 014 12 FF 2C 054 44 MLA12 0D 015 13 CR 2D 055 45 MLA13 0E 016 14 SO 2E 056 46 MLA14 0F 017 15 SI 2F 057 47 MLA15 10 020 16 DLE 30 060 48 0 MLA16 11 021 17 DC1 LLO 31 061 49 1 MLA17 12 022 18 DC2 32 062 50 2 MLA18 13 023 19 DC3 33 063 51 3 MLA19 14 024 20 DC4 DCL 34 064 52 4 MLA20 15 025 21 NAK PPU 35 065 53 5 MLA21 16 026 22 SYN 36 066 54 6 MLA22 ...

Page 227: ...153 107 k MSA11 PPE 4C 114 76 L MTA12 6C 154 108 l MSA12 PPE 4D 115 77 M MTA13 6D 155 109 m MSA13 PPE 4E 116 78 N MTA14 6E 156 110 n MSA14 PPE 4F 117 79 O MTA15 6F 157 111 o MSA15 PPE 50 120 80 P MTA16 70 160 112 p MSA16 PPD 51 121 81 Q MTA17 71 161 113 q MSA17 PPD 52 122 82 R MTA18 72 162 114 r MSA18 PPD 53 123 83 S MTA19 73 163 115 s MSA19 PPD 54 124 84 T MTA20 74 164 116 t MSA20 PPD 55 125 85 U...

Page 228: ...mote enable C tca take control asynchronously C tcs take control synchronously AH C ton talk only T TE REMOTE MESSAGES RECEIVED ATN attention SH AH T TE L LE PP C DAB data byte via L LE DAC data accepted SH DAV data valid AH DCL device clear DC END end via L LE GET group execute trigger DT GTL go to local R L IDY identify L LE PP IFC interface clear T TE L LE C LLO local lockout R L MLA my listen ...

Page 229: ...ear via C END end via T GET group execute trigger via C GTL go to local via C IDY identify C IFC interface clear C LLO local lockout via C MLA or MLA my listen address via C MSA or MSA my secondary address via C MTA or MTA my talk address via C OSA other secondary address via C OTA other talk address via C PCG primary command group via C PPC parallel poll configure via C PPD parallel poll disable ...

Page 230: ...CONFIG SYS and IBCONF EXE are in the root directory of your boot drive Enter DIR from the boot drive and verify that these files exist Check that CONFIG SYS contains the line DEVICE GPIB COM Enter TYPE CONFIG SYS from the boot drive and verify that the line exists there Reboot your system after you install the software ECIC 1 Error Condition Function requires GPIB PC to be Controller In Charge Sol...

Page 231: ...the device s address including secondary address is correct If a change is made reboot the system Then run IBIC to verify that the address is correct as follows Open the device you want to write to using IBFIND and execute IBPAD and IBSAD calls passing each the address value you believe is correct If secondary addressing is not used pass a value of zero to the IBSAD function Assuming these calls d...

Page 232: ...ling IBGTS with the shadow handshake feature call IBCMD to ensure that the GPIB ATN line is asserted EARG 4 Error Condition Invalid argument to function call Solutions Errors received from IBIC Verify syntax in Section Five Make sure the address of the board in IBCONF does not conflict with that of a device Errors received when running your application program Verify syntax in Section Four Make su...

Page 233: ...cable connections Errors received from IBRD Some devices will not send data unless they have received data telling them what to send This is caused by devices having the capability of sending several types of data Issue an IBWRT to set up the device and then an IBRD to receive the information If you have not changed any of the default EOS or EOI settings in IBCONF the reads will terminate when the...

Page 234: ... or writes call IBWAIT to wait for CMPL status before making another call ECAP 11 Error Condition No capability for operation Solution Run IBCONF and verify that the capability to do a particular call is enabled e g you must be System Controller to execute the IBSRE function Check both device and board capabilities Reboot after leaving IBCONF if you made any changes EFSO 12 Error Condition File sy...

Page 235: ...re often to read the status bytes Ignore ESTB ESRQ 16 Error Condition SRQ stuck in the ON position Solutions Ignore ESRQ until all devices are found It occurred because the device asserting SRQ was not opened with IBFIND The automatic serial polling polls only the opened devices Check that you have used IBFIND to open all devices on the GPIB that could assert SRQ Remove any device from the bus if ...

Page 236: ... confirm that the board s DMA channel and interrupt line match the hardware settings Then run IBTEST after rebooting Also check that the DMA channel and interrupt line do not conflict with other devices in the computer Check that the time limit is not set to zero which results in infinite time limits To do this run IBCONF and look at the time limit value both for your device and your board Or from...

Page 237: ...mputer crashes Solutions Run IBCONF and confirm that the board s DMA channel and interrupt line match the hardware settings Also check that the DMA channel and interrupt line do not conflict with other devices in the computer Configure the hardware and software to not use DMA and or interrupts You may have a PC compatible that is not totally compatible Check that none of your device names is the s...

Page 238: ...ction contains the proper delimiters and message termination characters For example some devices require a carriage return and or a linefeed character before they will execute the instruction Other devices require special characters to separate multiple instruction messages Your instruction manual may be incomplete or ambiguous so try several possible combinations When running a program check for ...

Page 239: ...faster Among other things this program creates or modifies your CONFIG SYS file IBCONF used to do this Configuration Program In Rev C the configuration program IBCONF EXE is streamlined and is easier to use It no longer modifies CONFIG SYS since the start up program now does this The Automatic Serial Poll and Lockout features are now configurable at the board level Interface Bus Interactive Contro...

Page 240: ...supported in Rev B it will need to be modified to work with Rev C This is because Rev C language interfaces use a new faster method of entering the handler General The Rev C software package as a whole has been modified to allow it to run with a variety of 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 de...

Page 241: ... lockout configuration setting Therefore Rev D does not place devices in lockout 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 If no other conditions exist the function returns immediately DCAS and DTAS Status Bits In ...

Page 242: ...you to change predefined device names and addresses Your software internally calls a DOS device driver which corresponds to the port where it expects to find the printer If you define in IBCONF the device name your software expects this should fool DOS and send the data to the GPIB device The following examples demonstrate the use of parallel port redirection LPT1 but could also be used for serial...

Page 243: ...g your Printer with the GPIB PC Appendix D GPIB PC User Manual D 2 National Instruments Corp Examples System PRINT FILE COPY FILE LPT1 BASIC 10 LPRINT hello 10 OPEN LPT1 FOR OUTPUT AS 1 20 PRINT 1 it works ...

Page 244: ...ers Configure one computer as system controller and the second as a device or non system controller On the master computer run the IBCONF program rename DEV1 to SLAVE ensure the primary address is set to 1 and set Board Is System Controller to YES On the second computer run the IBCONF program set Board Is System Controller to NO and set the primary address of GPIB0 to 1 Exit the IBCONF programs an...

Page 245: ...st press RETURN on the slave before you press RETURN on the master Example Master Slave SLAVE GPIB0 ibwrt hello ibrd 5 The master sends a data string to the slave which should appear as follows Master Slave 0100 cmpl Count 5 hello Count 5 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 sec...

Page 246: ...arters 512 795 8248 Technical support fax 800 328 2203 512 794 5678 Branch Offices Phone Number Fax Number Australia 03 879 9422 03 879 9179 Austria 0662 435986 0662 437010 19 Belgium 02 757 00 20 02 757 03 11 Denmark 45 76 26 00 45 76 71 11 Finland 90 527 2321 90 502 2930 France 1 48 14 24 00 1 48 14 24 14 Germany 089 741 31 30 089 714 60 35 Italy 02 48301892 02 48301915 Japan 03 3788 1921 03 378...

Page 247: ...upplied 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 continues ...

Page 248: ...be the errors Thank you for your help Name Title Company Address Phone Mail to Technical Publications National Instruments Corporation 6504 Bridge Point Parkway MS 53 02 Austin TX 78730 5039 Fax to Technical Publications National Instruments Corporation MS 53 02 512 794 5678 ...

Page 249: ...IAL POLLING A feature of the GPIB PC software in which serial polls are executed automatically by the handler whenever a device asserts the GPIB SRQ line BD A variable name and first argument of each function call that contains the unit descriptor of the 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 ...

Page 250: ...AV or DATA VALID One of the three GPIB handshake lines See Handshake DCL or DEVICE CLEAR A GPIB command used to reset the device or internal functions of all devices See IFC and SDC DECLARATION FILE A GPIB PC file that contains code that must be placed at the beginning of an application program to allow it to properly access the handler DECL BAS is the Declaration File for programs written in Inte...

Page 251: ...E INTERFACE BUS The common name for the communications interface system defined in IEEE Std 488 Hewlett Packard the inventor of the bus calls it the HP IB 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 GPIB PC The name for the ...

Page 252: ...global variable that is updated at the end of each function call with important status information such as the occurrence of an error IBSTART BAT The GPIB PC installation program IBTEST BAT The GPIB PC diagnostic program IFC or INTERFACE CLEAR A GPIB line used by the System Controller to initialize the bus See DCL and SDC INTERFACE MESSAGE A broadcast message sent from the Controller to all device...

Page 253: ...or MY TALK ADDRESS A GPIB command used to address a device to be a Talker There are 31 of these primary addresses MSA or MY SECONDARY ADDRESS A GPIB command used to address a device to be a Listener or a Talker when extended two byte addressing is used The complete address is a MLA or MTA address followed by an MSA address There are 31 of these secondary addresses for a total of 961 distinct liste...

Page 254: ...ng to program instructions See DMA REN or REMOTE ENABLE A GPIB line controlled by the System Controller but used by the CIC to place devices in remote program mode ROOT DIRECTORY The top level directory on a floppy or hard disk SDC or SELECTED DEVICE CLEAR A GPIB command used to reset internal or device functions of an addressed Listener See DCL and IFC SERIAL POLL The process of polling and readi...

Page 255: ...asserted T1 ranges from 350 nsec to above 2 µsec TAD or TALK ADDRESS See MTA TALKER A GPIB device that sends data messages to Listeners 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 TLC An integrat...

Page 256: ...7 Auto serial polling Boards Only disable 2 15 Automatic serial polling 4 13 Auxiliary IBIC functions 5 12 B 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 DMA Channel 2 16 functions purpose of 3 9 3 14 Internal Clock Frequency 2 16 Primary GPIB Address 2 12 Secondary GPIB Addr...

Page 257: ...nt variable 4 11 D Data lines 1 3 Data transfer termination method 4A 26 Default characteristics functions that alter 2 17 Default configurations 2 8 Primary 2 8 Device characteristics 2 12 clearing 3 4 function calls 4 12 functions 3 14 Primary GPIB Address 2 12 Secondary GPIB Address 2 12 Timeout Settings 2 12 Device map for board GPIBx upper level 2 10 Device map concepts and terms 2 11 Device ...

Page 258: ...er default characteristics 2 17 auxiliary 5 12 MC GPIB 5 7 high level 3 1 low level 3 1 G General programming information 4 1 Glossary F 1 GPIB address primary 2 12 address secondary 2 12 characteristics electrical 1 5 physical 1 5 clearing 3 4 configuration requirements 1 9 connector and the signal assignment 1 6 data lines 1 3 error codes 4 6 functions 5 7 messages 1 1 operation 1 1 data lines 1...

Page 259: ...3 3 Clearing the Device vs Clearing the GPIB 3 4 Group III 3 5 Group IV 3 8 Group V 3 15 Group VI 3 17 H Handshake lines 1 3 Hard disk boot 2 3 Hardware installation 2 1 HELP Display Help Information 5 13 High level functions 3 1 High speed timing Boards Only 2 15 I IBCONF exiting 2 16 how to run 2 9 more about 2 6 lower levels 2 11 upper levels 2 10 ibconf m 2 9 IBFIND 5 3 3 3 3 10 IBIC Auxiliary...

Page 260: ...n OFF Display 5 14 Turn ON Display 5 15 using HELP 5 3 5 13 IBFIND 5 3 IBRD 5 4 IBWRT 5 4 SET 5 6 5 13 IBSTART how to run 2 4 IBTRAP description 6 2 Installing the Applications Monitor 6 2 Installation hardware 2 1 Installation software 2 3 Instruments characteristics of 2 7 Interface management lines 1 4 Interrupt jumper setting Boards Only 2 15 L Linear configuration 1 7 Local Lockout on all Dev...

Page 261: ...isplay the ASCII string 5 18 Printer installation D 1 Programming preparations 4A 3 4A 4 Purpose of board functions 3 9 Q QuickBASIC Files 4A 2 GPIB PC I O Functions 4A 5 Programming Preparations 4A 4 ON SRQ 4A 6 R Read termination 4 11 Reboot 2 5 Remote mode device 3 4 Repeat function n times n 5 16 Repeat previous function 5 14 Requirements configuration 1 9 Running IBIC 5 2 S Secondary GPIB add...

Page 262: ...ord 4 2 5 10 Syntax 3 1 System Controller 1 2 T Talkers Listeners and Controllers 1 1 Timeout setting 2 12 Timing high speed Boards Only 2 15 Turn OFF display 5 14 Turn ON display 5 15 U Upper and lower levels of IBCONF 2 10 Upper level device map for board GPIBx 2 10 Using your GPIB PC 2 18 Using your Printer with the MC GPIB D 1 W Wait mask layout 4A 84 Write termination 4 11 ...

Reviews: