Home

GPIB-PC User Manual for the IBM PCs

image

Contents

1. QuickBASIC Example Program Board Important Programming Note ee eeeseeseseeteseseeeeees 5 5 Using SED hennie i i ei 5 6 IBIC Functions and SyntaX essesesseesssessssesseresssssesssreresssresssrreresseresssreere 5 7 Other IBIC Functions and SyntaX ssesessseeeesseseseeeseesresssterreesseseseeeseees 5 8 Status Wordenin 5 10 Error Code aia a Era E E R 5 11 National Instruments Corp xiii GPIB PC User Manual Contents Byte Coulis nerenin a i AEN E E EEKE A Xiliary FUNCIONS SET Select Device or Board HELP Display Help Information Repeat Previous FUNCTION eesseccsssceneeeseecsneerees Tum OFF Display sssssvciisiecsctsscisssscessssssesresersestestscnsenselss Turn ON Display nirin n Repeat Function n Times tak Execute Indirect File PRINT Display the ASCII String E or Q exit OF QUIt ee eeeceseceeseeeseeeeeee 5 18 IBIC Sample Programs eressersesssesessessoreosorsoroesessroeessnserornessereceesse 5 19 Device Function Calls sss sssesssesesesssesesssssesessereresssrsrsess 5 19 Board Function Calls eeeeeesseeesesssseesseeresssssesssserrssssessssee 5 22 Section Six Applications Monitor 11119111111111911111111011 6 1 Installing the Applications Monitor se sssssesssrsesessseresesersreesssesrseses 6 2 BRAR a nih n N e E A EAA 6 2 Applications Monitor OptionSs e seessesesse
2. It is generally not necessary to use the IBCAC function in most applications Functions such as IBCMD and IBRPP which require that the GPIB PC take control do so automatically The ECIC error results if the GPIB PC is not CIC Board Examples 1 Take control immediately without regard to any data handshake in progress 100 110 120 130 140 VS 0 CALL IBCAC BRD0 V REM IBSTA should show that the REM interface board is now CAC i e REM CIC with ATN asserted National Instruments Corp 4A 17 GPIB PC User Manual BASICA QuickBASIC GPIB PC Function Calls Section Four A 2 Take control synchronously and assert ATN following a read operation 100 CALL IBRD BRDO RDS 110 V 1 120 CALL IBCAC BRD0 V GPIB PC User Manual 4A 18 National Instruments Corp Section Four A BASICA QuickBASIC GPIB PC Function Calls BASICA QuickBASIC BASICA QuickB ASIC IBCLR IBCLR Purpose Clear specified device Format CALL IBCLR BD Remarks BD specifies a device The IBCLR function clears the internal or device functions of a specified device On exit all devices are unaddressed IBCLR calls the board IBCMD function to send the following commands using the designated access board e Listen address of the device e Secondary address of the device if applicable e Selected Device Clear SDC and e Untalk UNT and Unlisten UNL Other command bytes may be sent as necessary Refer to IBCM
3. 100 110 120 130 140 150 160 170 180 190 200 DVM is a name assigned using IBCONF GPIBO is a factory default board name which cannot be changed NAMES DVM LL IBFIND BDNAMES DVM This call to IBBNA establishes GPIBO as the access board for the device DVM NAMES GPIBO CALL IBBNA DVM BNAMES ip U B a AE A a e R R R R B C R R R B GPIB PC User Manual 4A 16 National Instruments Corp Section Four A BASICA QuickBASIC GPIB PC Function Calls BASICA QuickBASIC BASICA QuickB ASIC IBCAC IBCAC Purpose Become Active Controller Format CALL IBCAC BD V Remarks BD specifies an interface board If V is non zero the GPIB PC takes control synchronously with respect to data transfer operations otherwise the GPIB PC takes control immediately and possibly asynchronously To take control synchronously the GPIB PC asserts the ATN signal in such a way as to ensure that data being transferred on the GPIB is not corrupted If a data handshake is in progress the take control action is postponed until the handshake is complete if a handshake is not in progress the take control action is done immediately Synchronous take control is not guaranteed if an IBRD or IBWRT operation completed with a timeout or error Asynchronous take control should be used in situations where it appears to be impossible to gain control synchronously e g after a timeout error
4. Section Five IBIC Turn on the remote enable signal REN Example GPIBO ibsre 1 0130 cmpl cic atn previous value 0 Set up the addressing for the device to listen and the computer to talk The question mark and underscore _ characters represent the unlisten UNL and untalk UNT commands respectively These must be sent first in every IBCMD function to reset the 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 be at GPIB primary address 1 The Multiline Interface Command chart indicates that the listen address for a device at primary address of 1 is an character Example GPIB ibcmd _ 0188 cmpl lok cic atn tacs count 4 National Instruments Corp 5 23 GPIB PC User Manual IBIC Section Five Write the function range and trigger source instructions to the DVM Be sure an error has not occurred before proceeding with the sample program Example GPIBO ibwrt F3R7T3 01A8 cmpl lok cic tacs count 6 Send the group execute trigger message GET to trigger a measurement reading The GET message is represented by the hex value
5. 170 171 172 173 174 175 176 177 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 oP BTR ES ea o a e eo g lt et4 Hos me TONS x DEL MSAO PPE MSA1 PPE MSA2 PPE MSA3 PPE MSA4 PPE MSA5 PPE MSA6 PPE MSA7 PPE MSA8 PPE MSA9 PPE MSA10 PPE MSA11 PPE MSA12 PPE MSA13 PPE MSA14 PPE MSA15 PPE MSA16 PPD MSA17 PPD MSA18 PPD MSA19 PPD MSA20 PPD MSA21 PPD MSA22 PPD MSA23 PPD MSA24 PPD MSA25 PPD MSA26 PPD MSA27 PPD MSA28 PPD MSA29 PPD MSA30 PPD GPIB PC User Manual Multiline Interface Messages Mnemonic Appendix A Interface Message Reference List Message Interface Function s LOCAL MESSAGES RECEIVED by interface functions gts ist lon Ipe Itn lun nba pon rdy rpp rsc TSV rtl sic sre tca tes ton go to standby individual status qualifier listen only local poll enable listen local unlisten new byte available power on ready request parallel poll request system control request service return to local send interface clear send remote enable take control asynchronously take control synchronously talk only REMOTE MESSAGES RECEIVED ATN DAB DAC DAV DCL END GET GTL DY IFC LLO MLA MLA MSA or MSA MTA MTA OSA OTA PCG PPC PPD PPE PPRn PPU GPIB PC User Manual attention data byte data accepted data val
6. BASICA QuickBASIC GPIB PC I O Functions at the beginning of this section Refer also to IBWRTIA National Instruments Corp 4A 95 GPIB PC User Manual BASICA QuickBASIC GPIB PC Function Calls Section Four A Device Examples 1 Write 10 instruction bytes from the integer array WRT to the device DVMS 100 DIM WRT 4 110 WRT 0 ASC ME ASE 3 256 120 WRT S 1 ASC R ASC 1 256 130 WRT S 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 IBWRTI DVM WRT 0 CNT QuickBASIC Version 2 0 and 3 0 replace line 170 with CALL IBWRTI PTIR VARPTR WRT 0 CNTS QuickBASIC Version 4 0 replace line 170 with CALL IBWRTI BD WRT CNTS 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 S 0 ASC I ASC P 256 120 WRTS 1 ASC 2 ASC X 256 130 WRT S 2 ASC 5 amp HOD 256 140 WRT S 3 amp HOA 150 CNT 7 160 CALL IBWRTI PTR WRT 0 CNT GPIB PC User Manual 4A 96 National Instruments Corp Section Four A BASICA QuickBASIC GPIB PC Function Calls Board Example 1 Write 10 instruction bytes from the integer array WRT toa device at listen address amp H2F ASCII and then unaddress it the GPIB PC talk address is
7. message byte The line is driven by all devices when receiving commands and by Listeners when receiving data messages National Instruments Corp 1 3 GPIB PC User Manual Operation of the GPIB Section One NDAC not data accepted NDAC indicates when a device has or has not accepted a message byte The line is driven by all devices when receiving commands and by Listeners when receiving data messages DAV data valid DAV tells when the signals on the data lines are stable valid and can be accepted safely by devices The Controller drives DAV lines when sending commands and the Talker drives DAV lines when sending data messages Interface Management Lines Five lines are used to manage the flow of information across the interface e ATN e IFC e REN e SRQ and e EOL ATN attention The Controller drives ATN true when it uses the data lines to send commands and false when it allows a Talker to send data messages IFC interface clear The System Controller drives the IFC line to initialize the bus and become CIC REN remote enable The System Controller drives the REN line which is used to place devices in remote or local program mode GPIB PC User Manual 1 4 National Instruments Corp Section One Operation of the GPIB SRQ service request Any device can drive the SRQ line to asynchronously request service from the Controller EOI end or identify The EOI line has two purposes The Talker
8. 1 Change the primary GPIB listen and talk address of the interface board BRDO from the configuration setting to amp H27 and amp H47 respectively 100 V amp H7 Lower 5 bits of GPIB address 110 CALL IBPAD BRDO V National Instruments Corp 4A 43 GPIB PC User Manual BASICA QuickBASIC GPIB PC Function Calls Section Four A BASICA QuickBASIC BASICA QuickB ASIC IBPCT IBPCT Purpose Pass Control Format CALL IBPCT BD Remarks BD specifies a device The IBPCT function passes CIC authority to the specified device from the access board assigned to that device The board automatically goes to Controller Idle State CIDS The function assumes that the device has Controller capability IBPCT calls the board IBCMD function to send the following commands e Talk address of the device e Secondary address of the device if applicable and e Take Control TCT Other command bytes may be sent as necessary Refer to IBCMD for additional information Device Example 1 Pass control to the device IBMXT 100 CALL IBPCT IBMXT GPIB PC User Manual 4A 44 National Instruments Corp Section Four A BASICA QuickBASIC GPIB PC Function Calls BASICA QuickBASIC BASICA QuickB ASIC IBPPC IBPPC Purpose Parallel Poll Configure Format CALL IBPPC BD V Remarks BD specifies a device or an interface board V must be a valid parallel poll enable disable command or zero When IBPPC is called and an e
9. 130 RE Perform board write 140 WRTS F3R1X5P2G0 150 CALL IBWRT BRDO WRTS 160 RE 170 CMDS _ 180 CALL IBCMD BRD0O CMDS GPIB PC User Manual BASICA QuickBASIC GPIB PC Function Calls Section Four A BASICA QuickBASIC BASICA QuickB ASIC IBWRTA IBWRTA Purpose Write data asynchronously from string Format CALL IBWRTA BD WRTS Remarks BD specifies a device or an interface board WRT contains the data to be sent over the GPIB This is a special case of the IBWRTA function which in BASICA writes a maximum of 255 bytes from a character string to the GPIB In QuickBASIC the function IBWRTA writes a maximum of 32K bytes of data from a character string to the GPIB IBWRTA is used in place of IBWRT when the application program must perform other functions while processing the GPIB I O operation IBWRTA returns 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 IBSTAS 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 written is reported in the IBCNT variable Device IBWRTA Function When BD specifies a device the following board ste
10. BASICA Example Program Device BASICA Using device function calls 100 105 110 120 125 130 140 145 150 15 9 160 170 180 185 190 195 200 210 215 220 230 240 250 255 260 270 280 290 295 300 310 320 330 340 350 355 360 370 380 390 400 410 National Instruments Corp N N NNN CY EY BOR Z NA Ae lt NA Xv N N N N N N NN N NA N N NNN N N N N EY EY GY El lt Awe Z t m mi EM EM Zg gZ em lt Z lt ces z g BD CALL IBFIND TE You must merge this code with DECL BAS Assign a unique identifier to device and store in variable DVM NAMES DVM BDNAMES DVM Check for error on IBFIND call DVM lt 0 THEN GOTO 2000 Clear the devic CALL IBCLR DVM IF Check for an error on each GPIB call to be safe IBSTAS lt 0 TH EN GOTO 3000 Write the function range and trigger source instruc WRT F3R7T3 IF IBSTAS lt 0 TH tions to the DVM CALL IBWRT DVM WRTS EN GOTO 3000 Trigger the devic CALL IBTRG DVM IF IBSTAS lt 0 TH EN GOTO 3000 Wait for the DVM to set RQS or for a timeout if the current time limit is too short use IBTMO to change it MASK amp H4800 IBSTAS AND amp HC000 lt gt 0 THEN GOTO 3000 IF CALL IBWAIT DVM MASK Since neither a timeout nor an error occurred IBWA
11. BASICA QuickBASIC GPIB PC Function Calls Section Four A IBONL to cancel the I O and reset the interface The asynchronous I O started by IBCMDA terminates for the same reasons IBCMD terminates An ECIC error results if the GPIB PC is not CIC If it is not Active Controller the GPIB PC takes control and asserts ATN prior to sending the command bytes It remains Active Controller afterward The ENOL error does NOT occur if there are no Listeners Board Example 1 Address several devices for a broadcast message to follow while testing for a high priority event to occur 100 110 120 130 140 150 160 170 180 190 200 210 220 230 240 250 260 270 RE The interface board BRDO at talk RE address amp H40 ASCII addresses RE nine Listeners at addresses amp H31 RE amp H39 ASCII 1 9 to receive the RE broadcast message CMDS 123456789 UNL MTA LAD1 LAD9 CALL IBCMDA BRDO CMDS MASK 4100 Wait for timeout or I O completion CALL EVENTTST Unspecified routine to test and process a high priority event CALL IBWAIT BRD0O MASK REM Loop until complete while no error REM has occurred IF IBSTAS AND amp H100 0 GOTO 180 GPIB PC User Manual 4A 24 National Instruments Corp Section Four A BASICA QuickBASIC GPIB PC Function Calls BASICA QuickBASIC BASICA QuickB ASIC IBDMA IBDMA Purpose Enable or disable DMA Format
12. GPIB PC Functions Overview Section Four RQS d CMPL db LOK b REM b CIC b ATN b TACS b RQS appears only in the status word of a device function call Indicates that the device is requesting service It is set in the status word whenever the hex 40 bit is asserted in the device s serial poll status byte The serial poll which obtains the status byte may be the result of an IBRSP call or it may be done automatically by the handler It is cleared when the user has called IBRSP to read the serial poll status byte that caused the RQS An IBWAIT on RQS should only be done on devices that respond to serial polls CMPL specifies the condition of outstanding I O operations It is set in the status word whenever I O is not in progress that is whenever I O is complete It is cleared while I O is in progress LOK specifies whether the board is in a lockout state While LOK is set the function IBLOC is effectively inoperative for that board It is set whenever the GPIB PC detects the Local Lockout LLO message has been sent either by the GPIB PC or by another Controller It is cleared when the Remote Enable REN GPIB line becomes unasserted either by the GPIB PC or by another Controller REM 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 i
13. IBTMO changes the time limit in which operations with the board must complete IBONL bd v IBONL performs the same initialization function for boards as the Group III IBONL function does for devices In addition the hardware as well as the software is reset and the board is placed online enabled or offline disabled IBSIC bd IBSIC uses the board to initialize the GPIB by sending the Interface Clear IFC message GPIB PC User Manual 3 12 National Instruments Corp Section Three GPIB PC Functions Introduction IBSRE bd v IBSRE uses the board to set or clear the GPIB Remote Enable REN line IBGTS bd v IBGTS causes the board to go from Active Controller to Standby Controller and in so doing to turn the ATN signal off This function is generally used to allow two external devices to talk to each other directly The board can selectively participate in the handshake of the data transfer and hold off the handshake when the END message is detected The board may then take control synchronously without corrupting the transfer IBCAC bd v IBCAC causes the board to take control of the GPIB by setting ATN and going from Standby to Active Controller The board can take control synchronously or asynchronously IBRPP bd buf IBRPP conducts a parallel poll and returns the result IBPPC bd v IBPPC remotely configures or unconfigures the devices for parallel polls National Instruments Corp 3
14. cmp1 National Instruments Corp 5 19 GPIB PC User Manual IBIC Section Five Write the function range and trigger source instructions to the DVM Example DVM ibwrt F3R7T3 0100 cmp1 count 6 Trigger the device Example DVM ibtrg 0100 cmp1 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 ibwait TIMO RQS 800 xrqs GPIB PC User Manual 5 20 National Instruments Corp Section Five IBIC Read the serial poll status byte This serial poll status byte will vary depending on the device used Example DVM ibrsp 0100 cmpl Poll 0x40 decimal 32 The read command displays the data on the screen both in hex values and their ASCII equivalents Example DVM ibrd 18 0100 cmpl count 18 4E 44 43 56 20 30 30 30 NDC V 2E 30 30 34 37 45 28 30 004 OA OA Ho Oo oo 7 National Instruments Corp 5 21 GPIB PC User Manual IBIC Section Five Return to DOS Example DVM e Board Function Calls Make the interface board the current board Example ibfind gpib0O GPIBO 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 GPIBO ibsic 0130 cmpl cic atn GPIB PC User Manual 5 22 National Instruments Corp
15. 0 or amp H7F may be used 110 CALL IBSAD DVM V Board Examples 1 Change the secondary GPIB address of the interface board BRDO from its current value to amp H6A 100 V amp H6A 110 CALL IBSAD BRD0 V 2 Disable secondary addressing for the interface board BRDO 100 V 0 0 or amp H7F may be used 110 CALL IBSAD BRD0O V GPIB PC User Manual 4A 72 National Instruments Corp Section Four A BASICA QuickBASIC GPIB PC Function Calls BASICA QuickBASIC BASICA QuickB ASIC IBSIC IBSIC Purpose Send interface clear for 100 microseconds Format CALL IBSIC BD Remarks BD specifies an interface board The IBSIC function causes the GPIB PC to assert the IFC signal for at least 100 microseconds provided the GPIB PC has System Controller capability This action initializes the GPIB and makes the interface board CIC and Active Controller with ATN asserted and is generally used when a bus fault condition is suspected 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 device documentation The ESAC error occurs if the GPIB PC does not have System Controller capability Refer also to IBRSC Board Example 1 Initialize the GPIB and become CIC and Active Controller at the beginning of a progr
16. 5 IBW IBW D D DI RT or RTI The IBTMO function also 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 IBERRS Device IBTMO Function When BD specifies a device the new time limit is used in subsequent device functions directed Board IBTMO Function to that device When BD specifies a board the new time limit is used in subsequent board functions directed to that board Refer also to IBWAIT and to Table 2 1 National Instruments Corp 4A 79 GPIB PC User Manual BASICA QuickBASIC GPIB PC Function Calls Section Four A 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 ol lt Board Example 1 Change the time limit for calls directed to the interface board BRDO to approximately 10 msec 100 V 7 110 CALL IBTMO BRDO V GPIB PC User Manual 4A 80 National Instruments Corp Section Four A BASICA QuickBASIC GPIB PC Function Calls BASICA QuickBASIC BASICA QuickB ASIC IBTRAP IBTRAP Purpose Alter applications monitor trap and display modes Format CALL IBTRAP MASK DISPLAY S Remarks MASK specifies a bit mask with the same bit assignments as the mask
17. Additional Programs and Files The following additional programs and files include installation test and example programs APPMON COM is the applications monitor program It is a resident program that is useful in debugging sequences of GPIB calls from within your application The applications monitor provides the capability to trap on return from GPIB driver calls allowing you to inspect function arguments buffers return values GPIB global variables and other pertinent data IBTRAP EXE is a program that configures the applications monitor IBSTART BAT is a batch file used for installation and start up It is a multipurpose program that performs the software installation It copies files modifies CONFIG SYS the DOS system configuration file using MKCFG EXE and tests the hardware using IBDIAG EXE IBDIAG EXE is a program that tests the hardware installation before the GPIB software is configured and installed After the handler is installed IBTEST BAT confirms that both the software and hardware are installed and functioning properly The test is executed in two parts using IBTSTA EXE and IBTSTB EXE IBCONF EXE is a software configuration program that allows you to change the software parameters and other data used by the handler IBIC EXE is an interactive control program that allows you to execute the handler functions interactivel
18. CALL IBDMA BD V Remarks BD specifies an interface board If V is non zero DMA transfers between the GPIB PC and memory are used for read and write operations If V is zero programmed I O is used in place of DMA I O If you enabled DMA at configuration time assigning DMA channel 1 2 or 3 this function can be used to switch between programmed I O and DMA using the selected channel If you disabled DMA at configuration time calling this function with V equal to a non zero value results in an ECAP error The assignment made by this function remains in effect until IBDMA is called again the IBONL or IBF IND function is called or the system is rebooted When IBDMA is called and an error does not occur the previous value of V is stored in IBERR On machines without DMA capability calling this function with V 0 has no effect and calling it with a non zero V results in an ECAP error Refer also to Table 2 1 Board Examples 1 Enable DMA transfers using the previously configured channel 100 V 1 Any non zero value will do 110 CALL IBDMA BRDO0 V Disable DMAs and use programmed I O exclusively 100 V 0 110 CALL IBDMA BRD0 V National Instruments Corp 4A 25 GPIB PC User Manual BASICA QuickBASIC GPIB PC Function Calls Section Four A BASICA QuickBASIC BASICA QuickB ASIC IBEOS IBEOS Purpose Change or disable end of string termination mode Format CALL IBEOS BD V
19. EARG 4 Error Condition Invalid argument to function call Solutions e 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 e Errors received when running your application program Verify syntax in Section Four Make sure the address of the board in IBCONF does not conflict with that of a device National Instruments Corp B 3 GPIB PC User Manual Common Errors and Their Solutions Appendix B ESAC 5 Error Condition GPIB PC not System Controller as required Solutions e Run IBCONF and make sure the board GPIBO or GPIB1 is configured to be System Controller e Issue a board IBRSC function call with a value of 1 to request System Control EABO 6 Error Condition I O operation aborted Solutions e Check that the device is powered on e Verify proper cable connections e 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 buffer is full or when EOI is set If your device sends an EOS terminating character such as a carriage return rather than EOI then use IBCONF to change the d
20. RebOOt srini ioina Step 5 Test Software Installation eee 2 5 More About IBCONE cccsssssssssssisssesssnsessssendsecszsedecsees nii 2 6 Characteristics of the Instruments oe eeeeeeeeees 2 7 Characteristics of each GPIB PC 2 7 Default Configurations oe eecsssecsesseceeeeees 2 8 Primary Default Characteristics 0 sscsssseseeseeees 2 8 National Instruments Corp ix GPIB PC User Manual Contents Running IBCONE Wee eeecsssecesssecessneessnseeessnes Upper and Lower Levels of IBCONF Upper Level Device Map for Board GPIBX uw eesseeseeseseeseestessesseeseesnees Device Map Concepts and Terms Lower Level Device Board Characteristics isisi i es istis 2 11 Set EOI with last byte of Write 2 14 GPIB PC Modeliai 2 14 Board is System Controller Boards ONlIy ereire naaraana n 2 14 Local Lockout on all Devices Boards Only Jeee neen e 2 15 Disable Auto Serial Polling Boards Only sessscsscessseseeceseceececseeneeecsneeeeseenee 2 15 High Speed Timing Boards Only eiiosesisisiriiiiiiiisiiiiiiiisisis 2 15 Interrupt Jumper Setting Boards Only cionn i aia 2 15 Base I O Address Boards Only 0 0000 0 2 15 DMA Channel Boards Only eee 2 16 Internal Clock Frequency Boatds Only juonsi rei diate 2 16 Exiting IBCONF PEER Usimg Your GPIB PO gs n A E E EE REE Section Three GPIB PC Functions Introduction essesssesssssssssseeeseeeceeecceesnsssnnnnnnneenneees 3 1 Intr
21. 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 National Instruments Corp E 7GPIB PC User Manual
22. amp H40 or ASCII 100 REM Perform addressing 120 CMDS UNL MTA LAD 130 CALL IBCMD BRDO CMDS 140 REM Perform board write 150 DIM WRT 4 160 WRTS 0 ASC F ASC 3 256 170 WRTS 1 ASC R ASC 1 256 180 WRTS 2 ASC X ASC 5 256 190 WRT 3 ASC P ASC 2 256 200 WRT 4 ASC G ASC O 256 210 CNT 10 220 CALL IBWRTI BRDO WRT 0 CNT 230 REM Unaddress all Talkers and 240 REM Listeners 250 CMDS _ UNT UNL 260 CALL IBCMD BRD0 CMD QuickBASIC Version 2 0 and 3 0 replace line 220 with CALL IBWRTI PTR VARPTR WRT 0 CNTS QuickBASIC Version 4 0 replace line 220 with CALL IBWRTI BD WRT CNTS National Instruments Corp 4A 97 GPIB PC User Manual BASICA QuickBASIC GPIB PC Function Calls Section Four A BASICA QuickBASIC BASICA QuickB ASIC IBWRTIA IBWRTIA Purpose Write data asynchronously from integer array Format E BASICA and QuickBASIC Version 1 0 Call IBWRTIA BD IARR 0 CNTS QuickBASIC Version 2 0 and 3 0 Call IBWRTIA BD VARPTR IARR 0 CNTS QuickBASIC Version 4 0 Call IBWRTIA BD IARR CNT Remarks BD specifies 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
23. indicate that it is not possible to obtain the status of the GPIB PC National Instruments Corp 4 5 GPIB PC User Manual GPIB PC Functions Overview Section Four Error Codes When the ERR bit is set in the status word a GPIB error has occurred The error code is returned in the variable IBERR There are 14 possible error codes Table 4 2 lists these codes a recommended mnemonic to be associated with that type of error and the numeric value of the code Table 4 2 GPIB Error Codes Mnemonic Value IEDVR 0O DOSermor sd EABO f 6 p 1 0 operation aborted ___ ENEB f 7 f Nonexistent GPIB PC board PONP T O started before previous operation compiered A description of each error and some conditions under which it may occur follows EDVR 0 EDVR is returned by the language interface when the device or board name passed in an IBFIND call is not configured in the handler In this case the variable IBCNT will contain the DOS error code 2 Device not found The remedy is to replace the argument to IBF IND with a valid board or device name or reconfigure the handler using the IBCONF utility to recognize the name GPIB PC User Manual 4 6 National Instruments Corp Section Four GPIB PC Functions Overview It is also returned when an invalid unit descriptor is passed to any function call In this case the variable IBCNT will contain the DOS error code 6 Invalid handle The remedy is to be sure that IBF IN
24. installed in an IBM Personal Computer or compatible PC which is operating under PC DOS or MS DOS and programmed using BASICA and QuickBASIC With appropriate supplements to the manual other GPIB PC interfaces can be installed in other computers using other programming languages Organization of the Manual Section One Operation of the GPIB describes the operation of the GPIB Section Two Installation and Configuration describes the installation of the software and the configuration program IBCONF A supplement contains instructions for installing your particular board into your computer Section Three GPIB PC Functions Introduction introduces you to the functions used by your GPIB PC The features are divided into groups as a means of helping you understand the uses of the functions Section Four GPIB PC Functions Overview introduces you to programming information common to all languages Section Four A Function Reference Language Interface s pertains to BASICA and QuickBASIC The descriptions are listed alphabetically for easy reference Section Five JBIC introduces you to IBIC the interactive control program that allows you to control and communicate with the GPIB through functions you enter at your keyboard IBIC is designed to help you learn how to use the GPIB PC functions to program your devices Section Six Applications Monitor introduces you to the applications monitor a resident program that is
25. 0 CNT IBWRTIA BD VARPTR IARR 0 CNTS H wW ve D wn oO a a D ghp mh oO oe On Q vlo lo o o o Return serial poll byte iH wW W n lt o lo o BRS hange secondary address end interface clear et clear remote enable line Abort asynchronous operation hange disable time limit onfigure applications monitor rigger selected device HH fi w w NIN HP CFII vlo o oX w w ed pa w n D ral o Hi w z O o H wW o ole TRAP H w a IIQ o H Ww z 5 w IBWRTA Hi ius z 5 eii laa Read data to integer array Read data asynch to integer array Request release system control Wait for selected event Write data from string Write data asynchronously from string Write data from file Write data from integer array Write data asynch from integer array National Instruments Corp 4A 9 GPIB PC User Manual BASICA QuickBASIC GPIB PC Function Calls Section Four A Ka Table 4A 3 QuickBASIC GPIB PC Calls Description hange access board of device ecome Active Controller lear specified device end commands from string vala Dn 3 a Q 3 5 o 5 a Dn pov Dn lt 3 Q gt 5 5 Dn 2 B H w Q string nable disable DMA hange disable EOS mode nable disable END messag ies e et clear ist Go to local lace device online offline hange primar
26. 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 board characteristics lower level 2 11 Differences between software revisions C 1 Disable auto serial polling Boards Only 2 15 DMA channel Boards Only 2 16 GPIB PC User Manual I 2 National Instruments Corp Index E Electrical characteristics 1 5 EOI w last byte of write setting 2 14 EOS byte 2 14 modes 2 14 Error codes 4 6 5 11 Errors and Solutions B 1 Execute Indirect File 5 17 Exiting IBCONF 2 16 F Floppy disk boot 2 3 Functions and syntax IBIC 5 7 Functions that alter 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 3 handshake lines 1 3 interface management lines 1 4 signals and lines 1 3 related documents 1 9 GPIB PC Model 2 14 National Instruments Corp E 3GPIB PC User Manual Index GPIB PC characteristics of 2 7 functions introduction to 3 1 BASICA QuickBASIC GPIB I O 4A 2 4A 5 IBIC 5 7 5 8 Introduction
27. 4A 33 BDNAMES BRDO Board name assigned at configuration time 1000 ERROR ROUTIN EJ GPIB PC User Manual BASICA QuickBASIC GPIB PC Function Calls Section Four A BASICA QuickBASIC BASICA QuickB ASIC IBGTS IBGTS Purpose Go from Active Controller to Standby Format CALL IBGTS BD V Remarks BD specifies an interface board If V is non zero the GPIB PC shadow handshakes the data transfer as an Acceptor and when the END message is detected the GPIB PC enters a Not Ready For Data NRFD handshake holdoff state on the GPIB If V is zero no shadow handshake or holdoff is done The IBGTS function causes the GPIB PC to go to the Controller Standby state and to unassert the ATN signal if it initially is the Active Controller IBGTS permits GPIB devices to transfer data without the GPIB PC being a party to the transfer If 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 handshake the IBEOS function should be called to establish the proper end of string character or to disable EOS detection if the end of string character in use by the talker is not kn
28. CIC The handler then waits indefinitely for control to be passed to the access board The computer system hangs if there is not another CIC that will pass control This might happen for example if the access board is supposed to be System Controller but it was not configured as such during software installation In Revision D software if the access board is not CIC when the device call is made the ECIC error is returned Also in Revision D software because of multitasking board level reconfiguration functions must not be called during device level calls GPIB PC User Manual 4 12 National Instruments Corp Section Four GPIB PC Functions Overview Automatic Serial Polling If this feature is enabled the handler automatically conducts serial polls when SRQ is asserted The handler polls all active devices and stores each positive response i e those responses that have the Request Service RQS or hex 40 bit set in the device status byte in a queue associated with each device Queues are necessary because some devices can send multiple positive status bytes back to back When a positive response from a device is received the RQS bit of its status word IBSTA is set The polling continues until SRQ is unasserted or an error condition is undetected If the handler cannot locate the device requesting service no known device responds positively to the poll or if SRQ becomes stuck on due to a faulty instrument or cable then
29. CIC when a device call is made the ECIC error is returned Non Interrupt Mode Rev D has no non interrupt mode You must select interrupt level 2 7 GPIB PC User Manual C 2 National Instruments Corp Appendix C Differences Between Software Revisions Asynchronous I O There is no asynchronous capability on Rev D If you call an asynchronous function IBRDA IBRDIA IBWRTA IBWRTIA IBCMDA and IBSTOP the ECAP error is returned immediately DMA on the GPIB PCIII The GPIB PCII board has additional DMA capability If you have the GPIB PCIII consult the READ ME file of the accompanying Distribution Diskette for details Local Lockout In Rev D there is no automatic local 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 Rev D these bits are cleared at the beginning of a new function call Thus if the application program must be sensitive to the messages Device Clear Selected Device Clear or Group Executive Trigger the status bits must be checked after each function call Printer Support Rev C has printer support and Rev D does not
30. GPIB PC Functions 3 1 model 2 14 software installation 2 3 Using 2 18 using your printer with D 1 Group I 3 2 Group II 3 3 Clearing the Device vs Clearing the GPIB 3 4 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 torun 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 Functions 5 12 byte count 5 12 board function calls 5 22 device function calls 5 19 error code 5 11 GPIB PC User Manual I 4 National Instruments Corp Index E or Q exit or quit 5 18 Execute Indirect File 5 17 functions and syntax 5 7 5 8 functions auxiliary 5 12 how to exit 5 5 Important Programming Note 5 5 Other IBIC Functions and Syntax 5 8 PRINT Display the ASCII String 5 18 Repeat Previous Function 5 14 Repeat Function n Times n 5 16 running 5 2 sample programs 5 19 SET Select Device or Board 5 13 status word 5 10 Turn 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
31. Glossary SRQ or SERVICE REQUEST The GPIB line that a device asserts to notify the CIC that the device needs servicing STATUS BYTE The data byte sent by a device when it is serially polled STATUS WORD Same as IBSTA SYSTEM CONTROLLER The single designated controller that can assert control become CIC of the GPIB by sending the Interface Clear IFC message Other devices can become CIC only by having control passed to them T1 A GPIB timing parameter primarily associated with the data settling time i e the time in which new bytes on the DIO lines are allowed to settle before the DAV signal is asserted T1 ranges from 350 nsec to above 2 usec 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 integrated circuit that implements most of the GPIB Talker Listener and Controller functions in hardware UNIT DESCRIPTOR A number that is used by the handler to temporarily identify a device or board that has been opened with the IBFIND function The descriptor is not related to the unit s GPIB address UNL or UNLISTEN A GPIB command that unaddresses any active Listeners UNT or UNTALK A GPIB command that unad
32. IBGTS function It is cleared whenever the GPIB PC detects the Unlisten UNL command its own talk address Interface Clear IFC or IBGTS is called without shadow handshake DTAS b DTAS specifies whether the GPIB PC has detected a device trigger command It is set whenever the GPIB PC as a Listener detects the Group Execute Trigger GET command has been sent by another Controller It is cleared in the status word on any call immediately following an IBWAIT call if the DTAS bit is set in the IBWAIT mask parameter DCAS b DCAS specifies whether the GPIB PC has detected a device clear command It is set whenever the GPIB PC detects the Device Clear DCL command has been sent by another Controller or whenever the GPIB PC as a Listener detects the Selected Device Clear SDC command has been sent by another Controller It is cleared in the status word on any call immediately following an IBWAIT call if the DCAS bit was set in the IBWAIT mask parameter or on any call immediately following a read or write In addition to the above the following situations also affect the status word bits e A call to the function IBONL clears the following bits END LOK REM CIC TACS LACS DTAS DCAS e Acallto IBONL affects bits other than those listed here according to the rules explained above In the event that a function call returns an ENEB or EDVR error all status word bits except the ERR bit are cleared since these error codes
33. Send the GET message to trigger a EM measurement reading EM CMD CHRS amp H8 CALL IBCMD BRD0 CMD IF IBSTA S lt 0 THEN GOSUB GPIB ERROR EM EM Wait for the DVM to set SRQ or for a EM timeout if the current time limit EM is too short use IBTMO to change it EM MASK amp H5000 CALL IBWAIT BRD0O MASK IF IBSTA S AND amp HC000 lt gt 0 THEN GOSUB GPIB RROR EM EM Since neither a timeout nor an error EM occurred IBWAIT must have returned EM on SRO Next do a serial poll EM First unaddress bus devices and send EM the Serial Poll Enable SPE command EM then send the DVM s talk address and EM the GPIBO listen address amp H20 ASCII EM space EM CMDS _ CHRS amp H18 Cc CALL IBCMD BRD0 CMD IF IBSTA S lt 0 THEN GOSUB GPIB ERROR RI RI RI RI RI RI R R R ical CaM EES CE Gees ES Ce PE BE A H H W nj j O SS SERRE lt S KEE KR ES EES Now read the status byte If it is amp HCO the DVM has a valid data to send otherwise it has a fault condition to report SPACE 1 CALL IBRD BRDO RDS IBSTA S lt 0 THEN GOSUB GPIB ERROR ASC RD lt gt amp HCO THEN GOSUB DEVICE ERROR If more than one device were attached to the bus it would be necessary to explicitly check the amp HCO bit if the DVM status word to be sure that another device had not been responsible for asserting SRQ Complete the serial poll by sendi
34. 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
35. an interface board There are some activities common to all device functions that should be understood thoroughly In a single board configuration in which there is only one GPIB PC in use when the first device function of the program is executed the GPIB is initialized by its controlling access board with the Interface Clear IFC command The Remote Enable REN line on that GPIB is also asserted If selected in the configuration program the Local Lockout LLO command is also sent to all devices on the GPIB to place them in a lockout state Furthermore the device may be addressed to listen and then unaddressed before certain functions are executed This is to ensure that the device is in remote program mode In a multiboard configuration in which there is more than one GPIB PC the process is the same as previously described with the exception that each GPIB is initialized by its access board when the first device on that GPIB is accessed by a device function call The previous descriptions assume that the GPIB PC is the System Controller of its GPIB which is the usual configuration If the GPIB PC is not the System Controller it must be passed CIC authority from the System Controller to execute device functions If the access board is not CIC when a device function is called the board requests service from the current CIC by asserting the Service Request SRQ line and passing the status response byte hex 41 when serially polled by the
36. asynchronously to integer array Format ka BASICA and QuickBASIC Version 1 0 Call IBRDIA BD IARR S 0 CNTS QuickBASIC Version 2 and 3 Call IBRDIA BD VARPTR IARR 0 CNT QuickBASIC Version 4 Call IBRDIA BD IARR CNT Remarks BD specifies a device or an interface board IARR specifies an integer array into which data is read asynchronously from the GPIB 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 function stores up to 32K data bytes into a character string variable Read asynchronously 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 IARRS GPIB PC User Manual 4A 60 National Instruments Corp Section Four A BASICA QuickBASIC GPIB PC Function Calls Unlike IBRDA IBRDIA stores the data directly into an integer array No integer conversion is needed on the data that has been read for arithmetic operations to be performed on it NOTE Do not pass dynamic arrays to the asynchronous functions IBRDIA and IBWRTTIA since the QuickBASIC environment might move them around in memory during an T O operation Refer to the IBRDA function and to the BASICA and QuickBASIC GPIB PC I O Functi
37. before you ran IBTEST If not do so now If you have performed these steps and IBTEST still fails carefully note all error information and call National Instruments If no errors occur proceed to the end of this section to learn how to use the software and to develop your application program More About IBCONF IBCONF is a screen oriented interactive program that is included on the distribution diskette of the GPIB PC package You use IBCONF to edit the description in the handler of characteristics of the devices and boards in the system Running IBCONF to place this information directly in the handler eliminates the need to restate it inside each application program IBCONF passes two groups of features to the handler The first group consists of the characteristics of the instruments or devices attached to your GPIB PC The second group consists of the characteristics of each GPIB PC installed in the computer GPIB PC User Manual 2 6 National Instruments Corp Section Two Installation and Configuration Characteristics of the Instruments Each instrument used with the GPIB PC has the following characteristics A symbolic name of each device on the GPIB such as DEV5 or PS5010 A GPIB PC access board for each device e g GPIBO The access board is discussed in Device Map Concepts and Terms later in this section A primary and if used secondary address for each device A time limit that is to be imposed w
38. from a device using three IBRD calls Example dev1 ibrd 8 4100 end cmpl COUNT 8 61 62 63 64 65 66 67 68 abcd efgh dev1 dev1 ibrd 8 dev1 dev1 ibrd 8 4100 end cmpl COUNT 8 71 72 73 74 75 76 77 78 qrst uvwx National Instruments Corp 5 15 GPIB PC User Manual IBIC Section Five n Repeat Function n Times The n function repeats the execution of the specified function n times where n is an integer In the following example 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 BOe printer LO d Notice that the multiplier does not become part of the function name that is ibwrt Hello is repeated 20 times not 5 ibwrt Hello GPIB PC User Manual 5 16 National Instruments Corp Section Five IBIC Execute Indirect File In the function an indirect file is a text file that contains IBIC functions It is similar to a DOS batch file and is created the 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 gpib0O S usrfile executes the IBIC functions listed in the file usrfile and gpibo 3 S usrfile repeats
39. 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 this function writes a maximum of 32 K bytes of data from a character string to the GPIB Refer to the IBWRTA function and to the information about BASICA QuickBASIC GPIB I O Functions at the beginning of this section GPIB PC User Manual 4A 98 National Instruments Corp Section Four A BASICA QuickBASIC GPIB PC Function Calls NOTE Do not pass dynamic arrays to the asynchronous functions IBRDIA and IBWRTIA since the QuickBASIC environment might move them around in memory during an I O operation Device Example 1 Write 10 instruction bytes from integer array to the device DVM while performing other processing 100 DIM WRTS 4 110 WRTS 0 ASC F ASC 3 256 120 WRTS 1 ASC R ASC 1 256 130 WRT S 2 ASC X ASC 5 256 140 WRTS 3 ASC P ASC 2 256 150 WRT S 4 ASC G ASC 0 256 160 CNT 10 170 CALL IBWRTIA DVM WRT 0 CNT 180 ASKS amp H4100 TIMO CMPL 190 RE Perform other processing here then 200 RE wait for I O completion or timeout 210 CALL IBWAIT DVM MASK 220 RE Check IBSTA to see how the write 230 RE terminated on CMPL END TIMO or 240 RE ERR 250 RE If CMPL is not set continue 260 RE processing 270 IF IBSTA AND amp H10
40. is encountered you will be notified and given the option of re entering or exiting IBCONF To disable auto checking call IBCONF E After exiting the system MUST be rebooted for the new values to take effect Some functions may be called during the execution of an application program to change some of the configured values temporarily These functions are shown in Table 2 2 Table 2 2 Functions that Alter Default Characteristics Dynamically Changed b Primary GPIB address Secondary GPIB address End of string EOS byte 7 or 8 bit compare on EOS Set EOI with EOS on Write Terminate a Read on EOS I J BPAD B BE BE BE BE B BDMA B BRSC National Instruments Corp 2 17 GPIB PC User Manual Installation and Configuration Section Two Using Your GPIB PC Now that your software and hardware are installed read Section Three for an introduction to the functions available for the GPIB PC The functions are described in the order that you will most likely use them Pay special attention to Group I Group II and Group III After reading about these functions practice using them with your programmable instrument or device in an interactive environment using the IBIC program described in Section Five IBIC allows you to program your instrument interactively from the computer keyboard rather than from an application program This helps you understand how the device and the handler work It also familiar
41. is exceeded e END message is detected e EOS character is detected if this option is enabled or e 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 R 110 F 120 130 R R R R Gl 4 NAMES LL IBRDF 140 150 160 National Instruments Corp M Perform device read B RDGS RDR FLNAMES EM Check IBSTA EM the read completed not done here EM All addressing and unaddressing has EM been done 4A 55 and IBCNT to see how GPIB PC User Manual BASICA QuickBASIC GPIB PC Function Calls Section Four A Board Example 1 Read data from a device at talk address amp H4C ASCII L to the file RDGS on the current disk drive and then unaddress it the GPIB PC listen address is amp H20 or ASCH space 100 REM Perform addressing in preparation 110 RE for board read 120 CMDS L UNL TAD MLA 130 CALL IBCMD BRDO CMDS 140 RE Perform board read 150 FLNAMES RDGS 160 CALL IBRDF BRDO FLNAMES 170 RE Check IBSTAS and IBCNT to see how 180 RE the read completed not done here 190 RE Unaddress the Talker and Listener 200 CMDS _ UNT UNL 210 CALL IBCMD BRD0 CMD GPIB PC User Manual 4A 56
42. location would that the IBFIND call d refer you to the handler onfiguration procedures RROR STOP hecking routine at this ould among other things R to determine th xact he error condition and then n appropriate to the n For errors during data IBCNT may be examined to the actual number of bytes Ole ORM 33 0 20R at this location would e fault code returned in the us byte and take appropriate R oe STOP 4A 104 National Instruments Corp Section Four A BASICA QuickBASIC GPIB PC Function Calls BASICA Example Program Board BASICA Using board function calls 100 105 110 120 125 130 140 145 150 153 T5 160 165 170 175 180 190 200 215 220 230 240 245 250 260 270 280 290 300 310 320 330 345 350 360 370 380 390 400 405 410 420 National Instruments Corp J D D D D lt ss El EY Gr Er ey Z Z nN Z Heart a m a m CCS g N N N N Z Er r Gl FI nN Z Po t m m Z Z nN rd t m Ei Z KaSS You must merge this code with DECL BAS Assign a unique identifier to board 0 and store in the variable BRDO BDNAMES GPIBO CALL IBFIND BDNAMES BRDO Check for error on IBFIND call IF BRDO lt 0 TH EN GOTO 2000 Send th CALL IBSIC Interface Clear IFC message to all devices BRDOS Check for an error on each GPIB call IF IBSTA lt 0 THEN GOTO 3000 Turn on the Remo
43. names the application program is using The substitution must be done consistently and carefully throughout Instructions provided in this section assume that no name substitution is necessary and that the recommended names are used The GPIB status error and count information is returned in the variables IBSTA IBERR and IBCNT as described at the beginning of Section Four In accordance with BASICA language protocol all function arguments are variables either integer or string and their values must be assigned before the function call is made The CLEAR statement in line 1 of DECL BAS contains a constant which is used to determine the memory requirements of the BASICA language interface For the great majority of users this constant is correct The constant may be incorrect however if you are using a system with an extremely small amount of memory If after BASICA is invoked it reports that there are fewer than 60000 bytes free you may need to adjust the constant to a smaller value Programming Preparations for QuickBASIC Include the following QuickBASIC statement at the beginning of your application program COMMON SHARED IBSTA IBERR S IBCNT This statement is included in the file OBDECL BAS on the distribution diskette The GPIB status error and count information is returned in the variables IBSTA IBERR and IBCNT as described at the beginning of Section Four The file OBTB OBJ contai
44. rudimentary board or device function that performs a single operation See High Level Function MLA or MY LISTEN ADDRESS A GPIB command used to address a device to be a Listener There are 31 of these primary addresses MTA 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 listen or talk addresses for devices NDAC or NOT DATA ACCEPTED One of the three GPIB handshake lines See Handshake NRED or NOT READY FOR DATA One of the three GPIB handshake lines See Handshake ON PEN STATEMENT National Instruments uses this statement to intercept SRQ interrupts and make them available to user programs OPENED DEVICE OR BOARD One that has been enabled or placed online by the IBFIND function PARALLEL POLL The process of polling all configured devices at once and reading a composite poll response See Serial Poll PORT ADDRESS See I O Address National Instruments Corp G 5 GPIB PC User Manual Glossary PPC or PARALLEL POLL CONFIGURE A GPIB command used to configure an addressed Listener to participate in polls PPD or PARALLEL POLL DISABLE A GPIB command used to di
45. 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 the specific sequence of events is as follows 1 IBCMD sends the following commands e Unlisten UNL e Talk address of the device e Secondary address of the device if applicable e Listen address of the access board e Secondary address of the access board if applicable and e Serial Poll Enable SPE Other command bytes may be sent as necessary 2 IBRD reads one response from the device and stores it in SPR amp GPIB PC User Manual 4A 68 National Instruments Corp Section Four A BASICA QuickBASIC GPIB PC Function Calls 3 IBCMD sends the following commands e Untalk UNT and Unlisten UNL and e Serial Poll Disable SPD The interpretation of the response in SPR other than the RQS bit is device specific 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 TAPES 100 CALL IBRSP TAPE SPRS 110 REM The application program would then 120 REM analyze the res
46. store them Several older status bytes are available however the oldest is being returned by the IBRSP call If an occasional lost status byte is not important in your application you may consider this error code informative only and ignore it If your application cannot tolerate missing even one status byte the remedy is to disable Automatic Serial Polling using IBCONF ESRQ occurs only during the IBWAIT call This indicates that a wait for RQS is not possible because the GPIB SRQ line is stuck on The usual reason for this situation is that some device that the handler is unaware of is asserting SRQ Since the handler does not know of this device it will never be serially polled and SRQ will never go away Another reason for the situation would be that a GPIB bus tester or similar equipment was forcing the SRQ line to be asserted or that there is a cable problem involving the SRQ line Although the occurrence of ESRQ signals a definite GPIB problem it will affect no GPIB operations whatever except that the RQS bit cannot be depended on while the condition lasts GPIB PC User Manual 4 10 National Instruments Corp Section Four GPIB PC Functions Overview Count Variable The IBCNT variable is updated after each read write or command function call with the number of bytes actually transferred by the operation Read and Write Termination The IEEE 488 specification defines two methods of identifying the last byte of device de
47. that operation three times The display mode in effect before this function is executed is restored afterward but may be changed by functions in the indirect file National Instruments Corp 5 17 GPIB PC User Manual IBIC Section Five PRINT Display the ASCII String The PRINT function can be used to echo a string to the screen Example dev1 print hello hello dev1 print and r n x67 x6f x6f x64 x62 x79 x65 and goodbye 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 GPIB PC User Manual 5 18 National Instruments Corp Section Five IBIC IBIC Sample Programs Refer to Section Four A BASICA QuickBASIC GPIB Programming Examples for a description of the programming steps that could be used to program a representative IEEE 488 instrument from your personal computer using the GPIB PC handler functions The applications are written using IBIC commands Device Function Calls To communicate with a device first find the device name which was given to the device in the IBCONF program Example ibfind dvm DVM Clear the device The user should check for ERR after each GPIB function call to be safe Example DVM THELTr 0100
48. the interface board BRDOS 100 110 120 130 140 150 160 170 180 190 GPIB PC User Manual LA z Psa 2 D lt Perform addressing in preparation for board write DS UNL MTA LAD IBCMD BRDO CMDS Perform board write 4 AYP AQWAAAWDAQADADA D E Y DAT IBWRTF BRD0 FLNAME Unaddress the Talker and Listener DS _ UNT UNL IBCMD BRDO CMDS 4A 94 National Instruments Corp Section Four A BASICA QuickBASIC GPIB PC Function Calls BASICA QuickBASIC BASICA QuickB ASIC IBWRTI IBWRTI Purpose Write data from integer array Format E BASICA and QuickBASIC Version 1 0 Call IBWRTI BD IARR 0 CNT3 QuickBASIC Version 2 0 and 3 0 Call IBWRTI BD VARPTR IARR 0 CNTS QuickBASIC Version 4 0 Call IBWRTI BD IARR CNTS Remarks BD specifies a device or an interface 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 IARRS 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 function is useful when those bytes are stored in integer format Refer to the IBWRT function and to the information about
49. the applications you develop with our products and we want to help if you have problems with them For information on how to contact us refer to Appendix F Customer Communication at the end of this manual GPIB PC User Manual viii National Instruments Corp Contents Section One Operation of the GPIB occ 1 1 Types of Messages Talkers Listeners and Controllers 0 ccccccessessessscssssssssesssessesseesees 1 1 NRED not ready for data eessseeeeeeeneeeees 1 3 NDAC not data accepted eeeeeeeeeeeteeees 1 4 DAY data Valid ccccsessssssssessessssssessesessescseeeeees Interface Management Lines ATN attention 00 IFC interface clear REN remote enable SRQ service request EOI end or identify eeeseseeeseeeceeeeceeeeeeees Physical and Electrical Characteristics ccsesseeeeeeseeseeeseees Configuration Requirements Related DOCuMents oe eesssssssssssssesssesseessesssessscssncsssesscesseeseeeseesseesseesneess Section Two Installation and Configuration 2 1 Installing the Hardware sees The GPIB PC Software Package Additional Programs and Files Installing the Software sssesssssesesecseseseseseoesssstceseoenssoresosereeseorssseresseerneses Step L Preparation cusses aveisen sient Booting from a Floppy Disk Booting from a Hard Disk eects 2 3 Step 2 Run IBSTAR Tirvi iioii Step 3 Run IBCONF optional Step
50. the installation program IBSTART BAT e QBDECL BAS A file containing required initialization code QBIB1 OBJ Version 1 0 language interface GPIB PC User Manual 4A 2 National Instruments Corp Section Four A BASICA QuickBASIC GPIB PC Function Calls 2 0 l 3 0 QBIB2 OBJ Version 2 0 and 3 0 without coprocessor QBIB_87 OBJ Version 3 0 with coprocessor QBIB_87E OBd Version 3 0 coprocessor emulator mode QBIB4 OBJd Version 4 0 language interface QBDECL4 BAS Version 4 0 required initialization code The appropriate language interface depends on the version of QuickBASIC used e DQBSAMP BAS A sample program using device calls e BOBSAMP BAS A sample program using board calls Programming Preparations for BASICA A BASICA language code block must be executed before the main body of your application program Place the file DECL BAS which contains this code block at the beginning of the application program with appropriate adjustments to line numbers Refer to the BASICA MERGE command DECL BAS contains code which loads the file BIB M into memory The file BIB M contains the BASICA language interface to the GPIB PC handler and must exist in the directory currently in use National Instruments Corp 4A 3 GPIB PC User Manual BASICA QuickBASIC GPIB PC Function Calls Section Four A You may change function and variable names defined in the code block if they conflict with
51. to hold a copy of the GPIB PC software contained on the distribution diskette Boot your system Then insert the distribution diskette into the floppy drive National Instruments Corp 2 3 GPIB PC User Manual Installation and Configuration Section Two Step 2 Run IBSTART Run IBSTART from the distribution diskette by switching to the drive containing the distribution diskette and entering ibstart x replacing x with the letter of the boot drive For example if the distribution diskette is in drive B and you have booted from drive A enter b to switch to drive B Next enter ibstart a torun IBSTART IBSTART first creates a directory called GPIB PC on the boot diskette and copies the GPIB software to that directory If the insufficient disk space message appears abort the IBSTART program by pressing the control key while you enter c Increase the free space in your boot area and run IBSTART again Next IBSTART creates or modifies the DOS system configuration file CONFIG SYS to contain the line DEVICE GPIB COM By reading this file at boot time DOS installs new device drivers and handlers Next IBSTART switches to the boot drive to run the hardware diagnostic program IBDIAG GPIB PC User Manual 2 4 National Instruments Corp Section Two Installation and Configuration Finally IBSTART advises you to complete the following actions e Run IBCONF if you must reconfigure the software e Reboot y
52. you are using and the GPIB device you are programming are not at the same GPIB address If using device functions run IBCONF to do this National Instruments Corp B 9 GPIB PC User Manual Appendix C Differences Between Software Revisions This appendix describes differences between current revisions of the software Revision B and Revision C Interrupts In Rev C the software is interrupt driven improving its performance and taking advantage of the interrupt capabilities of the GPIB PC interface board Startup Program The Rev C standard software package includes a startup program IBSTART BAT to get you started faster 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 Control Program IBIC In Rev C IBIC EXE includes a help feature Also you now call IBFIND as you would in your application program It must be called at the beginning of IBIC EXE to enable a device or board and be called subsequently to enable any previously unreferenced device or board National Instruments Corp C 1 GPIB PC User Manual Differences Betw
53. 0 0 GOTO 190 QuickBASIC Version 2 0 and 3 0 replace line 170 with CALL IBWRTIA PTR VARPTR WRT 0 CNTS ka QuickBASIC Version 4 0 replace line 170 with CALL IBWRTIA BD WRT CNTS National Instruments Corp 4A 99 GPIB PC User Manual BASICA QuickBASIC GPIB PC Function Calls Section Four A Board Example 1 Write 10 instruction bytes from the integer array WRT toa device at listen address amp H2F ASCII and then unaddress it the GPIB PC talk address is amp H40 or ASCII 100 REM Perform addressing 110 CMDS UNL MTA LAD 120 CALL IBCMD BRDO CMDS 130 REM Perform board write 140 DIM WRTS 4 150 WRT S 0 ASC F ASC 3 256 160 WRT 1 ASC R ASC 1 256 170 WRT S 2 ASC X ASC 5 256 180 WRT 3 ASC P ASC 2 256 190 WRT S 4 ASC G ASC 0O 256 200 CNT 10 210 CALL IBWRTIA BRD0O WRTS 0 CNT 220 REM Perform other processing here then 230 REM wait for I O completion or timeout 240 MASK amp H4100 TIMO CMPL250 260 CALL IBWAIT BRD0O MASK 270 REM Unaddress the Talker and Listener 280 CMDS _ UNT UNL 290 CALL IBCMD BRD0 CMD For QuickBASIC Version 2 0 and 3 0 replace line 210 with CALL IBWRTIA PTR VARPTR WRT 0 CNTS Ka For QuickBASIC Version 4 0 replace line 210 with CALL IBWRTIA BD WRT CNTS GPIB PC User Manual 4A 100 National Instrument
54. 11 110 CALL IBCMD BRDO CMDS or 100 CMDS CHRS amp H11 110 CALL IBCMD BRDO CMDS 3 Return all devices to local mode 100 V 0 Set REN to false 110 CALL IBSRE BRDOS V National Instruments Corp 4A 75 GPIB PC User Manual BASICA QuickBASIC GPIB PC Function Calls Section Four A BASICA QuickBASIC BASICA QuickB ASIC IBSTOP IBSTOP Purpose Abort asynchronous operation Format CALL IBSTOP BD Remarks BD specifies a device or an interface board IBSTOP terminates any asynchronous read write or command operation in progress Device IBSTOP Function If BD specifies a device IBSTOP attempts to terminate any unfinished asynchronous I O operation to that device that had been started with a device function for that device 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 that board 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 Device Example 1 Stop any asynchronous operations associated with the de
55. 13 GPIB PC User Manual GPIB PC Functions Introduction Section Three More About Device and Board Functions Before proceeding to the next group of functions you will find it helpful to compare how a high level device function can be replaced by several low level board functions Conducting a serial poll is a good example In the discussion of the IBRSP function of Group II this BASIC example of the device function was used CALL IBRSP PLTR STATUS This is equivalent to the following sequence using the board functions just described CMDS CHRS amp H18 G CALL IBCMD GPIBO CMDS STATUSS SPACES 1 CALL IBRD GPIBO STATUSS CMDS _ CHRS amp H19 CALL IBCMD GPIBO CMDS The first IBCMD function is used to send the string of ASCII commands assigned in the first program line These are Unlisten Serial Poll Enable CHRS amp H18 talk address of the plotter G and listen address of the board Now that the plotter is enabled to send its status byte and the board is addressed to receive it the IBRD function is called to read the byte and store it in the variable STATUS The final IBCMD function completes the poll by sending the command string consisting of three messages Untalk _ Unlisten and Serial Poll Disable CHR amp H19 You can see that a high level device function is easier to use However when an application requires a more complex serial poll routin
56. 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 17 027 23 ETB 37 067 55 7 MLA23 18 030 24 CAN SPE 38 070 56 8 MLA24 19 031 25 EM SPD 39 071 57 9 MLA25 1A 032 26 SUB 3A 072 58 i MLA26 1B 033 27 ESC 3B 073 59 MLA27 1C 034 28 FS 3C 074 60 lt MLA28 ID 035 29 GS 3D 075 6l MLA29 1E 036 30 RS 3E 076 62 gt MLA30 1F 037 31 US 3F 077 63 UNL GPIB PC User Manual A 2 National Instruments Corp Appendix A Hex Oct Dec ASCII Msg Multiline Interface Messages Multiline Interface Messages Hex Oct Dec ASCII Msg 40 41 42 43 44 45 46 48 49 4A 4B 4C 4D 4E 50 51 52 53 55 56 57 58 5A 5B 5C 5D 5E SF 100 101 102 103 104 105 106 107 110 111 112 113 114 115 116 117 120 121 122 123 124 125 126 127 130 131 132 133 134 135 136 137 OAZZUMATTE ATMOANWPSE Po ONKM lt CHuROV MTAO MTA1 MTA2 MTA3 MTA4 MTAS5 MTA6 MTA7 MTA8 MTA9 MTA10 MTA11 MTA12 MTA13 MTA14 MTA15 MTA16 MTAI17 MTAI18 MTA19 MTA20 MTA21 MTA22 MTA23 MTA24 MTA25 MTA26 MTA27 MTA28 MTA29 MTA30 UNT National Instruments Corp 60 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 79 7A 7B 7C 7D 7E 7F A 3 140 141 142 143 144 145 146 147 150 151 152 153 154 155 156 157 160 161 162 163 164 165 166 167
57. 4 24 14 089 714 60 35 02 48301915 03 3788 1923 03480 30673 32 848600 91 640 0533 08 730 43 70 056 20 51 55 0635 523154 GPIB PC User Manual Documentation Comment Form National Instruments encourages you to comment on the documentation supplied with our products This information helps us provide quality products to meet your needs Title 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 If you find errors in the manual please record the page numbers and describe 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 Glossary ACCEPTOR HANDSHAKE A GPIB interface function that receives data or commands Listeners use this function to receive data and all devices use it to receive commands See Source Handshake and Handshake ACCESS BOARD The GPIB PC board that controls and communicates with the devices on the bus that are attached to it APPLICATIONS MONITOR A resident program that is useful in debugging sequences of GPIB calls from within your applicat
58. 8 Example GPIBO ibcmd x08 0188 cmpl lok cic atn tacs count 1 Wait for the DVM to set SRQ or for a timeout if the current timeout limit is too short use IBTMO to change it Example GPIB PC User Manual 5 24 National Instruments Corp Section Five IBIC GPIBO ibwait TIMO SRQT 4188 timo cmpl lok cic atn tacs Set up the device for a serial poll The and _ represent the unlisten UNL and untalk 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 GPIBO ibrd 1 01E4 cmpl lok rem cic atn lacs count 1 50P Complete the serial poll by sending the serial poll disable message SPD National Instruments Corp 5 25 GPIB PC User Manual IBIC Section Five Example GPIBO ibemd x19 01F4 cmpl lok rem cic atn lacs count 1 Since the DVM and the GPIB PC are still addressed to talk and to listen the measurement can be read Example GPIBO ibrd 20 01E4 cmpl lok rem cic lacs OD OA 4E 44 43 56 2D 30 e NDC Vv 30 30 2E 30 30 34 37 4500 00 4 2B 30 OD OA O To close out a programming sequence send the interface clear message IFC to initialize the bus Example GPIB ibsic 0160 cmpl lok rem ci
59. ART at installation To run IBIC change directory to C GPIB PC and enter C GPIB PC gt 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 colon NOTE In using IBIC the four most important functions are the HELP IBFIND IBWRT and IBRD commands GPIB PC User Manual 5 2 National Instruments Corp Section Five IBIC Using HELP The HELP function gives on line information about IBIC and the functions available within the environment This facility provides a quick reference for checking the syntax and function of the GPIB call Using IBFIND To execute any GPIB function you must first use IBF IND 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 IBF IND opening dev1 Example 1 and gpibO Example 2 The user s inputs are italicized Example 1 ibfind devl dev1 Example 2 ibfind gpib0d gpib0 The name used with the IBF IND function must be a valid symbolic name known by the handler Both dev1 an
60. B PC User Manual 6 8 National Instruments Corp Section Six IBIC 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 National Instruments Corp 6 9 GPIB PC User Manual Appendix A Multiline 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 National Instruments Corp A 1 GPIB PC User Manual Multiline Interface Messages Appendix A Multiline Interface Messages Hex Oct Dec ASCII Msg Hex Oct Dec ASCII Msg 00 000 0 NUL 20 040 32 SP MLAO 01 001 1 SOH GTL 21 041 33 MLA1 02 002 2 STX 22 042 34 K MLA2 03 003 3 ETX 23 043 35 MLA3 04 004 4 EOT SDC 24 044 36 MLA4 05 005 5 ENQ PPC 25 045 37 MLAS 06 006 6 ACK 26 046 38 amp MLA6 07 007 7 BEL 27 047 39 j MLA7 08 010 8 BS GET 28 050 40 MLA8 09 011 9 HT TCT 29 051 41 MLA9 0A 012 10 LF 2A 052 42 MLA10 0B 013 11 VT 2B 053 43 MLAI1 0C 014 12 FF 2C 054 44 MLA12 OD 015 13 CR 2D 055 45 MLA13 OE 016 14 SO 2E 056 46 f MLA14 OF 017 15 S 2F 057 47 MLAI5 10 020 16 DLE 30 060 48 0 MLA16 11 021 17 DCI LLO 31 061 49 1 MLAI17 12 022 18 DC2 32 062 50 2 MLA18 13 023
61. BRDO CMDS 140 RE Perform board read 150 CNT 56 160 REM Array size is equal to CNT divided 170 RE by 2 180 DIM RD 28 190 CALL IBRDIA BRDO RD 0 CNT 200 ASK amp H4100 TIMO CMPL 210 RE Perform other processing here then 220 REM wait for I O completion or a 230 RE timeout 240 CALL IBWAIT BRDO MASK 250 RE Check IBSTAS to see how the read 260 REM terminated on CMPL END TIMO or 270 REM ERR 280 REM If CMPL or ERR are not set 290 RE continue processing 300 IF IBSTA S AND amp H8100 0 GOTO 200 310 RE Data is stored in RDS 320 REM Unaddress the Talker and Listener 330 CMDS _ UNT UNL 340 CALL IBCMD BRD0 CMD GPIB PC User Manual 4A 62 National Instruments Corp Section Four A BASICA QuickBASIC GPIB PC Function Calls 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 National Instruments Corp 4A 63 GPIB PC User Manual BASICA QuickBASIC GPIB PC Function Calls Section Four A BASICA QuickBASIC BASICA QuickB ASIC IBRPP IBRPP Purpose Conduct a Parallel Poll Format CALL IBRPP BD PPR Remarks BD specifies a device or an interface board PPR identifies the variable where the parallel poll response byte is stored Device IBRPP Function
62. Corp 4A 13 GPIB PC User Manual BASICA QuickBASIC GPIB PC Function Calls Section Four A Ki Table 4A 4 QuickBASIC Version 4 0 GPIB PC Functions Description hange access board of device ecome Active Controller lear specified device BD LC end commands from string LC Send commands asynchronously from string IL nable disable DMA IL hange disable EOS mode nable disable END message Open device and return unit descripto Go from Active Controller to standb Ti et clear ist Il Go to local lace device online offline hange primary address ass control arallel poll configure Read data to string Read data asynchronously to string Read data to file Read data to integer array CMDS CNTS C H E Z EA lt lt h Hlela o D w AP o f o f ol lt Ale ol C WU Q H E go AS Q lt ole Read data asynch to integer array onduct a parallel poll Request release system control Return serial poll byte Request service ILRSV D V hange secondary address end interface clear et clear remote enable line Abort asynchronous operation hange disable time limit rigger selected device continues GPIB PC User Manual 4A 14 National Instruments Corp Section Four A BASICA QuickBASIC GPIB PC Function Calls K Table 4A 4 QuickBASIC Version 4 0 GPIB PC Functions continued Description Function Syntax onfi
63. D bd v IBRSC bd v IBTMO bd v Section Four GPIB PC Functions Overview ccccccsccccesssssssssssssssssssssssssssssnsssssnsssnsssseesseees 4 1 General Programming Information sae Status W Ord asea o ere a T EE EEE AEA 4 2 h A EOI C CODES RS AR E E ARE E EE AAEE 4 6 Count Vana Dee r ENNE E E E RNE 4 11 Read and Write Termination sssseesssesseseesssesssceeessscrrssesressesrssreeees 4 11 Device Function Calls wn cecsssseccsssecessssssssseesssnseecssseessnnessssneees 4 12 Automatic Serial Polling oon cseeecsssseccsssecsssseesssnseessseeessneeses 4 13 Section Four A BASICA QuickBASIC GPIB PC Function Calls i ecceesesssessssessseesnecseneennsesneesee 4A 1 BASICA Files sitions i Gea A 4A 2 QUICKBASIG FES nigen a ia a 4A 2 Programming Preparations for BASICA w 4A 3 Programming Preparations for QuickBASIC 4A 4 BASICA QuickBASIC GPIB PC I O Functions 4A 5 BASICA QuickBASIC ON SRQ Capability ee 4A 6 New GPIB PC Functions 00 ssseecsssssesssseesssseeecssneesnseeessneesssneees 4A 12 GPIB PC Function Descriptions 4 A 15 GPIB PC User Manual xii National Instruments Corp Contents TB POT goss te A E eee atte a 4A 44 TBP PC OP EE EE E 4A 45 BASICA QuickBASIC GPIB Programming Examples essssessesecsesesseseeseesececseceeseceeseeeeseeneeeees BASICA Example Program Device 05 BASICA Example Program Board QuickBASIC Example Program Device
64. D for additional information Refer also to the discussion of device functions and the discussion clearing the device and clearing the GPIB in Section Three Device Example 1 Clear the device VMTR 100 CALL IBCLR VMTR National Instruments Corp 4A 19 GPIB PC User Manual BASICA QuickBASIC GPIB PC Function Calls Section Four A BASICA QuickBASIC BASICA QuickB ASIC IBCMD IBCMD Purpose Send commands from string Format CALL IBCMD BD CMDS Remarks BD specifies an interface board CMDS contains the commands to be sent over the GPIB The IBCMD function is used to transmit interface messages commands over the GPIB These commands which are listed in Appendix A include device talk and listen addresses secondary addresses serial and parallel poll configuration messages and device clear and trigger instructions The IBCMD function is also used to pass GPIB control to another device This function is NOT used to transmit programming instructions to devices Programming instructions and other device dependent information are transmitted with the read and write functions The IBCMD operation terminates on any of the following events e All commands are successfully transferred e Error is detected e Time limit is exceeded e Take Control TCT command is sent or e Interface Clear IFC message is received from the System Controller not the GPIB PC After termination the IBCNT variable contains
65. D has been called and that it returned successfully Also note that following a call to IBONL with a second argument of 0 which places bd offline an IBF IND is required before any subsequent calls with that device or board EDVR is also returned when the handler GPIB COM is not installed The remedy is to check the CONFIG SYS file in the root directory and make sure it contains the line DEVICE GPIB COM ECIC 1 ECIC is returned when one of the following board level calls is made while the board is not CIC of the GPIB e IBCMD e IBRPP e IBCAC and IBGTS In cases when the GPIB PC should always be the CIC the remedy is to be sure to call IBSIC to send Interface Clear before attempting any of these calls and to avoid sending the command byte TCT hex 09 Take Control In multiple CIC situations the remedy is to always be certain that the CIC bit appears in the status word IBSTA before attempting these calls If it is not it is possible to perform an IBWAIT CIC call to delay further processing until control is passed to the board ENOL 2 ENOL usually occurs when a write operation was attempted with no listeners addressed For a device write this error indicates that the GPIB address configured for that device in the handler does not match the GPIB address of any device connected to the bus This situation may be corrected by either attaching the appropriate device to the GPIB by modifying the address o
66. E shows the number of bytes received 2 To program the interface board BRDO to terminate read operations on the 8 bit value amp H82 rather than the 7 bit character amp HOA change lines 10 and 100 in Example 1 10 EOSVS amp H82 ol ll EOSV S amp H1400 100 V 3 To disable read termination on receiving the EOS character for operations involving the interface board BRD0O change line 100 in Example 1 100 V o9 ll LS EOSV GPIB PC User Manual 4A 28 National Instruments Corp Section Four A BASICA QuickBASIC GPIB PC Function Calls 4 Send END when the linefeed character is written for operations involving the interface board BRDO A 10 EOSV amp HOA EOS info for IBEOS 100 V EOSV amp H0800 110 CALL IBEOS BRDOS V 120 REM Assume the board has been 130 REM addressed do board write 140 WRT 123 CHRS amp HOA 150 CALL IBWRT BRDO WRTS 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 amp HOCOO ol ll National Instruments Corp 4A 29 GPIB PC User Manual BASICA QuickBASIC GPIB PC Function Calls Section Four A BASICA QuickBASIC BASICA QuickB ASIC IBEOT IBEOT Purpose Enable or disable END termination message on write operations Format CALL IBEOT BD V Remarks BD specifies a device or a
67. For device write functions run IBCONF from the root directory and check that 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 IBF IND 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 do NOT return with an error IBIC will return the previous address value which will be the same as the new one if you have correctly configured the device e For board write functions make sure the device is addressed properly using the IBCMD function before the write call Verify that the low five bits of the listen address and if appropriate the secondary address used in the IBCMD call match the device s GPIB address es and also that the listen address is in the range 20 3E hex 32 62 decimal and the secondary address is in the range 60 7E hex 92 126 decimal GPIB PC User Manual B 2 National Instruments Corp Appendix B Common Errors and Their Solutions EADR 3 Error Condition GPIB PC GPIBO or GPIB1 is not addressed correctly Solutions e Use IBCMD to send the appropriate Talk or Listen address before attempting an IBWRT or IBRD e If calling IBGTS with the shadow handshake feature call IBCMD to ensure that the GPIB ATN line is asserted
68. GPIB PC User Manual for the IBM Personal Computer and Compatibles April 1988 Edition Part Number 320014 01 Copyright 1984 1994 National Instruments Corporation All Rights Reserved National Instruments Corporate Headquarters 6504 Bridge Point Parkway Austin TX 78730 5039 512 794 0100 Technical support fax 800 328 2203 512 794 5678 Branch Offices Australia 03 879 9422 Austria 0662 435986 Belgium 02 757 00 20 Canada Ontario 519 622 9310 Canada Qu bec 514 694 8521 Denmark 45 76 26 00 Finland 90 527 2321 France 1 48 14 24 24 Germany 089 741 31 30 Italy 02 48301892 Japan 03 3788 1921 Netherlands 03480 33466 Norway 32 848400 Spain 91 640 0085 Sweden 08 730 49 70 Switzerland 056 20 51 51 U K 0635 523545 Limited Warranty The GPIB PC is warranted against defects in materials and workmanship for a period of two years from the date of shipment as evidenced by receipts or other documentation National Instruments will at its option repair or replace equipment that proves to be defective during the warranty period This warranty includes parts and labor The media on which you receive National Instruments software are warranted not to fail to execute programming instructions due to defects in materials and workmanship for a period of 90 days from date of shipment as evidenced by receipts or other documentation National Instruments will at its option repair or replace software media t
69. I TAPE RD 0 CNTS QuickBASIC Version 2 0 or 3 0 replace line 140 with 140 CALL IBRDI TAPE VARPTR RD 0 CNTS QuickBASIC Version 4 0 replace line 140 with 140 CALL IBRDI TAPE RD CNT GPIB PC User Manual 4A 58 National Instruments Corp Section Four A BASICA QuickBASIC GPIB PC Function Calls Board Examples 1 Read 56 bytes of data into the integer array RD from a device at talk address amp H4C ASCII L and then unaddress it the GPIB PC listen address is amp H20 or ASCII space 100 CMDS L UNL MLA TAD 110 CALL IBCMD BRDO CMDS 120 CNT 56 130 RE Array size is equal to CNT divided 140 RE by 2 150 DIM RD 28 160 CALL IBRDI BRDO RD 0 CNTS 170 RE Check IBSTAS to see how the read 180 RE terminated on CMPL END TIMO or 190 RE ERR 200 RE Data is stored in RDS 210 RE Unaddress the Talker and Listener 220 CMDS _ 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 CNTS QuickBASIC Version 4 0 replace line 160 with 160 CALL IBRDI BD RD CNT 2 To terminate the read on an end of string character see IBEOS examples National Instruments Corp 4A 59 GPIB PC User Manual BASICA QuickBASIC GPIB PC Function Calls Section Four A BASICA QuickBASIC BASICA QuickB ASIC IBRDIA IBRDIA Purpose Read data
70. IB PC User Manual 3 10 National Instruments Corp Section Three GPIB PC Functions Introduction Boards Devices One GPIB A0000 i Plotter Another GPIB Figure 3 1 Multiboard GPIB System National Instruments Corp 3 1 GPIB PC User Manual GPIB PC Functions Introduction Section Three IBWRT bd buf cnt and IBWRTA bd buf cnt Both functions use the specified board to write to one or more devices that have already been addressed to listen for example by the IBCMD or IBCMDA function The syntax for these low level functions is the same as their high level counterparts of Group I and III The software automatically differentiates between bd descriptors that refer to devices and those that refer to boards and executes the write operations appropriately IBWRTI and IBWRTTIA are also available in BASIC for binary transfers from an integer array IBSTOP bd IBSTOP aborts any asynchronous operation associated with the board IBWAIT bd mask IBWAIT waits for the specified board to detect one of the events selected in the mask bit vector to occur These events include the completion of asynchronous input output CMPL the board becoming a talker TACS listener LACS or Controller In Charge CIC detection of a GPIB Service Request SRQD assertion of the Attention signal ATN detection of the END message END or detection of a time limit TIMO or other error condition ERR IBTMO bd v
71. IB PC are still 810 REM addressed to talk and listen the 815 REM measurement can be read 820 REM as follows 825 REM 830 RDS SPACES 16 CALL IBRD BRDO RDS 840 IF IBSTAS lt 0 THEN GOTO 3000 850 REM 860 REM To close out a programming sequence send 870 REM IFC to initialize the bus and call the 880 REM IBONL function to place the GPIB PC 885 REM offline 890 REM 900 CALL IBSIC BRDO 910 V 0 CALL IBONL BRDO V STOP 2000 REM A routine 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 th xact 3015 REM cause of the error condition and then 3030 REM take action appropriate to the 3040 REM application For errors during data 3050 REM transfers IBCNT may be examined to 3070 REM determine the actual number of bytes 3075 REM transferred 3080 PRINT GPIB ERROR STOP 4000 REM A routine at this location would 4010 REM analyze the fault code returned in the 4015 REM DVM s status byte 4020 REM and take appropriate action 4040 PRINT DVM ERROR STOP 5000 END National Instruments Corp 4A 107 GPIB PC User Manual BASICA QuickBASIC GPIB PC Function Calls Section Four A QuickBASIC Example Program Device QuickBASIC Using device functio
72. IT must have returned on ROS Next serial poll the device 4A 103 GPIB PC User Manual BASICA QuickBASIC GPIB PC Function Calls 415 420 430 440 450 460 470 475 480 490 500 510 520 525 530 540 550 560 570 575 580 585 590 2000 2010 2020 2030 2040 3000 3010 3020 3030 3040 3050 3060 3070 3080 3090 4000 4010 4020 4030 4040 5000 HAHA ADA GE Er Ee El N N N N BE A D N NNN R M CALL IBRSP DVM IF IBSTA S lt 0 T Now test the If SPR is amp H to send othe condition to lt SSEKREE IF SPR lt gt amp HCO If the data i measurement lt e eS RDS SPACES 16 IF IBSTA S lt 0 T To close out reset the dev Section Four A SPRZ HEN GOTO 3000 status byte SPR CO the DVM has valid data rwise it has a fault report THEN GOTO 4000 s valid read the CALL IBRD DVM RDS HEN GOTO 3000 a programming sequence ice and call IBONL to take the device of lt S SEE CALL IBCLR DVM V 0 CALL I REM A routine REM notify you REM failed an REM software c PRINT IBFIND E REM An error c REM location w REM check IBER REM cause of t REM take actio REM applicatio REM transfers REM determine REM transferre PRINT GPIB ERR REM A routine REM analyze th REM DVM s stat REM action PRINT DVM ERRO END GPIB PC User Manual fline BONL DVM V STOP at this
73. In Charge If it is not either because it is not System Controller or because it has passed control away the function will not return until control is passed back to the board If this never happens the function will never return To check the board s System Controller status either run IBCONF and verify that the board is configured to be System Controller or run IBIC and execute the function IBRSC with an argument of 1 The previous value is reported as 1 if the board was System Controller before your function call To check that the board has not passed control confirm that you never call IBPCT nor IBCMD with the Take Control command 9 hex as an argument Error Condition The computer crashes Solutions e 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 e Configure the hardware and software to not use DMA and or interrupts You may have a PC compatible that is not totally compatible e Check that none of your device names is the same as any of your file or directory names not including the file or directory name suffix Error Condition IBDIAG reports a DMA or interrupt problem Solutions e Reconfigure the hardware and software for another DMA channel and or interrupt line You might have a conflict with another device e With the GPIB PCIIA and GPIB PCIII which hav
74. LAD1 LAD2 SDC 110 CALL IBCMD BRDO CMDS Trigger any devices previously addressed to listen with the Group Execute Trigger GET or amp H08 command 100 CMDS CHRS amp H08 GET 110 CALL IBCMD BRDO CMDS National Instruments Corp 4A 21 GPIB PC User Manual BASICA QuickBASIC GPIB PC Function Calls Section Four A 6 Unaddress all Listeners and serially poll a device at talk address amp H52 ASCII R using the Serial Poll Enable SPE or amp H18 and Serial Poll Disable SPD or amp H19 commands the GPIB PC listen address is amp H20 or ASCII space 100 CMDS R CHRS amp H18 UNL TAD MLA SPE 110 CALL IBCMD BRDO CMDS 120 RDS SPACES 1 Declare RD buffer 130 CALL IBRD BRDO RD 140 REM After checking the status byte in 150 REM RDS 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 CMDS CHR amp H19 _ r SPD UNT 190 CALL IBCMD BRDO CMDS GPIB PC User Manual 4A 22 National Instruments Corp Section Four A BASICA QuickBASIC GPIB PC Function Calls BASICA QuickBASIC BASICA QuickBASIC IBCMDA IBCMDA Purpose Send commands asynchronously from string Format CALL IBCMDA BD CMDS Remarks BD specifies an interface board CMDS contains the commands to be sent over the GPIB The IBCMDA function is used to transmit interface messages commands over the GPIB The
75. NTS WILL NOT BE LIABLE FOR DAMAGES RESULTING FROM LOSS OF DATA PROFITS USE OF PRODUCTS OR INCIDENTAL OR CONSEQUENTIAL DAMAGES EVEN IF ADVISED OF THE POSSIBILITY THEREOF This limitation of the liability of National Instruments will apply regardless of the form of action whether in contract or tort including negligence Any action against National Instruments must be brought within one year after the cause of action accrues National Instruments shall not be liable for any delay in performance due to causes beyond its reasonable control The warranty provided herein does not cover damages defects malfunctions or service failures caused by owner s failure to follow the National Instruments installation operation or maintenance instructions owner s modification of the product owner s abuse misuse or negligent acts and power failure or surges fire flood accident actions of third parties or other events outside reasonable control Copyright Under the copyright laws this publication may not be reproduced or transmitted in any form electronic or mechanical including photocopying recording storing in an information retrieval system or translating in whole or in part without the prior written consent of National Instruments Corporation Trademarks Product and company names listed are trademarks or trade names of their respective companies WARNING REGARDING MEDICAL AND CLINICAL USE OF NATIONAL INSTRUMENTS PRODUCTS N
76. National Instruments Corp Section Four A BASICA QuickBASIC GPIB PC Function Calls BASICA QuickBASIC BASICA QuickB ASIC IBRDI IBRDI Purpose Read data to integer array Format ka BASICA and QuickBASIC Version 1 0 Call IBRDI BD IARR 0 CNT Ea ak QuickBASIC Version 2 0 and 3 0 Call IBRDI D VARPTR IARR 0 CNT QuickBASIC Version 4 0 Call IBRDI BD IARR CNT Remarks BD specifies a device or an interface board IARR specifies an integer 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 IARRS Unlike IBRD because IBRDI stores the data directly into an integer array no integer conversion is needed on the data that has been read for arithmetic operations to be performed on it Refer to the IBRD function and to the information about BASICA and QuickBASIC GPIB PC I O Functions at the beginning of this section National Instruments Corp 4A 57 GPIB PC User Manual BASICA QuickBASIC GPIB PC Function Calls Section Four A Device Example 1 Read 56 bytes of data from the device TAPE and store in the integer array RDS 100 CNT 56 110 REM Array size is equal to CNT divided 120 REM by 2 130 DIM RD 28 140 CALL IBRD
77. National Instruments Corp C 3 GPIB PC User Manual Appendix D Using your Printer with the GPIB PC The Serial Parallel port redirection feature in the GPIB PC software allows you to replace default printer drivers so that output can be redirected to a GPIB printer or plotter After the appropriate configuration these GPIB devices can be accessed through system calls and other language printer commands e g LPRINT LPRINT USING PRINT LLIST COPY and PRINT Installation When installing the GPIB PC software run an interactive program IBCONF which allows 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 port redirection COM1 PRN LPT2 LPT3 To install the software follow these steps e Run IBSTART as explained in Section Two e Run IBCONF and follow all instructions e In IBCONF define dev1 Change the name dev1 to LPT1 Change the primary address to the GPIB address of your printer e Exit IBCONF e Reboot the system e Run IBTEST to verify correct software installation National Instruments Corp D 1 GPIB PC User Manual Using your Printer with the G
78. ON displa E A Execute function n times n function Execute previous function n times Execute indirect file filename Display string on screen print a Exitorquit i or q uit Notes 1 bdname is the symbolic name of the new device or board for example ibfind devlorset gpib0 2 Call IBF IND initially to open each device or board 3 If option is omitted a menu of options appears 4 Replace function with correct IBIC function syntax 5 filename is the DOS pathname of a file that contains IBIC functions to be executed GPIB PC User Manual 5 12 National Instruments Corp Section Five IBIC 6 string consists of a list of ASCII characters octal or hex bytes or special symbols The entire sequence of characters must be enclosed in quotes An octal byte consists of a backslash character followed by the octal value For example octal 40 would be represented by 040 A hex byte consists of a backslash character and a character x followed by the hex value For example hex 40 would be represented by x40 The two special symbols are r for a carriage return character and n for a linefeed character These symbols provide a more convenient method for inserting the 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 previous
79. PIB PC Appendix D Examples System PRINT FILE COPY FILE LPT1 BASIC 10 LPRINT hello 10 OPEN LPT1 FOR OUTPUT AS 1 20 PRINT 1 it works GPIB PC User Manual D 2 National Instruments Corp Appendix E Application Notes Application Note 1 Computer to Computer Data Transfer A common application in the laboratory is the transfer of data between two computers The GPIB performs this function quite readily The following discussion illustrates the data transfer between two computers called master and slave Step 1 Configure the Computers 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 GPIBO to 1 Exit the IBCONF programs and reboot both computers Step 2 Establish Communication Run the IBIC facility on both computers type the respective commands and press the enter key Example Master Slave ibfind SLAVE 3 ibfind GPIBO National Instruments Corp E I GPIB PC User Manual Application Notes Appendix E Each computer finds the appropriate device and should respond as follows Example Master Slave SLAVE GPIBO Step 3 Transfer Data In this examp
80. RINT DVM ERROR STOP END National Instruments Corp 4A 113 GPIB PC User Manual Section Five IBIC The IEEE 488 Bus Interactive Control program IBIC allows you to control and communicate with the GPIB through functions you enter at the keyboard This feature helps you establish communication with the device troubleshoot problems and develop the application IBIC functions include most of the GPIB PC functions described in Sections Three and Four plus auxiliary functions used only by IBIC In IBIC the user 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 you learn how to use the GPIB PC functions to program your device Once you develop a sequence of steps that works successfully for your system you can easily incorporate the sequence into an application program using the appropriate language and syntax described in Section Four National Instruments Corp 5 1 GPIB PC User Manual IBIC Section Five Running IBIC The IBIC program IBIC EXE is an executable file that was copied from the distribution diskette to a subdirectory called GP IB PC when you ran IBST
81. RTF BD FLNAMES IBWRTI BD IARR 0 CNTS IBWRTIA BD IARR 0 CNTS The first argument of all function calls except IBF IND is the integer variable BD which serves as a unit descriptor Refer to the IBF IND function description and Section Three for additional information on the use of this unit descriptor Table 4A 2 contains a complete list of the QuickBASIC GPIB calls their parameters and a short description of each 1 0 Ka 3 0 Table 4A 2 QuickBASIC GPIB PC Calls Description CALL Function Syntax hange access board of device IBBNA BD BNAMES ecome Active Controller IBCAC BD V D lear specified device string nable disable DMA hange disable EOS mode nable disable END message BD V IBFIND BDNAMES BD continues GPIB PC User Manual 4A 8 National Instruments Corp Section Four A BASICA QuickBASIC GPIB PC Function Calls 1 0 Ka 3 0 Table 4A 2 QuickBASIC GPIB PC Calls cont Description CALL Function Syntax ass control IBPCT BD arallel poll configure IBPPC BD V Read data to string BD RDS Read data asynchronously to string IBRDA BD RDS IBRDF BD F LNAME IBRDI BD VARPTR IARR 0 CNT IBRDIA BD VARPTR IARR CNTS onduct a parallel poll IBRPP D PPR BRS D3 V D3 SPR D V D V D2 DS V BSTOP BD D V ASK V DS BD MASKS D WRTS BD WRTS F BD FLNAMES IBWRTI BD VARPTR IARR
82. Remarks BD specifies a device or an interface board V specifies the EOS character and the data transfer termination method according to Table 4A 5 IBEOS is needed only to alter the value from its configuration setting The assignment made by this function remains in effect until IBEOS is called again the IBONL or IBF IND 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 High Byte Low Byte 00000100 EOS 0000100 0001000 all read and write function Methods A and C determine how read operations terminate If Method A alone is chosen reads terminate when the low 7 bits of the byte that is read match the low 7 bits of the EOS character If Methods A and C are chosen a full 8 bit comparison is used EOS EOS 00000100 _ aaa E 00010000 _ eo Do GPIB PC User Manual 4A 26 National Instruments Corp Section Four A BASICA QuickBASIC GPIB PC Function Calls Methods B and C together determine when write operations send the END message If Method B alone is chosen the END message is sent automatically with the EOS byte when the low 7 bits of that byte match the low 7 bits of the EOS character If Methods B and C are chosen a full 8 bit comparison is used Note that defining an EOS byte for a device or board does not cause the handler to automatically s
83. The Active Controller conducts a parallel poll by asserting the EOI signal to send the Identify IDY message While this message is active each device which has been configured to participate in the poll responds by asserting a predetermined 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 Parallel Poll Enable PPE message in effect for each device The GPIB PC is capable of receiving this message either locally via the IBPPC function or remotely via a command from the Active Controller Once the PPE message is executed the IBIST function changes the sense at which the line is driven during the parallel poll and in this fashion the GPIB PC can convey a one bit device dependent message to the Controller When IBIST is called and an error does not occur the previous value of ist is stored in IBERRS Refer also to IBPPC and Table 2 1 GPIB PC User Manual 4A 36 National Instruments Corp Section Four A BASICA QuickBASIC GPIB PC Function Calls Board Examples 1 Set the individual status bit 100 V 1 Any non zero value will do 110 CALL IBIST BRDO V 2 Clear the individual
84. When BD specifies a device all devices on its GPIB are polled in parallel using the access board of that GPIB This is done by executing the board IBRPP function with the appropriate access board specified 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 to polling It remains Active Controller afterward In the examples that follow some of the GPIB commands and addresses are coded as printable ASCII characters When the values to be sent over the GPIB correspond to printable ASCII characters this is the simplest means of specifying the values Refer to Appendix A for conversions of numeric values to ASCII characters GPIB PC User Manual 4A 64 National Instruments Corp Section Four A BASICA QuickBASIC GPIB PC Function Calls Device Example 1 Remotely configure the device LCRMTR to respond positively on DI03 if its individual status bit is 1 and then parallel poll all configured devices 100 V H6A 110 CALL IBPPC LCRMTR V 120 CALL IBRPP LCRMTR PPR Board Examples 1 Remotely configure the device BRDO at listen address amp H23 ASCII
85. ace board in the computer See Board Function DIO1 DIO8 The GPIB lines that are used to transmit command or data bytes from one device to another GPIB PC User Manual G 2 National Instruments Corp Glossary DMA or DIRECT MEMORY ACCESS High speed data transfer between the GPIB PC and memory that is not handled directly by the CPU Not available on some systems See Programmed I O DRIVER Common term for software used to manipulate a device or interface board See Handler END or END MESSAGE A message that signals the end of a data string END is sent by asserting the GPIB End or Identify EOI line with the last data byte EOI A GPIB line that is used to signal either the last byte of a data message END or the parallel poll Identify IDY message EOS or EOS BYTE A 7 or 8 bit end of string character that is sent as the last byte of a data message GET or GROUP EXECUTE TRIGGER A GPIB command to trigger a device or internal function of an addressed Listener GPIB or GENERAL PURPOSE 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 National Inst
86. action necessary to fix the problem Currently the applications monitor is only supported by the Revision C 5 1 and later versions of the GPIB Rev C handler Installing the Applications Monitor The applications monitor is included on the distribution diskette as the file APPMON COM To install it type the following command in response to the DOS prompt APPMON If the GPIB handler is not present or the monitor has been previously installed it will not load and an error message will be printed Once run the monitor will 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 special GPIB handler call IBTRAP This call can be made either from the application program or from the special utility program called IBTRAP EXE Both the function call and the DOS utility allow you to select a mask which determines those functions which will be trapped and a monitor mode which selects what is to be displayed when a call is trapped The exact syntax of the function call is dependent on the language you are using See the description of IBTRAP in your language section for details on includ
87. addressing has been done GPIB PC User Manual 4A 52 National Instruments Corp Section Four A BASICA QuickBASIC GPIB PC Function Calls Board Examples 1 Read 56 bytes of data from a device at talk address amp H4C ASCII L and then unaddress it the GPIB PC listen address is amp H20 or ASCII space 100 REM Perform addressing in preparation 110 REM for board read 120 CMDS L UNL MLA TAD 130 CALL IBCMD BRDO CMDS 140 REM Perform board read 150 RDS SPACES 56 160 CALL IBRDA BRDO RDS 170 REM Perform other processing here then 180 REM wait for I O completion or a 190 REM timeout 200 MASK amp H4100 TIMO CMPL 210 CALL IBWAIT BRDO 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 the Talker and Listener 270 CMDS _ UNT UNL 280 CALL IBCMD BRD0 CMD 2 To terminate the read on an end of string character see IBEOS examples National Instruments Corp 4A 53 GPIB PC User Manual BASICA QuickBASIC GPIB PC Function Calls Section Four A BASICA QuickBASIC BASICA QuickB ASIC IBRDF IBRDF Purpose Read data from GPIB into file Format CALL IBRDF BD FLNAMES Remarks BD specifies a device or an interface board FLNAMES is the filename under which the data is stored FLNAMES may be up to 50 characters long in
88. al Operation of the GPIB Section One ee O fro HHI SU fsesscay Figure 1 3 Star Configuration GPIB PC User Manual 1 8 National Instruments Corp Section One Operation of the GPIB Configuration Requirements To achieve the high data transfer rate that the GPIB was designed for the physical distance between devices and the number of devices on the bus are limited The following restrictions are typical e A maximum separation of four meters between any two devices and an average separation of two meters over the entire bus e A maximum total cable length of 20 meters e No more than 15 devices connected to each bus with at least two thirds powered on Bus extenders are available from National Instruments and other manufacturers for use when these limits must be exceeded Related Documents For more information on topics covered in this section consult the following related documents e IEEE Std 488 1978 IEEE Standard Digital Interface for Programmable Instrumentation e GPIB PC Technical Reference Manual National Instruments Corp 1 9 GPIB PC User Manual Section Two Installation and Configuration The procedures for installing your GPIB PC depend on your model of board and your make of computer A supplement to Section Two contains information about your interface board Section Two A for example contains information about the model GPIB PCIIA for the IBM PC and compatible computers In
89. allel poll configure Read data to string to string Read data to file onduct a parallel poll Return serial poll byte Request service hange secondary address end interface clear et clear remote enable line Abort asynchronous operation hange disable time limit onfigure applications monitor rigger selected device Open device and return unit descripto Go from Active Controller to standb Gotolocal ooo y o Read data to string o Read data asynchronousl Read data to file o o Read data to integer array Read data asynch to integer array Request release system control continues National Instruments Corp 4A 7 BASICA QuickBASIC GPIB PC Function Calls GPIB PC Functions BDS IBCMDA BD CMDS A BD S T o H H wW Qa H H UO oe HH wW O Z ag o lt oP J ol w go D lt S i w wW U j MIO Q H LILILO f J ol fo lt x oe HTH IH w wW ven OO D a w w jw jo OYTO Joe 0 Jole JN ve iw D EJ V RDS ELNAMI BRDF IBRDI BD IARR 0 CNT IBRDIA BD IARR 0 CNTS IBRSV BD V BDS V pA D V J oe J oe H WU H H w w NIN H gt ajo w w w O o j H wW n ve lala E H GPIB PC User Manual BASICA QuickBASIC GPIB PC Function Calls Section Four A Table 4A 1 BASICA GPIB PC Functions continued IBW
90. alls which attempt to alter or make use of capabilities that are unalterable at runtime National Instruments Corp 4 9 GPIB PC User Manual GPIB PC Functions Overview Section Four EFSO 12 EBUS 14 ESTB 15 ESRQ 16 EFSO results when an IBRDF or IBWRTF call encounters a problem performing a file operation Specifically this error indicates the function was unable to open create seek write or close the file being accessed The specific DOS error code for this condition is contained in IBCNT EBUS results when certain GPIB bus errors occur during device level calls It is necessary in all device calls for the handler to send command bytes to perform addressing serial polls and to send other bus management information Devices are expected to accept these command bytes within the time limit specified by the configuration program or by IBTMO EBUS occurs if a timeout occurred during the sending of these command bytes Under normal operating circumstances the remedy would be to find out which GPIB device is accepting commands abnormally slowly and fix the problem with that device In situations in which slow handshaking of the commands is desirable lengthen the time limit either with the configuration program or the IBTMO function ESTB 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
91. am 100 CALL IBSIC BRDO National Instruments Corp 4A 73 GPIB PC User Manual BASICA QuickBASIC GPIB PC Function Calls Section Four A BASICA QuickBASIC BASICA QuickB ASIC IBSRE IBSRE Purpose Set or clear the Remote Enable line Format CALL IBSRE BD V Remarks BD specifies an interface board If V is non zero the Remote Enable REN signal is asserted If V is zero the signal is unasserted The IBSRE function turns the REN signal 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 Examples 1 Place the device at listen address amp H23 ASCII in remote mode with local ability to return to local mode 100 V 1 Any non zero value will do 110 CALL IBSRE BRDO V 120 CMDS LAD 130 CALL IBCMD BRDO CMDS GPIB PC User Manual 4A 74 National Instruments Corp Section Four A BASICA QuickBASIC GPIB PC Function Calls 2 To exclude the local ability of the device to return to local mode send the Local Lockout LLO or amp H11 command or include it in the command string at 120 in Example 1 100 CMDS CHRS amp H
92. ameters you may achieve a variety of trapping configurations The following are some examples IBTRAP cic atn dis IBTRAP srq rec IBTRAP dis IBTRAP off record all GPIB handler calls and display the monitor whenever attention is asserted or the GPIB PC Controller in Charge record all GPIB handler calls and set the trap mask to trap when SRQ is on Do not display the monitor when a trap condition exists record all GPIB handler calls and display the monitor whenever a trap condition exists The trap mask remains unchanged disable the monitor No recording or trapping is performed See Section Four of the Programming Language Supplement for the appropriate syntax to use in your application program GPIB PC User Manual 6 4 National Instruments Corp Section Six IBIC Applications Monitor Options When displayed the applications monitor allows you to view the parameters of the current GPIB call change the display and trap modes and scan the GPIB session summary The monitor displays the following information pertinent to the current GPIB call Device Function Value Count IBSTA IBERR IBCNT Buffer Value Status Error Information symbolic device name GPIB PC function mnemonic and description for functions that have a number as their second parameter this contains its value otherwise it is undefined for functions that have a count as their third paramete
93. ardware addressing scheme Board is System Controller Boards Only This field appears on the board characteristics screen only Generally the GPIB PC will be the System Controller In some situations such as in a network of computers linked by the GPIB another device may be System Controller and the GPIB PC will NOT be designated System Controller A yes response designates the GPIB PC to be System Controller A no response designates it not to be System Controller GPIB PC User Manual 2 14 National Instruments Corp Section Two Installation and Configuration Local Lockout on all Devices Boards Only It is desirable to place many devices in the local lockout state while they are being remotely accessed If yes is selected the access board will place all of its devices in local lockout state while accessing them Disable Auto Serial Polling Boards Only This option allows you to disable automatic serial polls if this feature is incompatible with certain devices on the bus While this feature is on the handler conducts serial polls of the devices and stores positive responses whenever the GPIB Service request SRQ line is asserted Refer to Automatic Serial Polling of Section Four for further information Normally this feature will not conflict with devices that conform to the TEEE 488 specification High Speed Timing Boards Only Some devices are unable to read data messages at high speed Tri state timing If your GPIB
94. at CALL IBSAD BD V Remarks BD specifies a device or an interface board If V isa number between amp H60 and amp H7E that number becomes the secondary GPIB address device or interface board If V is amp H7F or zero secondary addressing is disabled IBSAD is needed only to alter the value from its configuration setting The assignment made by this function remains in effect until IBSAD is called again the IBONL or IBF IND 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 IBERRS Device IBSAD Function When BD amp specifies a device the function enables or disables extended GPIB addressing for the device When secondary addressing is enabled IBSAD records the secondary GPIB address of that device to be used in subsequent device I O function calls Board IBSAD Function When BD specifies an interface board the IBSAD function enables or disables extended GPIB addressing and when enabled assigns the secondary address of the GPIB PC Refer also to IBPAD IBONL and Table 2 1 National Instruments Corp 4A 71 GPIB PC User Manual BASICA QuickBASIC GPIB PC Function Calls Section Four A Device Examples 1 Change the secondary GPIB address of the device PLOTTER from its current value to amp H6A ole 100 V amp H6A 110 CALL IBSAD PLOTTER V 2 Disable secondary addressing for the device DVM 100 V 0
95. at fact IBGTS should almost never be called except immediately after an IBCMD call IBCMD causes ATN to be asserted EARG results when an invalid argument is passed to a function call The following are some examples IBTMO called with a value not in the range 0 17 IBEOS called with meaningless bits set in the high byte of the second parameter IBPAD or IBSAD called with illegal addresses IBPPC called with illegal parallel poll configurations A board only call made with a valid device descriptor or a device only call made with a valid board descriptor NOTE EDVR is returned if the descriptor is invalid ESAC results when IBSIC or IBSRE is called when the GPIB PC User Manual 4 8 National Instruments Corp Section Four GPIB PC Functions Overview GPIB PC does not have System Controller capability The remedy is to give the GPIB PC that capability by calling IBRSC or by using IBCONF to configure that capability into the handler EABO 6 EABO indicates that I O has been canceled usually due to a timeout condition Other causes are IBSTOP being called or the Device Clear message being received from the CIC To remedy a timeout error if I O is actually progressing but times out anyway lengthen the timeout period with IBTMO More frequently however the I O is stuck the Listener is not continuing to handshake or the Talker has stopped talking or the byte count in the call which timed out was more tha
96. at the end of this section National Instruments Corp 3 9 GPIB PC User Manual GPIB PC Functions Introduction Section Three IBFIND bdname bd This is the same as the Group I function except that boards are assigned names at configuration time in the form GP1Bn where n is a board s decimal number 0 1 2 within the computer For instance in a system with two GPIB boards the first is named GPIBO and the second GPIB1 IBCMD bd buf cnt and IBCMDA bd buf cnt Both functions use the specified board to write commands from memory to the GPIB The messages are sent synchronously using IBCMD and asynchronously using IBCMDA These command functions are used for example to address and unaddress GPIB devices and to send interface messages that enable and disable devices for serial and parallel polls that clear and trigger devices and that lock out front panel control of devices IBRD bd buf cnt and IBRDA bd buf cnt Both functions use the specified board to read from a device that has already been addressed to talk for example by the IBCMD or IBCMDA function The syntax for these low level functions is the same as their high level counterparts of Group I and III The software automatically differentiates bd descriptors that refer to devices from those that refer to boards and executes the read operations appropriately IBRDI and IBRDTA are also available in BASIC for binary transfers to an integer array GP
97. ational Instruments products are not designed with components and testing intended to ensure a level of reliability suitable for use in treatment and diagnosis of humans Applications of National Instruments products involving medical or clinical treatment can create a potential for accidental injury caused by product failure or by errors on the part of the user or application designer Any use or application of National Instruments products for or involving medical or clinical treatment must be performed by properly trained and qualified medical personnel and all traditional medical safeguards equipment and procedures that are appropriate in the particular situation to prevent serious injury or death should always continue to be used when National Instruments products are being used National Instruments products are NOT intended to be a substitute for any form of established process procedure or equipment used to monitor or safeguard human health and safety in medical or clinical treatment Preface Introduction to the GPIB The GPIB is a link or bus or interface system through which interconnected electronic devices communicate History of the GPIB The original GPIB was designed by Hewlett Packard where it is called the HP IB to connect and control programmable instruments manufactured by Hewlett Packard Because of its high data transfer rates of from 250 kilobytes to 1 megabyte per second the GPIB quickly gained popularity in ot
98. bling timeouts should be done only when setting MASK 0 or when it is certain the selected event will occur otherwise the processor may wait indefinitely for the event to occur GPIB PC User Manual 4A 84 National Instruments Corp Section Four A BASICA QuickBASIC GPIB PC Function Calls Table 4A 4 Wait Mask Layout 8000 4000 2000 IC T ACS ACS DTAS GPIB PC is in device trigger state DCAS GPIB PC is in device clear state Device IBWAIT 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 service bit amp H40 is set in the status byte Note that an IBWAIT on RQS should only be done on those devices that respond to serial polls If the TIMO bit of the mask is also set IBWAIT returns if SRQ is not asserted within the device s timeout period The serial polls are conducted with the board functions IBCMD and IBRD Board IBWAIT Function When BD specifies a board all bits of the wait mask and status word are applicable except RQS National Instruments Corp 4A 85 GPIB PC User Manual BASICA QuickBASIC GPIB PC Function Calls Section Four A Device Example 1 Wait indefi
99. bpad v db 3 Pass control ibpot d a f __ Parallel poll configure libppc v d d 3 Read data Jibrav o 6 Read data asynchronously fibrda v_ db 6 7 Read data to file ibrdf flname Conduct a parallel pol ibrpp dbo Configure applications monitor__ ibtrap db 1 Request release system control ibrsc vl b 23 Return serial poll byte __ ibrsoe da continues GPIB PC User Manual 5 8 National Instruments Corp Section Five IBIC Table 5 1 Syntax of GPIB Functions in IBIC continued Requestscnvice Change seconday address ibsad v Send interface clear S Abort asynchronous operation Change disable time limit Configure applications monitor ibtrap mask v Trigger selected device mask stringd eben as a string finame et clear remote enable line NOTES 1 bname is the symbolic name of the new board e g ibbna gpibl 2 Values enclosed in square brackets are optional The default value is O 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 be enclosed in quotes An octal byte consists of a backslash character followe
100. c Return to DOS GPIB PC User Manual 5 26 National Instruments Corp Section Five IBIC Example GPIBO e National Instruments Corp 5 27 GPIB PC User Manual Section Six Applications Monitor The applications monitor is a memory resident program which is useful in debugging sequences of GPIB calls from within your application The monitor provides the capability to trap on return from GPIB driver calls allowing you to inspect function arguments buffers return values GPIB global variables and other pertinent data 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 view a listing of up to 255 of the preceding calls to verify that the sequence of calls and their arguments have occurred as intended Figure 6 1 Applications Monitor Popup Screen National Instruments Corp 6 1 GPIB PC User Manual IBIC Section Six In many cases use of the applications monitor allows you to omit explicit error checking code from the application If a program is expected to run without errors trapping on errors will cause the monitor to be invoked only if an error occurs during a GPIB call You may then take the
101. ce 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 IBCNTS is the actual number of data bytes written to the device and IBERR is the first error detected if the ERR bit in IBSTA is set Board IBWRT Function When BD specifies an interface board the IBWRT function attempts to write to a GPIB device that is assumed to already be properly initialized and addressed If the access board is CIC the IBCMD function must be called prior to IBWRT to address the device to listen and the board to talk Otherwise the device on the GPIB that is the CIC must perform the addressing National Instruments Corp 4A 87 GPIB PC User Manual BASICA QuickBASIC GPIB PC Function Calls Section Four A If the access board is Active Controller the board is first placed in Standby Controller state with ATN off and remains there after the write operation is completed Otherwise the write operation commences immediately An EADR error results if the board is CIC but has not been addressed to talk with the IBCMD function An EABO error results if the board is not the CIC and is not addressed to talk within the time limit An EABO error also results if the operation does not complete for whatever reason wi
102. ck IBSTAS to see how the read 150 REM terminated on CMPL END TIMO or 160 REM ERR 170 REM Data is stored in RDS 180 REM Unaddress the Talker and Listener L90 CMDS _ UNT UNL 200 CALL IBCMD BRD0 CMD 2 To terminate the read on an end of string character see IBEOS examples National Instruments Corp 4A 49 GPIB PC User Manual BASICA QuickBASIC GPIB PC Function Calls Section Four A BASICA QuickBASIC BASICA QuickBASIC IBRDA IBRDA Purpose Read data asynchronously to string Format CALL IBRDA BD RDS Remarks BD specifies a device or an interface board RD identifies the storage buffer for data bytes that are read from the GPIB The IBRDA function reads from 1 to 255 bytes of data from a GPIB device In QuickBASIC the IBRDA function reads from 1 to 32K bytes of data from a GPIB device IBRDA is used in place of IBRD when the application program must perform other functions while processing the GPIB I O operation IBRDA returns after starting the I O operation If the number of bytes to read is small and the bytes are 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 IBSTAS 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
103. ckBASIC Using board function calls COMMON SHARED IBSTA IBERR S IBCNT REM REM Assign a unique identified to board 0 and REM store in variable BRDO REM BDNAMES GPIBO CALL IBFIND BDNAMES BRDO REM REM Check for error on IBFIND call REM IF BRDO S lt 0 THEN GOSUB FIND ERROR REM REM Send the Interface Clear IFC message to REM all devices REM CALL IBSIC BRDO REM REM Check for an error on each GPIB call REM to be safe REM IF IBSTA S 0 THEN GOSUB GPIB ERROR REM REM Turn on the Remote Enable REN signal REM VS 1 CALL IBSRE BRDO0 V IF IBSTA S lt 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 clear REM internal device functions and address the REM GPIB PC to talk REM CMD CHRS amp H11 CHRS amp H14 CALL IBCMD BRD0 CMDS IF IBSTA S lt 0 THEN GOSUB GPIB ERROR REM REM Write the function range and trigger REM source instructions to the DVM REM WRTS F3R7T3 CALL IBWRT BRDO WRTS National Instruments Corp 4A 111 GPIB PC User Manual BASICA QuickBASIC GPIB PC Function Calls Section Four A I N N N IF IBSTA lt 0 THEN GOSUB GPIB ERROR D N NNN J D D I d yA J D D DID AA amp zal EM EM
104. ckBASIC language interfaces and other programs e A GPIB PC User Manual The manual contains descriptions of the GPIB PC handler functions BASICA and QuickBASIC language interfaces to the handler e A Programmer Reference Guide for BASIC e A supplement to Section Two of the manual describing your particular interface board and how to install it in your personal computer For a language other than BASICA and QuickBASIC you also need e An additional GPIB PC distribution diskette containing the software for that language e A supplement to Section Four describing the GPIB functions in the syntax and semantics of that language e A Programmer Reference Guide for that language Who Are Our Users Most of our users have experience in technological fields and with computers How to Get Started If you already have experience with the GPIB you may wish to turn directly to the Getting Started with your GPIB PC pamphlet that was shipped with your hardware It contains directions with a minimum of explanations for installing your hardware and software in your GPIB system If you are less experienced or want more information than the pamphlet provides read this GPIB PC User Manual It explains in detail all of the information you will need for the proper operation of the GPIB PC GPIB PC User Manual vi National Instruments Corp Preface About the Manual This manual is written specifically for a GPIB PC which is to be
105. clarations complete with parameter list specifications to aid in type checking at compile time You must include this file in all application programs using GPIB calls In general the functions behave identically to the subroutines with the few exceptions noted in the following paragraph The description of each subroutine found in the GPIB PC User Manual can be applied to the new functions except for the syntax specific information GPIB PC User Manual 4A 12 National Instruments Corp Section Four A BASICA QuickBASIC GPIB PC Function Calls There are a few differences between the existing subroutines and the new functions ILFIND returns a descriptor associated with the specified device Use this value in all subsequent functions calls that access that device Normal usage would resemble the following BD ILFIND GPIBO ILCMD ILCMDA ILRD ILRDA and ILWRTA require a third parameter which specifies the number of bytes to transfer The function syntax is as follows LCMD BD CMDS CNTS LCMDA BD CMDS CNTS LRD BD RD CNT3 LRDA BD RDS CNT3 LWRT BD WRT CNT3 LWRTA BD WRTS CNT3 All functions except ILFIND return the value of IBSTA This permits the following construct IF IBRD BD RD CNT lt 0 THEN CALL GP IBERROR Table 4A 4 contains a complete list of the new QuickBASIC GPIB functions their parameters and a short description of each National Instruments
106. cluding a drive and path designation IBRDF automatically opens the file as a binary file as opposed to a character file If the file does not exist IBRDF creates it On exit IBRDF closes the file An EFSO error results if it is not possible to open create seek write or close the file being referenced Device IBRDF 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 function is called which attempts to read from a GPIB device that is assumed to already be properly initialized and addressed An EADR error results if the board is CIC but has not been addressed to listen with the IBCMD function An EABO error results if the board is not the CIC and is not addressed to listen within the time limit An EABO error also results if the device that is to talk is not addressed and or the operation does not complete for whatever reason within the time limit GPIB PC User Manual 4A 54 National Instruments Corp Section Four A BASICA QuickBASIC GPIB PC Function Calls The board IBRDF operation terminates on any of the following events e Error is detected Time limit
107. d Configuration device is automatically terminated when END is received No end of string character is recognized e The time limit on I O and wait function calls is approximately 10 seconds e GPIBO is a Model GPIB PCH is at base I O address hex 02B8 and uses DMA Channel and TLC Interrupt Line 7 e You must run IBCONF if you are using a GPIB PCIIA or if you have changed the hardware switches jumpers on any GPIB PC from the factory settings Otherwise it is unnecessary to run IBCONF Consult the appropriate supplement to Section Two of the user manual to find the factory settings of your GPIB PC model Running IBCONF When you ran IBSTART a copy of IBCONF EXE was placed on your boot drive To run IBCONF go to the root directory of the boot drive and enter ibcont If you have a color monitor the configuration program will automatically appear in color If you have a color monitor but want the configuration program to appear in monochrome enter ibconft m IBCONF scans the handler file GPIB COM and reads its data structures into memory After you press a key the program displays the Device Map for board GPIBO National Instruments Corp 2 9 GPIB PC User Manual Installation and Configuration Section Two IBCONF makes changes to the GPIB COM file which should also be in the root directory If you want IBCONF to make changes to a different copy of GPIB COM such as GPIB2 COM enter the path and name of t
108. d by the octal value For example octal 40 would be represented by 40 A hex byte consists of a backslash character and a character x followed by the hex value For example hex 40 would be represented by x40 The two special symbols are r for a carriage return character and n for a linefeed character These symbols provide a more convenient method for inserting the carriage return and linefeed National Instruments Corp 5 9 GPIB PC User Manual IBIC Section Five characters into the string as shown in the following string F3R5T1 r n Since the carriage return can be represented equally well in hex xD and r are equivalent strings bdname is the symbolic name of the new device or board for example ibfind devlorset gpib0 v is the number of bytes to read flname is the DOS pathname of the file to be read or written e g test meter orprintr buf 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 devl ibwrt f2t3x 900 rqs cmpl COUNT 5 devi In this example the status word shows that the device level write operation completed successfully and that dev1 is requesting service Table 5 2 lists the mnemonics of the status word This is the same list that is given in Table 4 1 GPIB PC User Manual 5 10 National Instrum
109. d gpib0O are default names found in the handler IBIC makes no distinction between uppercase and lowercase National Instruments Corp 5 3 GPIB PC User Manual IBIC Section Five Using IBWRT The IBWRT command sends data from one GPIB device to another For example to send a data string from the computer to a device called dev1 the following command would suffice Example dev1l ibwrt F3R5T1 0100 cmpl count 6 This command 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 dev1 ibrd 20 2100 end cmpl count 18 4E 44 43 56 28 30 30 30 NDCV 000 2E 30 30 34 37 45 2B 30 0047E 0 OD OA e e GPIB PC User Manual 5 4 National Instruments Corp Section Five IBIC This command receives data from the device and displays it on the screen in hexadecimal format and provides its ASCII equivalent along with information about the data transfer such as the Status Word and the Byte Count How to Exit IBIC Typing e or q will return you to DOS Important Programming Note Some GPIB instruments require special termination characters or End of String EOS characters to
110. d one device at a time Messages are not broadcast to several devices at once and devices do not talk to each other directly e Devices do not require special services or operations such as polling or triggering to send or receive data IBRD and IBWRT are high level input output I O functions IBFIND is a start up function that opens the device IBRD bd buf cnt IBRD reads a specified number of bytes from a device and stores them in memory The device is automatically addressed before reading and unaddressed afterward If not done previously the GPIB is initialized on entering the function and the device is placed in remote programming mode When programming in BASIC IBRD performs string transfers IBRDI is available for binary transfers to an integer array IBWRT bd buf cnt IBWRT writes a specified number of bytes from the memory buffer to a device The device is automatically addressed before writing and unaddressed afterward If not done previously the GPIB is initialized on entering the function and the device is placed in remote programming mode When programming in BASIC IBWRT performs string transfers IBWRTI is available for binary transfers from an integer array GPIB PC User Manual 3 2 National Instruments Corp Section Three GPIB PC Functions Introduction IBFIND bdname bd IBFIND returns a unit descriptor associated with the name of the device When the software is installed a description o
111. dresses an active Talker WARM BOOT See Boot National Instruments Corp G 7 GPIB PC User Manual Index repeat previous function 5 14 execute indirect file 5 17 turn ON display 5 15 turn OFF display 5 14 A Applications Monitor 6 1 APPMON COM 2 2 IBTRAP 6 2 IBTRAP EXE 2 2 Installation 6 2 Main Commands 6 6 Options 6 5 Session Summary 6 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 Address 2 12 Timeout Settings 2 12 Boot from floppy disk 2 3 from hard disk 2 3 Byte count 5 12 National Instruments Corp E 1GPIB PC User Manual Index C Calling Syntax 3 1 Characteristics device board 2 11 each GPIB 2 7 electrical GPIB 1 5 instruments 2 7 physical GPIB 1 5 Clearing device 3 4 the GPIB 3 4 Concepts and terms device map 2 11 Configuration requirements 1 9 linear 1 7 star 1 8 Configurations default 2 8 Controller In Charge 1 2 Count 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
112. e 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 assumed to be already properly initialized and addressed An EADR error results if the board is CIC but has not been addressed to talk with the IBCMD function An EABO error results if the board is not the CIC and is not addressed to talk within the time limit An EABO error also results if the operation does not complete for whatever reason within the time limit An ENOL error occurs if there are no listeners on the bus when the data bytes are sent National Instruments Corp 4A 93 GPIB PC User Manual BASICA QuickBASIC GPIB PC Function Calls Section Four A The board IBWRTF operation terminates on any of the following events e All bytes sent e Error is detected e Time limit is exceeded or e 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 written modulo 65 536 Device Example 1 Write data to the device RDR from the file Y DAT on the current disk drive 100 110 Board Example FLNAMES Y DAT CALL IBWRTF RDR S FLNAMES 1 Write data to the device at listen address amp H2C ASCII from the file Y DAT on the current drive and then unaddress
113. e 2 1 Timeout Settings Actual Value 0 l 2 3 4 5 6 7 l NOTE If you select TNONE no limit will be in effect 1000 sec 7 1 I l I I I I National Instruments Corp 2 13 GPIB PC User Manual Installation and Configuration Section Two EOS Byte Some devices can be programmed to terminate a read operation when a selected character is detected A linefeed character hex OA is a popular one NOTE To send the EOS character to a device in a write operation you must explicitly include that byte in your data string EOS Modes e Terminate a Read on EOS Some devices send an EOS byte signaling the last byte of a data message A yes response will cause the GPIB PC to terminate read operations when it receives the EOS byte e Set EOI with EOS on Write A yes response will cause the GPIB PC to assert the EOI send END line when the EOS character is sent e 7 or 8 bit compare on EOS Along with the designation of an EOS character you may specify whether all eight bits are compared to detect EOS or just the seven least significant bits ASCII or ISO format Set EOI with last byte of Write Some devices as Listeners require that the Talker terminate a data message by asserting the EOI signal line sending END with the last byte A yes response will cause the GPIB PC to assert EOI on the last data byte GPIB PC Model The GPIB PC Model must be specified so that the handler will use the appropriate h
114. e Messages are broadcast to more than one device at a time e Messages are sent directly from one device to another without passing through the Controller e GPIB lines such as Attention ATN must be turned off or on in a particular fashion to ensure proper operation of a device e Devices must be polled in parallel rather than in serial Purpose of Board Functions The handler software can control or communicate over the GPIB only by manipulating a GPIB PC interface board Remote devices are accessed indirectly by programming the interface board to do specific things Device functions are selected sequences of some basic board functions Board functions provide the precise control of the GPIB that is needed for special applications Multiboard Capability The handler can control or manipulate more than one interface board This type of handler is commonly called a multiboard handler as opposed to a single board handler in which one copy of the handler can control only one board Figure 3 1 shows a multiboard GPIB system with board GPIBO connected to two devices an oscilloscope and a digital voltmeter and with board GPIB1 connected to two other devices a printer and a plotter Each board is called the access board for its attached devices because the board is used automatically by the device functions to access those devices More information about board and device functions is provided in More About Device and Board Functions
115. e shareable interrupt capability check that another device on the same line really has the shareable interrupt capability Many do not e Ifan interrupt problem persists configure the hardware and software for non DMA or non interrupt operation You may have a PC compatible that is not totally compatible GPIB PC User Manual B amp National Instruments Corp Appendix B Common Errors and Their Solutions Error Condition IBIC reports an error on IBFIND or IBFIND returns a negative unit descriptor Solutions e Check the solutions listed for EDVR ENEB or EARG error codes e Run IBCONF from the root directory to check that the device or board name is correct Error Condition The GPIB device being programmed appears to accept the instruction but does not behave properly Solutions e Check that the instruction sent with the write function 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 e When running a program check for errors after each GPIB PC function call If an early call failed but you did not check IBSTA later functions will behave improperly and give misleading status data e Check that the board
116. e than the one just described such as a serial poll routine which polls several devices in succession and provides other servicing operations at the same time low level board functions can be used to create such a routine GPIB PC User Manual 3 14 National Instruments Corp Section Three GPIB PC Functions Introduction Group V Group V functions are used when the GPIB PC is not CIC An example is a system where the computer in which the board is installed performs as an instrument but is controlled by another device on the GPIB Group V functions are as follows e IBRSV e IBLOC e IBPPC e IBIST and IBWAIT These functions are used to e Request service from the CIC e Simulate a front panel return to local switch e Reconfigure a board or device for a parallel poll e Locally configure for parallel polls and change the parallel poll flag e Wait for the CIC to execute certain actions IBRSV bd v IBRSV requests service from the CIC and to set the status byte that is sent when the board is serially polled by the controller IBLOC bd IBLOC sends a return to local message to the board The message clears an internal remote status condition if it is set and the internal lockout status condition is not set These conditions can be checked with the IBWAIT function How the application program interprets this action is system dependent National Instruments Corp 3 15 GPIB PC User Manual GPIB PC Function
117. ection Two Installation and Configuration Device Map Concepts and Terms e Device Name contains up to seven characters The rules for naming devices are the same as DOS rules for naming files except that suffixes xxx are not allowed DOS treats uppercase and lowercase letters identically The string PLOTTER is treated the same as the string plotter For this reason the configuration program maps all lowercase letters to uppercase Device names must not be given the same names as files directories and or subdirectories If you name a device PLTR and your file system already contains the file PLTR DAT ora subdirectory PLTR a conflict results e Access Board all devices on the GPIB require an access board within the computer The access board is the GPIB PC interface board that provides the hardware link to the computer The access board name is of the form GP IBx where x is a digit 0 or 1 representing the appropriate GPIB board number The access board name is not alterable The string representing a device or board name is the first variable argument of the function IBF IND called at the beginning of your application program Refer to Sections Three and Four for detailed explanations of IBF IND Lower Level Device Board Characteristics The lower level screens display the currently defined values for characteristics such as addressing and timeout information of a device or board Instructions are available on the scree
118. eechsctecel wing Sail tea Ne Seat aieee a D 1 Tins tall Qtr om es eiee aee EE e EE See Ea VASEA E REER D 1 Appendix E Application Notes 2 12120111101011000110101011100111000 E 1 Application Note 1 Computer to Computer Data Transfer iz Step 1 Configure the Computers eee eeeeeee Step 2 Establish Communication Step 3 Transfer Data ee eeeesesseseesesscseeseeseeseseeneeneeseeees Appendix F Customer Communication F 1 GHORBAY 2 2 Gatoa nea ne Re an OL ees G 1 TDW es cscs acest scat tan E ae eta cases aa eth EEE cases aaa ee caste oo a IL 1 National Instruments Corp xv GPIB PC User Manual Illustrations List of Figures Figure 1 1 GPIB Connector and the Signal Assignment 1 6 Figure 1 2 Linear Configuration wee eecsssecessssesssseesessescssnsecsssecessneesseseees 1 7 Figure 1 3 Star Configuration wes escssssscssssesssssessssseesssneesssneessneeesssesseneees 1 8 Figure 3 1 Multiboard GPIB System esssssesssssteesssseessneeesssesseneees 3 11 Figure 6 1 Applications Monitor Popup Screen essseseseeeesseeeene 6 1 List of Tables Table 2 1 Timeout Settings on ecsssscsssseesceneessnseeesneeses Table 2 2 Functions that Alter Default Characteristics Table 4 1 Status Word Layout ecssssscsssccssssssesseessneeecssseessneesssseeseneees 4 2 Table 4 2 GPIB Error Codes esssssessssssscsscssescnseesseecsnecenseesnecsensesseescnsceenseesees 4 6 Table 4A 1 BASICA GPIB PC Functio
119. een Software Revisions Appendix C New Functions File I O functions have been added to the handler allowing data to be read into or written from a file In Interpretive BASIC integer I O functions have been added to allow the data to be stored in integer arrays instead of character strings Modified Functions IBFIND no longer uses up available DOS file descriptors so the Too Many Files error will not occur as a result of too many open boards and devices IBONL when called with a 0 no longer invalidates the unit descriptor It still disables the board or device however Language Interfaces If you customized a language interface for a compiler not 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 depends on the GPIB PC interface hardware you buy Device Functions Device I O functions do not unaddress devices at the end of the call Also the functions do not address devices known to be already addressed from the previous call This significantly improves through put on multiple reads from or multiple writes to the same device Also in Rev D if the access board is not
120. een clearing or initializing devices and clearing or initializing the GPIB itself Clearing the Device The Selected Device Clear SDC command that is sent by the IBCLR function resets internal functions of the device such as causing a digital multimeter to change its function range and trigger mode back to default settings Clearing the GPIB The Interface Clear IFC command initializes the GPIB and the bus interface circuits of all attached devices without affecting internal functions IFC is sent automatically when the first device function is called A device function is a function that references a device such as the four already described IBRD IBWRT IBRSP and IBCLR IBTRG bd IBTRG triggers the device by sending to it the Group Execute Trigger GET and appropriate addressing commands IBLOC bd IBLOC places the device in local program mode by sending the Go To Local GTL and appropriate addressing commands to the device Placing a Device in Remote Mode The first device function call after power on in addition to sending the IFC command as previously described also places the device in remote program mode by setting the GPIB Remote Enable REN line and addressing the device to listen GPIB PC User Manual 3 4 National Instruments Corp Section Three GPIB PC Functions Introduction Placing a Device in Local Mode Devices must usually be placed in remote program mode before they can be programmed fr
121. eesseeesssssesssrerssreresereessseeesss 6 5 Main Commands cece a EA 6 6 Session Summary Screen esesssesssessssssssestsesesesereressstsesesererereneetsreeseesrese 6 7 Configuring the Trap Mask sessssssssscsessssssccesssecsesssnsseccesnseccersnneeees 6 7 Configuring the Monitor Mode eeeeeeeseesesseseesesseseeseeneseeseeseseenees 6 7 Hiding and Showing the Monitor eessseeseseeeees 6 8 Appendix A Multiline Interface Messages Multiline Interface Messages csessssccceecsseseceeees Interface Message Reference List ssesssesessececeseeeeeeeeeneeeseeeeeees Appendix B Common Errors and Their Sotionns cccccceeeetetttetteeeeeesesesssccssssssssnssssnsseeeeeeeeeeeeeeeeee B 1 GPIB PC User Manual xiv National Instruments Corp Contents ESRQ 16 cccsecseeseeseeeeeee Other Error Conditions Appendix C Differences Between Software Revisions cccccscsssssssssssssssssssssssessssssceccesessessiiusssssssseeeseeesseed C 1 Non Interrupt Mode Asynchronous W O eeeseeseesseesesssessecsneescsssceseescenseesessenseenee DMA on the GPIB PCTIID esssssssscssssessseesssnseecssnsesseesnnesees C 3 Eocal TOC Otic toes dc waned tpi EEE EES C 3 SROPStatus Bit ecccusseitmec gininaraen diana C 3 ATN and or TIMO Q esssesccssseeeeeee C 3 DCAS and DTAS Status Bits C 3 Printer SUpport ene niie errea E e EE as C 3 Appendix D Using your Printer with the GPIB PC a ilescs
122. eginning of buffer End scroll to end of buffer National Instruments Corp 6 7 GPIB PC User Manual IBIC Section Six Session Summary Screen This session summary can be viewed by pressing F2 Once displayed the following keys can be used to manipulate the display Cursor Up scrolls summary up one line Cursor Down scrolls summary down one line Page Up scrolls summary up one page Page Down scrolls summary down one page Home scrolls to the top of summary End scrolls to the end of summary Escape or F2 exit the session summary display and return to the main monitor screen Configuring the Trap Mask Pressing F5 allows you to change the current 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 every call while turning them all off causes no trapping to occur Configuring the Monitor Mode Pressing F6 allows you to change the current configuration of the monitor mode It yields a popup menu with the current mode checkmarked Use the up and down arrow keys to highlight the new mode and press ENTER to record the change Pressing ESCAPE will cancel this action and leave the mode unchanged GPI
123. end 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 Refer also to IBEOT and Table 2 1 Device Example 1 Send END when the linefeed character is written to the device DVM 10 EOSV S amp HOA EOS info for IBEOS 100 V EOSVS amp H0800 110 CALL IBEOS DVM V 120 WRTS 123 CHRS amp HOA 130 Data bytes to be 140 written EOS 150 character is the 160 last byte 170 CALL IBWRT DVM WRTS National Instruments Corp 4A 27 GPIB PC User Manual BASICA QuickBASIC GPIB PC Function Calls Section Four A Board Examples 1 Program the interface board BRDO to terminate a read on detection of the linefeed character amp HOA that is expected to be received within 200 bytes 10 EOSV amp HOA 100 V EOSV amp HO400 110 CALL IBEOS BRDOS V 120 REM Assume board has been addressed do 130 RE board read 140 RDS SPACES 200 150 CALL IBRD BRDO RD 160 RE The END bit in IBSTA is set if the 170 REM read terminated on the EOS 180 REM character The value of IBCNTS 190 R
124. entify interface clear local lockout my listen address my secondary address my talk address other secondary address other talk address primary command group parallel poll configure parallel poll disable parallel poll enable parallel poll response n parallel poll unconfigure remote enable ready for data request service selected device clear serial poll disable serial poll enable service request status byte take control unlisten untalk National Instruments Corp A 5 Interface Function s continued RL SH via L LE DC T TE T TE via C via L LE C L LE C AH SH via C via C via C C C via C via C via C via C via C via C via C via C via C via C PP via C C AH T TE via C via C via C SR via T TE via C via C via C GPIB PC User Manual Appendix B Common Errors and Their Solutions Some errors occur more frequently than others These common errors and their solutions are listed in this appendix according to the error code that was returned from the function as indicated by IBERR A full explanation of all possible errors is in Section Four Later in this appendix are descriptions of error situations that do not return an error code EDVR 0 Error Condition DOS error see IBCNT for DOS error code Solutions e Check that GPIB COM CONFIG SYS and IBCONF EXE are in the root directory of your boot dr
125. ents Corp Section Five IBIC Table 5 2 Status Word Layout conan la os Value Type db GPBeror db Time limit exceeded db END or EOS detected __ b SRQ interrupt received RQS 11 800 Device requesting service CMPL 8 100 db 1O completed Lox 7 80 fb f Lockout State REM _ 40 b f Remote State ac TS 20 fb f Contoller In Charge ATN 4 10 fb f Attention is asserted Tacs 3 8 b f Taker Lacs 2 4 Jb Listener DTAS 1 2 fb Device Trigger State pcas o 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 transfer Example dev1 ibwrt f2t3x 8100 err cmpl ERROR ENOL COUNT 1 dev1 In this example there are no Listeners perhaps dev 1 is powered off National Instruments Corp 5 11 GPIB PC User Manual IBIC Section Five Byte Count When an I O function completes IBIC displays the actual number of bytes sent or received regardless of the existence of an error condition Auxiliary Functions Table 5 3 summarizes the auxiliary functions that IBIC supports Table 5 3 Auxiliary Functions that IBIC Supports Description Function Note Syntax Select active device or board set _bdname 12 Display help information help E Repeat previous function previous function Turn OFF displa es A Turn
126. ersion 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 Ka If information is required that is specific to two versions this information is separated and identified by a frame with the two version numbers in the upper left corner An example of this appears as follows 2 0 3 0 National Instruments Corp 4A 1 GPIB PC User Manual BASICA QuickBASIC GPIB PC Function Calls Section Four A If information is required that is specific to three versions this information is separated and identified by a frame with the three version numbers in the upper left corner An example of this appears as follows 1 0 l PR 3 0 Information that is not located in a frame can be used to program the GPIB PC in all versions of BASICA and QuickBASIC that is Version 4 0 and earlier BASICA Files The GPIB PC distribution diskette contains four files relevant to programming in BASICA e DECL BAS A file containing required initialization code e BIB M The BASICA language interface which gives your application program access to the handler e DBSAMP BAS A sample program using device calls e BBSAMP BAS A sample program using board calls QuickBASIC Files The GPIB PC distribution diskette contains four files relevant to programming in QuickBASIC These files were copied to a subdirectory called GP IB PC when you ran
127. evice characteristics Remember to reboot after leaving IBCONF if you made any changes GPIB PC User Manual B 4 National Instruments Corp Appendix B Common Errors and Their Solutions ENEB 7 Error Condition Non existent GPIB PC board Solution e Run IBCONF and make sure the board type GPIB PCH PCHA or PCIID and base I O address match the hardware and address switch settings If you make any changes reboot after leaving IBCONF EOIP 10 Error Conditions I O started before previous operation completed Solution e When using asynchronous reads or writes call IBWAIT to wait for CMPL status before making another call ECAP 11 Error Condition No capability for operation Solution e 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 system error Solutions e Check the disk files to make sure names are properly specified and that the file exists e If more room is needed on the disk delete some files e Rename any files which have the same name given to a device in IBCONF or rename the device National Instruments Corp B 5 GPIB PC User Manual Common Errors and Their Solutions Appendix B EBUS 14 Error Condition Command error during device call Solutions e Find out whic
128. f an already attached device by altering the switches on the device by calling IBPAD and IBSAD if necessary to make the configured address match the device switch settings or by using the IBCONF configuration utility to reassign the proper GPIB National Instruments Corp 4 7 GPIB PC User Manual GPIB PC Functions Overview Section Four EADR 3 EARG 4 ESAC 5 address to the device in the handler For a board write an IBCMD call is generally necessary to address devices before an IBWRT Be sure that the proper listen address is in the IBCMD argument string and that no Unlisten hex 3F command follows it ENOL may occur in situations in which the GPIB PC is not the CIC and the Controller asserts ATN before the write call in progress has ended The remedy is either to reduce the write byte count to that which is expected by the Controller or to resolve the situation on the Controller s end EADR occurs when the GPIB PC is CIC and is not addressing itself before read and write calls are made This error is extremely unlikely to occur on a device call For a board call the remedy is to be sure to send the appropriate Talk or Listen address using IBCMD before attempting the IBWRT or IBRD EADR is also returned by the function IBGTS when the shadow handshake feature is requested and the GPIB ATN line is already unasserted In this case the shadow handshake is not possible and the error is returned to notify you of th
129. f each device is placed in an internal reference table accessible by the handler This description includes the GPIB address end of string EOS modes timeout selection and a name for the device Group II Group II functions offer additional high level device services often needed in common instrument control applications Group II functions are as follows IBRSP IBCLR e IBTRG and IBLOC IBRSP bd spr IBRSP serially polls a device and returns its status response The response consists of a single byte in which the hex 40 bit is set if the device is requesting service and asserting Service Request SRQ Here are examples of a Tektronix 4041 BASIC SRQ handler call and the corresponding IBRSP call In this case the device being polled is the plotter and is at GPIB address 7 POLL STATUS ADDRESS 7 CALL IBRSP PLTR STATUS In both cases the plotter s status response is stored in the variable STATUS Unless disabled during software configuration any device function call will automatically conduct serial polls if SRQ is asserted on GPIB This automatic serial polling is discussed in Section Four National Instruments Corp 3 3 GPIB PC User Manual GPIB PC Functions Introduction Section Three IBCLR bd IBCLR clears the device by sending to it the Selected Device Clear SDC and appropriate addressing commands Clearing the Device Versus Clearing the GPIB There is a difference betw
130. gure applications monitor ILTRAP MASK V Wait for selected event ILWAIT BD MASK Write data from string LWRI W Write data from file ILWRI Write data from integer array I Write data asynch from integer array ILWRI BD IARR CNI GPIB PC Function Descriptions The remainder of this section provides a detailed description of each GPIB PC function National Instruments Corp 4A 15 GPIB PC User Manual BASICA QuickBASIC GPIB PC Function Calls Section Four A BASICA QuickBASIC BASICA QuickB ASIC IBBNA IBBNA Purpose Change access board of device Format CALL IBBNA BD BNAMES Remarks BD specifies a device BNAMES specifies the new access board to be used in all device calls to that device IBBNA is needed only to alter the board assignment from its configuration setting The IBBNA function identifies the board that will be used in subsequent device functions to access the specified device IBBNA permits you to alter the association of devices and interface boards from the settings originally configured with the configuration program The assignment made by this function remains in effect until IBBNA is called again the IBONL or IBF IND function is called or the system is rebooted The original configuration established with the configuration program is not permanently changed Refer also to Table 2 1 Device Example 1 Associate the device DVM with the interface board GPIBO
131. h device is abnormally slow to accept commands and fix the problem with the device e If more time is needed to send commands lengthen the time limit of the board in IBCONF or with IBTMO ESTB 15 Error Condition Serial poll status byte s lost Solutions e Call IBRSP more often to read the status bytes e Ignore ESTB ESRQ 16 Error Condition SRQ stuck in the ON position Solutions e 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 e Check that you have used IBF IND to open all devices on the GPIB that could assert SRQ Remove any device from the bus if it is not being accessed e Using IBIC attach one device at a time and determine that it is unasserting SRQ after being polled e Inspect the interconnecting cable to see that the devices are attached and that the connectors are seated properly GPIB PC User Manual B 6 National Instruments Corp Appendix B Common Errors and Their Solutions Other Error Conditions Listed below are general errors which may occur when using the GPIB PC hardware and software Error Condition Attempts to run the GPIB utility programs IBDIAG IBTEST or IBIC and returns Bad command or File Name error from DOS Also the distribution files do not appear to be on the boot disk after running IBSTART Solution e IBSTART copies the files to the subdirector
132. hat WRTS contains 130 RI the data to be written to the GPIB 140 CALL IBWR PLO ER WRTS Board Examples 1 Stop sending END with the last byte for calls directed to the interface board BRDOS 100 V 0 Disable sending of EOI 110 CALL IBEOT BRD0O V 2 Send the END message with the last byte of all subsequent write operations directed to the interface board BRDO 100 VS 1 Enable sending of EOI 110 CALL IBEOT BRD0O V 120 REM It is assumed that WRTS contains 130 REM the data to be written and all 140 RE Listeners have been addressed 150 CALL IBWRT BRDO WRTS National Instruments Corp 4A 31 GPIB PC User Manual BASICA QuickBASIC GPIB PC Function Calls Section Four A BASICA QuickBASIC BASICA QuickB ASIC IBFIND IBFIND Purpose Open device and return the unit descriptor associated with Format Remarks the given name CALL IBFIND BDNAMES BD BDNAMES is a string containing a default or configured device or board name BD is a variable containing the unit descriptor returned by IBF IND IBF IND returns a number that is used in each function to identify the particular device or board that is used or is the object of that function Calling IBF IND is required to associate a variable name in the application program with a particular default or configured device or board name The name used in the BDNAMES argument must match exac
133. hat do not execute programming instructions if National Instruments receives notice of such defects during the warranty period National Instruments does not warrant that the operation of the software shall be uninterrupted or error free A Return Material Authorization RMA number must be obtained from the factory and clearly marked on the outside of the package before any equipment will be accepted for warranty work National Instruments will pay the shipping costs of returning to the owner parts which are covered by warranty National Instruments believes that the information in this manual is accurate The document has been carefully reviewed for technical accuracy In the event that technical or typographical errors exist National Instruments reserves the right to make changes to subsequent editions of this document without prior notice to holders of this edition The reader should consult National Instruments if errors are suspected In no event shall National Instruments be liable for any damages arising out of or related to this document or the information contained in it EXCEPT AS SPECIFIED HEREIN N ATIONAL INSTRUMENTS MAKES NO WARRANTIES EXPRESS OR IMPLIED AND SPECIFICALLY DISCLAIMS ANY WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE CUSTOMER S RIGHT TO RECOVER DAMAGES CAUSED BY FAULT OR NEGLIGENCE ON THE PART OF NATIONAL INSTRUMENTS SHALL BE LIMITED TO THE AMOUNT THERETOFORE PAID BY THE CUSTOMER NATIONAL INSTRUME
134. he GPIB COM file you want modified ibconf c GPIB PC GPIB2 COM This will have the effect of changing the parameters within the GPIB2 COM file in the GP IB PC subdirectory Modify only the copy of GPIB COM created by IBSTART in your boot directory Never modify the master copy on the distribution diskette This would happen if you ran IBCONF from the distribution diskette and if the distribution diskette were not write protected Upper and Lower Levels of IBCONF IBCONF operates at both an upper and a lower level The upper level consists of the Device Maps and gives an overview of the GPIB system as defined within the handler being configured The lower level consists of screens that describe each individual board and device in the system Upper Level Device Map for Board GPIBx This screen displays the names of all devices defined in the handler file and indicates which devices if any are accessed through the interface board GPIBx At this level you may e Rename a device e Disconnect a device from its assigned GPIB PC access board or connect reassign it to a different access board or e Proceed to the lower level to edit or examine the characteristics of a particular board or device Instructions are given on the screen for selecting the individual devices and for changing from one device map to another for example from the map for GPIBO to that for GPIB1 GPIB PC User Manual 2 10 National Instruments Corp S
135. hen executing certain functions This is to ensure that accessing a powered off device does not hang up the GPIB indefinitely A way to terminate I O transmissions to and from the device Some devices require or append an end of string character such as the ASCII line feed character to data strings Others use the GPIB END message which is sent or received via the EOI signal line Still others use both Some terminate messages only when a predetermined number of bytes are sent or received Characteristics of each GPIB PC Each GPIB PC has the following characteristics A symbolic name such as GPIBO and GPIB1 A computer I O or port address The capability to be designated as the System Controller of the devices on its bus A time limit that is imposed when executing certain functions A way to terminate I O transmissions to and from the board when executing board calls i e by an end of string character an END message and or a byte count An interrupt level that the board uses National Instruments Corp 2 7 GPIB PC User Manual Installation and Configuration Section Two e What DMA channel if any the board uses e Whether it uses high speed or normal timing when transmitting data to a device With normal timing there is a delay of at least 2 usec after the data is placed on the GPIB before the Data Valid DAV line is asserted With high speed timing this delay is decreased to about 500 nsec e The I
136. her applications such as intercomputer communication and peripheral control It was later accepted as the industry standard IEEE 488 The versatility of the system prompted the name General Purpose Interface Bus National Instruments expanded the use of the GPIB among users of computers manufactured by companies other than Hewlett Packard National Instruments specialized both in high performance high speed hardware interfaces and in comprehensive full function software that helps users bridge the gap between their knowledge of instruments and computer peripherals and of the GPIB itself The GPIB PC Family The GPIB PC family consists of GPIB interface hardware products software documentation and other items for several types of personal computers What Your Package Should Contain Unless you have a special application your GPIB PC package consists of the following e A GPIB PC interface board for your personal computer Each board has a model name such as GPIB PCIIA This manual uses GPIB PC to refer generally to all models of the GPIB PC interface board National Instruments Corp v GPIB PC User Manual Preface e A Getting Started with your GPIB PC pamphlet The pamphlet contains the directions with a minimum of explanations for installing your hardware and software in your GPIB system e A GPIB PC distribution diskette The distribution diskette is part of the GPIB PC package It contains the DOS handler BASICA and Qui
137. id device clear end group execute trigger go to local identify interface clear local lockout my listen address my listen address my secondary address my talk address my talk address other secondary address other talk address primary command group parallel poll configure parallel poll disable parallel poll enable parallel poll response n parallel poll unconfigure A 4 C PP L LE PP L LE L LE SH SH AH T TE L LE SR RL PP C AH C T TE SH AH T TE L LE PP C via L LE SH AH DC via L LE DT RL L LE PP T TE L LE C RL L LE RL T TE LE T TE L TE T TE TE LE PP PP PP PP via C PP National Instruments Corp Appendix A Multiline Interface Messages Interface Message Reference List Continued Mnemonic Message REMOTE MESSAGES RECEIVED REN RED RQS SDC SPD SPE SRQ STB TCT or TCT UNL remote enable ready for data request service selected device clear serial poll disable serial poll enable service request status byte take control unlisten REMOTE MESSAGES SENT ATN DAB DAC DAV DCL END GET GTL DY IFC LLO MLA or MLA MSA or MSA MTA or MTA OSA OTA PCG PPC PPD PPE PPRn PPU REN RFD RQS SDC SPD SPE SRQ STB TCT UNL UNT attention data byte data accepted data valid device clear end via T group execute trigger go to local id
138. ies a device The IBTRG function addresses and triggers the specified device then unaddresses all devices on the GPIB IBTRG calls the board IBCMD function to send the following commands e Listen address of the device e Secondary address of the device if applicable e Group Execute Trigger GET and e Untalk UNT and Unlisten UNL Other command bytes may be sent as necessary Refer to the IBCMD function for additional information Device Example 1 Trigger the device ANALYZ 100 CALL IBTRG ANALYZ National Instruments Corp 4A 83 GPIB PC User Manual BASICA QuickBASIC GPIB PC Function Calls Section Four A BASICA QuickBASIC BASICA QuickB ASIC IBWAIT IBWAIT Purpose Wait for selected event Format CALL IBWAIT BD MASK Remarks BD specifies a device or an interface board MASK is a bit mask with the same bit assignments as the status word IBSTA Each MASK bit is set or cleared to wait or not wait respectively for the corresponding event to occur 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 MASKS amp H8000 the ERR bit the function returns immediately If the TIMO bit is 0 or the time limit is set to O with the IBTMO function timeouts are disabled Disa
139. 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 ibwrt F3R5T1 r n 0100 cmp1 count 6 The r and n represent the carriage return and linefeed characters respectively See Table 5 3 for a more detailed description on the representation of non printable characters National Instruments Corp 5 5 GPIB PC User Manual IBIC Section Five Using SET Use IBF IND to open each device or board Once the device or board is opened use the auxiliary function SET to select which opened device or board to access SET changes the prompt to the new symbolic name Example dev1 set plotter plotter This example assumes that IBCONF was used to give a device the name plotter The following example summarizes the use of IBF IND and SET ina typical program Example ibfind devil dev1 ibfind plotter plotter ibwrt F3T7G0 0100 cmp1 count 6 plotter set devi dev1l ibwrt X7Y39G0 0100 cmp1 count 7 dev1 GPIB PC User Manual 5 6 National Instruments Corp Section Five IBIC IBIC Functions and Syntax IBIC displays the following information about each function call immediately after that call e IBRD and IBRDA data
140. indicates the corresponding condition is in effect A bit value of zero indicates the condition is not in effect Table 4 1 lists the conditions and the bit position to be tested for that condition Some bits are set only on device function calls d some bits are set only on board function calls b and some bits are set on either type db Table 4 1 Status Word Layout Type db GPIBerror id db Time limit exceeded __ db END or EOS detected __ b SRQ interrupt received _ Device requesting CMPL 8 100 db VO completed LOK 7 80 fb Lockout State REM 6 40 b Remote State cc 5 20 b Controller In Charge ATN 4 10 fb Attention is asserted Tacs 3 8 b Talker Lacs 2 4 b Listener DTAS 1 2 b Device Trigger State pecas o 1 __ b Device Clear State A description of each status word and its condition follows GPIB PC User Manual 4 2 National Instruments Corp Section Four GPIB PC Functions Overview ERR db ERR is set in the status word following any call that results in an error the particular error may be determined by examining the IBERR variable It is cleared following any call that does not result in an error NOTE Always check for an error condition after each call An error made early in your application program may not become apparent until a later instruction At that time the error can be more difficult to locate TIMO db TIMO specifies whether a timeo
141. ing IBTRAP calls in your application The utility program IBTRAP may be used to set the trap mode from DOS Simply type IBTRAP in response to the DOS prompt specifying GPIB PC User Manual 6 2 National Instruments Corp Section Six IBIC the desired combination of the flags which are listed on the following pages Select one or more mask flags all err timo end srqi rqs cmpl lok rem ei c atn tacs lacs dtas dcas all GPIB calls GPIB error timeout GPIB PC detected END or EOS SRQ on device requesting service I O completed GPIB PC is in Lockout State GPIB PC is in Remote State GPIB PC is Controller In Charge attention is asserted GPIB PC is Talker GPIB PC is Listener GPIB PC is in Device Trigger State GPIB PC is in Device Clear State National Instruments Corp 6 3 GPIB PC User Manual IBIC Select only one monitor flag off turns the monitor off Section Six No recording or trapping occurs rec instructs the monitor to record all GPIB handler calls but no trapping occurs dis instructs the monitor to record all GPIB handler calls and display whenever a trap condition exists Omitting either the mask or the monitor flags will leave its current configuration unchanged Invoking IBTRAP without any flags will display the valid flags and their current state This has no effect on the monitor configuration By selecting various flags for the mask and monitor par
142. ion APPMON COM The file on the distribution diskette which contains the applications monitor ATTENTION or ATN A GPIB line that distinguishes between commands and data messages When ATN is asserted bytes on the GPIB DIO lines are commands AUTOMATIC SERIAL 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 the computer See Device BOARD FUNCTION A function that operates on or otherwise pertains to one of the GPIB PC interface boards in the computer These boards are referred to as GPIBO GPIB1 etc See Device Function BOOT To load the operating system programs from floppy or hard disk into memory and to begin executing the code A hard boot is when power is applied to the computer A warm or soft boot is when specific keys are pressed such as CTRL SHIFT DEL on the IBM PC BOOT DRIVE The floppy or hard disk drive that is used to boot the computer National Instruments Corp G 1 GPIB PC User Manual Glossary COMMAND or COMMAND MESSAGE Common term for interface message CONFIG SYS The DOS file that contains the names of the loadable device driver or handler
143. is fixed at 14 14 MHz for all IBM PCs and compatibles this field is always set to 8 For the GPIB PCIIA this value is equal to the frequency of the PC bus signal CLK and rounded up Since the signal CLK varies according to the machine this field varies as well Typical examples are PCH ICF value _ PCIA ICF value IBM PC XT and compatibleh 8 IBMXT new 8 O IBM AT and compatibles 8 a aan O 8 E e a Compaq Deskpro 286 Compaq Portable 286 Notice that on some computers the CLK frequency depends on whether the CPU is operated at normal or high speed mode If you want to operate the GPIB PC under both modes either reconfigure the software or use the higher value If you are in doubt as to what value to enter use 8 Exiting IBCONF Once all changes have been made you may exit IBCONF by typing the function key indicated on the screen The program will first ask if it should save any changes before exiting Typing a y response causes the changes to be written to the file on disk Before exiting the program will check for situations that may cause problems GPIB PC User Manual 2 16 National Instruments Corp Section Two Installation and Configuration Situations which are checked are as follows e GPIB addressing conflict between a device and its access board e GPIB boards not present in the host machine at the specified address and e Timeouts disabled on a device or board If any of these situations
144. is function remains in effect until IBPAD is called again the IBONL or IBF IND function is called or 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 IBERRS 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 amp H20 to the primary address the talk address is formed by adding amp H40 to the primary address Consequently a primary address of amp H10 corresponds to a Listen address of amp H30 and a talk address of amp H50 The actual GPIB address of any device is set within that device either with hardware switches or a software program Refer to the device documentation for instructions Board IBPAD Function When BD specifies a board IBPAD programs the interface board to respond to the primary talk and listen address indicated by V Refer also to IBSAD IBONL and Table 2 1 GPIB PC User Manual 4A 42 National Instruments Corp Section Four A BASICA QuickBASIC GPIB PC Function Calls Device Example 1 Change the primary GPIB listen and talk address of the device PLOTTERS from the configuration setting to amp H2A and amp H4A respectively 100 V amp HA Lower 5 bits of GPIB address 110 CALL IBPAD PLOTTER V Board Example
145. ive Enter DIR from the boot drive and verify that these files exist e 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 e Reboot your system after you install the software ECIC 1 Error Condition Function requires GPIB PC to be Controller In Charge Solutions e Run IBCONF and make sure the board being used GPIBO or GPIB1 is configured to be the System Controller e If executing board functions call IBSIC to become Controller In Charge before any other function calls that require that capability e If control has been passed away with an IBPCT call wait for it to be returned with the IBWAIT function National Instruments Corp B GPIB PC User Manual Common Errors and Their Solutions Appendix B ENOL 2 Error Condition Write function detected no Listeners Solutions e Check that the device is powered on and also that at least two thirds of the devices on the GPIB are turned on e Inspect the interconnecting cable to see that the devices are attached and that the connectors are seated properly e Check the switches or control panel of the device and make sure its GPIB address is what you think it is Check also whether the device uses extended addressing and requires a primary and secondary address Some devices use multiple secondary addresses to enable different internal functions e
146. izes you with status information that is returned by each function and that is also available to your application program in the form of global variables While running IBIC study the descriptions of each function given in Section Four to fully understand the purpose and syntax of each function Finally referring to the appropriate language supplement of Section Four write your application program Whenever possible use IBIC to test the sequence of the GPIB PC function calls your application program makes Trying your function calls from IBIC is especially helpful if your application program responds in an unexpected manner GPIB PC User Manual 2 18 National Instruments Corp Section Three GPIB PC Functions Introduction This section introduces you to the GPIB PC handler functions and their capabilities They are described in the order you will most likely use them Application environments for which the functions are designed are described Short examples illustrate how the functions operate Introduction to the GPIB PC Functions The GPIB PC functions are high level and low level functions that communicate with and control devices on the GPIB The functions are divided into six groups and each group is distinguished by the type of applications it serves The functions contained in the first three groups are mostly high level while those of the last three are mostly low level High Level Functions High level functi
147. jumper setting Boards Only 2 15 L Linear configuration 1 7 Local Lockout on all Devices 2 15 Local mode device 3 5 Low level functions 3 1 Lower level device board characteristics 2 12 M Messages types of 1 1 More about Device and Board Functions 3 14 Multiboard capability 3 9 Multiline interface messages A 1 National Instruments Corp I 5GPIB PC User Manual Index N n repeat function n times 5 16 O Overview GPIB PC Functions 4 1 P Physical characteristics 1 5 Placing device local mode 3 5 remote mode 3 4 Preparation software 2 3 Preparations programming 4A 3 4A 4 Primary default characteristics 2 18 Primary GPIB address 2 12 PRINT display the ASCII string 5 18 Printer installation D 1 Programming preparations 4A 3 4A 4 Purpose of board functions 3 9 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 address 2 12 SET Select Device or Board 5 6 5 13 Software installation 2 3 Booting from a Floppy Disk 2 3 Booting from a Hard Disk 2 3 GPIB PC User Manual I 6 National Instruments Corp Index Preparation 2 3 Software MC GPIB 2 3 Software preparation 2 3 Software test installation 2 7 Star configuration 1 8 Status word 4 2 5 10
148. l 3 National Instruments Corp Section Four A BASICA QuickBASIC GPIB PC Function Calls Ei Table 4A 3 QuickBASIC GPIB PC Calls continued BTMO BD V Description hange disable time limit onfigure applications monitor rigger selected device Wait for selected event Write data from string Write data asynchronously from string Write data from file Write data from integer array Write data asynch from integer array National Instruments Corp 4A 11 CALL Function Syntax TF IBWRTI BD IA IBWRTIA BD IA IBI b VS BD FLNAM RR CNT RR CNI GPIB PC User Manual BASICA QuickBASIC GPIB PC Function Calls Section Four A New GPIB PC Functions Since QuickBASIC Version 4 0 now supports true functions the language interface has been expanded to include function versions of the existing GPIB calls Here are some important points to be aware of All existing subroutines are still available via the CALL statement and existing applications do not require any changes The names of the new functions are identical to the existing subroutines except that the second letter of each name has been changed from B to L For example the subroutine IBSIC is now also available as the function ILSIC GPIB subroutine and function calls may be freely mixed throughout a program The include file OBDECL4 BAS contains a complete list of both subroutine and function de
149. le you must press RETURN on the slave before you press RETURN on the master Example Master Slave SLAVE ibwrt hello GPIBO ibrd 5 The master sends a data string to the slave which should appear as follows Master Slave 0100 cmp1 hello Count 5 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 seconds will abort the operation GPIB PC User Manual E 2 National Instruments Corp Appendix F Customer Communication National Instruments provides comprehensive technical assistance around the world In the U S and Canada applications engineers are available Monday through Friday from 8 00 a m to 6 00 p m central time In other countries contact the nearest branch office You may fax questions to us at any time Corporate Headquarters 512 795 8248 Technical support fax 800 328 2203 512 794 5678 Branch Offices Phone Number Australia 03 879 9422 Austria 0662 435986 Belgium 02 757 00 20 Denmark 45 76 26 00 Finland 90 527 2321 France 1 48 14 24 00 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 National Instruments Corp F 1 Fax Number 03 879 9179 0662 437010 19 02 757 03 11 45 76 71 11 90 502 2930 1 48 1
150. ll 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 devices and used to manage the GPIB Common interface messages include Interface Clear listen addresses talk addresses and Serial Poll Enable Disable See Data or Device Dependent Message I O or INPUT OUTPUT In the context of this manual the transmission of commands or messages between the computer via the GPIB PC and other devices on the GPIB I O ADDRESS The address of the GPIB PC from the CPU s point of view as opposed to the GPIB address of the GPIB PC Also called port address or board address LAD or LISTEN ADDRESS See MLA GPIB PC User Manual G 4 National Instruments Corp Glossary LANGUAGE INTERFACE Code that enables an application program written in a particular language to call handler functions BIB M is the language interface for Interpretive BASIC LISTENER A GPIB device that receives data messages from a Talker LLO or LOCAL LOCKOUT A GPIB command used to tell all devices that they may or should ignore remote GPIB data messages or local front panel controls depending on whether the device is in local or remote program mode LOW LEVEL FUNCTION A
151. ly opened device or board to be used for subsequent GPIB PC functions executed from IBIC SET eliminates the need to include the BD unit descriptor in each GPIB PC function call The argument bdname is any of the symbolic device or board names recognized by the handler These are the default names gpib0O gpibl and dev1 through dev16 unless the device names have been changed with IBCONF An example of the SET function appeared earlier in this section HELP Display Help Information The HELP function gives causal information about IBIC and its functions to be displayed on the screen National Instruments Corp 5 13 GPIB PC User Manual IBIC Section Five Repeat Previous Function The function causes the most recent function executed to be repeated Example Screen Image Comments gpib0 ibsic Send Interface 130 cmpl l Repeat ibsic cmpl cic atn 1 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 GPIB PC User Manual 5 14 National Instruments Corp Section Five IBIC Turn ON Display The function causes the display to be restored The following example shows how the and functions are used Twenty four consecutive letters of the alphabet are read
152. mation on the GPIB by sending commands to all devices Devices can be Listeners Talkers and or Controllers A digital voltmeter for example is a Talker and may be a Listener as well The GPIB is a bus like an ordinary computer bus except that the computer has its circuit cards interconnected via a backplane bus whereas the GPIB has standalone devices interconnected via a cable bus The role of the GPIB Controller can also be compared to the role of the computer s CPU but a better analogy is to the switching center of a city telephone system National Instruments Corp 1 1 GPIB PC User Manual Operation of the GPIB Section One The switching center Controller monitors the communications network GPIB When the Controller notices that a party device wants to make a call send a data message it connects the caller Talker to the receiver Listener The Controller usually addresses a Talker and a Listener before the Talker can send its message to the Listener After the message is transmitted the Controller usually unaddresses both devices Some bus configurations do not require a Controller For example one device may always be a Talker called a Talk only device and there may be one or more Listen only devices A Controller is necessary when the active or addressed Talker or Listener must be changed The Controller function is usually handled by a computer With the GPIB PC interface board and its software your
153. messages are displayed on the screen in hex and ASCII formats e The global variables IBSTA IBCNT and IBERR are displayed on the screen IBIC and programming 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 IBF IND to open that unit and to pass the unit descriptor to IBIC The screen prompt identifies which of these opened units IBIC will use in subsequent calls Use the SET function to change from one of these units to another National Instruments Corp 5 7 GPIB PC User Manual IBIC Section Five Other IBIC Functions and Syntax Table 5 1 summarizes the GPIB PC functions and syntax when called from IBIC Syntax rules for IBIC are explained in the table notes Consult Section Four for detailed function descriptions and for syntax rules of the programming language you will use Table 5 1 Syntax of GPIB Functions in IBIC Syntax Type bnam Become active controller V V Clear specified device 2 e c i z EE rel string 4 we string 4 a s v i nd 3 Enable disable DMA Change disable EOS message Enable disable END message Return unit desciptor ibfi bdname ibist v te ad ibonl v db 23 Change primary address li
154. n calls COMMON SHARED IBSTA IBERR S IBCNT REM Assign a unique identifier to device REM and store in variable DVMS REM BDNAMES DVM CALL IBFIND BDNAMES DVM REM REM Check for error on IBFIND call REM IF DVM lt 0 THEN GOSUB FIND ERROR REM REM Clear the devic REM CALL IBCLR DVM REM REM Check for an error on each GPIB call REM to be safe REM IF IBSTA S lt 0 THEN GOSUB GPIB ERROR REM REM Write the function range and trigger REM source instructions to the DVM REM WRTS F3R7T3 CALL IBWRT DVM WRTS IF IBSTA S lt 0 THEN GOSUB GPIB ERROR REM REM Trigger the devic REM CALL IBTRG DVM IF IBSTA S lt 0 THEN GOSUB GPIB ERROR REM REM Wait for the DVM to set RQS or fora REM timeout if the current time limit REM is too short use IBTMO to change it REM MASK amp H4800 CALL IBWAIT DVM MASK IF IBSTA S AND amp HC000 lt gt 0 THEN GOSUB GPIB ERROR REM REM Since neither a timeout nor an error REM occurred IBWAIT must have returned REM on ROS Next serial poll the device REM GPIB PC User Manual 4A 108 National Instruments Corp Section Four A BASICA QuickBASIC GPIB PC Function Calls CALL IBRSP DVM SPR IF IBSTA S lt 0 THEN GOSUB GPIB ERROR REM REM Now test the status byte SPR REM If SPR is amp HCO the DVM has valid REM data to send otherwise it has a REM fault condition t
155. n for selecting a specific field and for modifying the current settings The configuration settings selected for each device and each board are a means of customizing the communications and other options to be used with that board or device The settings for devices specify the characteristics to be used by the access board for that device when device functions are used The settings for boards specify the characteristics to be used with each board when board functions are used In the following explanations of device and board characteristics notice that some characteristics apply to both devices and boards and some apply only to boards National Instruments Corp 2 11 GPIB PC User Manual Installation and Configuration Section Two Device and Board Characteristics Primary GPIB Address Each device and board must be assigned a unique primary address in the range hex 00 to hex 1E A listen address is formed by adding hex 20 to the primary address the talk address is formed by adding hex 40 to the primary address Consequently a primary address of hex 10 corresponds to a listen address of hex 30 and a talk address of hex 50 The GPIB primary address of any device is set within that device either with hardware switches or in some cases a software program This address and the address listed in IBCONF must be the same Refer to the device specific documentation provided with your instrument for instructions about that device s address The
156. n interface board If V is non zero the END message is sent automatically with the last byte of each write operation If V is zero END is not sent IBEOT is needed only to alter the value from the configuration setting The END message is sent when the GPIB EOI signal is asserted during a data transfer 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 IBF IND function is called or the system is rebooted When IBEOT is called and an error does not occur the previous value of V is stored in IBERR Device IBEOT Function When BD amp specifies a device the END termination message method that is selected is used on all device I O write operations to that device Board IBEOT Function When BD specifies an interface board the method that is selected is used on all board level I O write operations regardless of what device is written to Refer also to IBEOS and to Table 2 1 GPIB PC User Manual 4A 30 National Instruments Corp Section Four A BASICA QuickBASIC GPIB PC Function Calls Device Example 1 Send the END message with the last byte of all subsequent writes to the device PLOTTERS 100 V 1 Enable sending of EOI 110 CALL IBEOT PLOTTER V 120 RI It is assumed t
157. n the other device was expecting Be sure that both parties to the transfer understand what byte count is expected or if possible have the Talker use the END message to assist in early termination ENEB 7 ENEB occurs when there is no GPIB PC at the I O address specified in the configuration program This happens when the board is not physically plugged into the system when the I O address specified during configuration does not match the actual board setting or when there is a conflict in the system with the BASE I O address If there is a mismatch between the actual board setting and the value specified at configuration time either reconfigure the software or change the board switches to match the configured value EOIP 10 EOIP occurs when asynchronous I O has not completed before some other call was made During asynchronous T O until the CMPL bit is set in IBSTA only IBSTOP and IBWAIT calls are allowed EOIP is returned when any other call is attempted before the I O completes The remedy is to use IBWAIT to wait for the CMPL status and then attempt the other call ECAP 11 ECAP results when a particular capability has been disabled in the handler and a call is made which attempts to make use of that capability For example if you use IBCONF to disable DMA for a board and then try to call IBDMA to turn DMA back on you will get this error The remedy is not to deny capabilities which may be needed later and to avoid making c
158. nd IBWRT In BASICA these functions read and write from a character string that may be up to 255 bytes long In addition integer I O functions IBRDI and IBWRTT are provided for users whose data strings are longer than 255 bytes or who need to National Instruments Corp 4A 5 GPIB PC User Manual BASICA QuickBASIC GPIB PC Function Calls Section Four A perform arithmetic operations on the data and want to avoid the overhead of converting the character bytes of IBRD and IBWRT into integer format and back again IBRDI and IBWRTTI are passed data in the form of an integer array instead of a character string whose maximum length is limited to 255 bytes Using these functions you may store more than 255 bytes in a single buffer and do not have to convert each pair of data bytes to an integer before doing arithmetic operations on the data Internally the IBWRTI function sends each integer to the GPIB in low byte high byte order The IBRDI function reads a series of data bytes from the GPIB and stores them into the integer array in low byte high byte order In addition to IBRDI and IBWRTT the asynchronous functions IBRDIA and IBWRTIA are provided to perform asynchronous integer reads and writes The functions are listed alphabetically by function name in this section Table 4A 1 provides a summary of the BASICA GPIB PC functions and Table 4A 2 provides a summary of the QuickBASIC GPIB PC functions BASICA QuickBASIC ON SRQ Capabilit
159. ng the Serial Poll Disable SPD message GPIB PC User Manual 4A 112 National Instruments Corp Section Four A BASICA QuickBASIC GPIB PC Function Calls CMDS CHRS amp H19 CALL IBCMD BRDO CMDS IF IBSTA S lt 0 THEN GOSUB GPIB ERROR REM REM Since the DVM and GPIB PC are REM still addressed to talk and listen REM the measurement can be read as follows REM RDS SPACES 16 CALL IBRD BRDO RDS IF IBSTA S lt 0 THEN GOSUB GPIB ERROR REM REM To close out a programming sequence REM send IFC to initialize the bus and REM call the IBONL function to place the REM GPIB PC offline REM CALL IBSIC BRDOS V 0 CALL IBONL BRDO 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 th xact REM cause of the error condition and REM then take action appropriate to REM the application For errors during REM data transfers IBCNT may be REM examined to determine the actual REM number of bytes transferred PRINT GPIB ERROR STOP DEVICE ERROR REM A routine at this location would REM analyze the fault code returned in REM the DVM s status byte and take REM appropriate action P
160. nitely for the device LOGGERS to request service 100 MASK amp H800 ROS 110 CALL IBWAIT LOGGER MASK Board Examples 1 Wait for a service request or a timeout 100 MASKS amp H5000 TIMO SROQI 110 CALL IBWAIT BD MASK 120 REM Check IBSTAS here to see which 130 REM occurred 2 Update the current status for IBSTAS 100 MASK 0 110 CALL IBWAIT BD MASK 3 Wait indefinitely until control is passed from another CIC 100 MASK amp H20 ACTO 110 CALL IBWAIT BD MASK 4 Wait indefinitely until addressed to talk or listen by another CIC 100 MASK amp HOC TACS LACS 110 CALL IBWAIT BD MASK GPIB PC User Manual 4A 86 National Instruments Corp Section Four A BASICA QuickBASIC GPIB PC Function Calls BASICA QuickBASIC BASICA QuickB ASIC IBWRT IBWRT Purpose Write data from string Format CALL IBWRT BD WRTS Remarks BD specifies a device or an interface board WRT contains the data to be sent over the GPIB In BASICA the IBWRT function writes from to 255 bytes of data to a GPIB device In QuickBASIC the IBWRT function writes from to 32K bytes of data to a GPIB device Device IBWRT Function When BD amp specifies a device the following board steps are performed automatically to write to the device 1 The IBCMD function is called to address the device to listen and the access board to talk 2 The board IBWRT function is called to write the data to the devi
161. not addressed to listen within the time limit An EABO error also results if the device that is to talk is not addressed 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 e Allocated buffer becomes full Error is detected Time limit is exceeded e END message is detected EOS character is detected if this option is enabled or e 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 A short count can occur on any event but the first Device Example 1 Read 56 bytes of data from the device TAPE ol 100 RE Perform device read 110 RDS SPACES 56 120 CALL IBRD TAPE RD 130 RE Check IBSTAS to see how the read 140 RE terminated on CMPL END TIMO or 150 RE ERR 160 RE Data is stored in RDS 170 RE All unaddressing has been done GPIB PC User Manual 4A 45 National Instruments Corp Section Four A BASICA QuickBASIC GPIB PC Function Calls Board Examples 1 Read 56 bytes of data from a device at talk address amp H4C ASCII L and then unaddress it the GPIB PC listen address is amp H20 or ASCII space 100 CMDS L UNL MLA TAD 110 CALL IBCMD BRDO CMDS 120 RDS SPACES 56 130 CALL IBRD BRDO RD 140 REM Che
162. ns essssssecssseecssseeesssneeesnns 4A 7 Table 4A 2 QuickBASIC GPIB PC Calls Table 4A 3 QuickBASIC GPIB PC Calls Table 4A 4 QuickBASIC Version 4 0 GPIB PC Functions 4A 14 Table 5 1 Syntax of GPIB Functions in BIC iu eeessssssssscccssnseesseessees Table 5 2 Status Word Layout cee ecessecseeeees Table 5 3 Auxiliary Functions that IBIC Supports National Instruments Corp xvii GPIB PC User Manual Section One Operation of the GPIB Communication between interconnected devices is achieved by passing messages through the interface system Types of Messages The GPIB carries two types of messages device dependent messages and interface messages e Device dependent messages often called data or data messages contain device specific information such as programming instructions measurement results machine status and data files Interface messages manage the bus itself They are usually called commands or command messages Interface messages perform such functions as initializing the bus addressing and unaddressing devices and setting device modes for remote or local programming The term command as used here should not be confused with some device instructions which can also be called commands Such device specific instructions are actually data messages Talkers Listeners and Controllers A Talker sends data messages to one or more Listeners The Controller manages the flow of infor
163. ns the QuickBASIC language interface to the GPIB PC handler Link compiled GPIB application programs written in QuickBASIC with QBIB OBJ to produce an executable file permitting access to the handler In accordance with QuickBASIC language protocol all function arguments are variables either integer or string and their values must be assigned before the function call is made GPIB PC User Manual 4A 4 National Instruments Corp Section Four A BASICA QuickBASIC GPIB PC Function Calls 1 0 Ka 3 0 To run your program from within the QuickBASIC editor use the QuickBASIC BUILDLIB command to add QBIB OBJ to your user library and load that library when loading QuickBASIC For example if you are already using a library called USERLIB EXE add QBIB2 OBJ to it by entering BUILDLIB USERLIB OBJ QBIB2 OBJ Then to run QuickBASIC enter QB L USERLIB EXE Ka To run your program from within the QuickBASIC interactive environment use the LINK command to create a QuickLibrary For example to create a QuickLibrary called QBIB4 QLB enter LINK Q QBIB4 OBJ BQLB40 LIB Then to run QuickBASIC enter QB L QBIB4 QLB To run your program from MS DOS follow the instructions in the QuickBASIC User s Manual which pertain to compiling and linking programs Use the file OBTB4 OBJ for linking purposes BASICA QuickBASIC GPIB PC I O Functions The most commonly needed I O functions are IBRD a
164. nternal Clock Frequency for a PC IIA This is the value of the internal PC bus clock Default Configurations Just as the hardware has factory default settings for switches and jumpers the software also has factory default configurations For example the default device names of the 16 GPIB devices are D EV1 through DEV16 but you might wish to assign more descriptive names to each device such as METER for a digital multimeter You can also use IBCONF to look at the current default settings in the handler file If you do not make changes using IBCONF the default characteristics of the software remain in effect Primary Default Characteristics The following are the primary default characteristics of the handler e There are 16 active devices with symbolic names DEV1 through DEV16 e GPIB addresses of these devices are the same as the device number for example DEV1 is at address 1 e The 16 devices are assigned to GPIBO as their access board GPIBO is the symbolic name of the first GPIB PC board in your system If you have an additional GPIB PC in your system its symbolic name is GPIB1 e Each GPIB PC is System Controller of its independent bus and has a GPIB address of 0 e The END message is sent with the last byte of each data message to a device Each data message that is read from a GPIB PC User Manual 2 8 National Instruments Corp Section Two Installation an
165. o report REM IF SPR lt gt amp HCO THEN GOSUB DEVICE ERROR REM REM If the data is valid read the REM measurement REM RDS SPACES 16 CALL IBRD DVM RDS IF IBSTA S lt 0 THEN GOSUB GPIB ERROR REM REM To close out a programming sequence REM reset the device and call IBONL REM to place the device offline REM CA IBCLR DVM Vs 0 CALL IBONL DVM V STOP END IBF IND 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 other things REM check IBERR to determine th xact cause of REM the error condition and then take action REM appropriate to the application REM For errors during data transfers REM IBCNT may be examined to determine the actual REM number of bytes transferred PRINT GPIB ERROR STOP National Instruments Corp 4A 109 GPIB PC User Manual BASICA QuickBASIC GPIB PC Function Calls Section Four A 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 GPIB PC User Manual 4A 110 National Instruments Corp Section Four A BASICA QuickBASIC GPIB PC Function Calls QuickBASIC Example Program Board Qui
166. oduction to the GPIB PC Functions 3 1 High Level Functions 3 1 Low Level Functions 3 1 Calling Syntax 3 1 GOUT ME EE 3 2 IBRD bd but cnt setsspscessscescahd iota ied 3 2 IBWRT bd buf cit eeseesssesseessecseeseecsseneesseecsscssensecseessenes 3 2 IBFIND bdrname bd essessescecsseseecseesneesecseeseensecssenensees 3 3 GPIB PC User Manual x National Instruments Corp Contents Groop Mnire e EA EEE E EEEE 3 3 IBRSP Dd Spt sscosssscosscsssssssessssassvssossnssosoesssneveasssteanecbonstgbeeessole 3 3 IBGER bd zreeat aren e A 3 4 Clearing the Device Versus Clearing the GPIB tosse 3 4 Clearing the Device eee 3 4 Clearing the GPIB eee 3 4 TBI RG bd nene ARR N Gil Mace 3 4 TBILOC Dd siscsssssssssscsssssssssssssuassscssssscavesetsssnscodseatepasscosizepsassanbsaie 3 4 Placing a Device in Remote Mode 3 4 Placing a Device in Local Mode 0 Group LT sass ssc a E E A E EER IBRDA bd buf cnt and eeeseesecseesecseeseeseseecseseesneenesees IBRDF bd buf cnt and IBWAIT bd mask Purpose of Board FUnctions cccssessssececeseceeeseeceeeeeeeenes Multiboard Capability IBFIND bdname bd sssssessessseeeeeeesesssssssesssssrttrreeeesssssssees IBCMD bd buf cnt and cee eeesesessesesseeeseeneeeenes IBRD bd buf cnt and be IBWRT bd buf cnt and IBSTOP bd National Instruments Corp xi GPIB PC User Manual Contents IBSA
167. om the GPIB This operation is done automatically by the handler The IBLOC function is then used when that device must be returned to local program mode In addition unless disabled using the configuration program IBCONF the handler places devices in local lockout mode which prevents you from returning a device to local mode using the device s front panel control The seven previously described functions will be sufficient to meet your application needs in most cases They are the most important functions for you to learn Group III The functions of Group HI are more flexible for controlling and communicating with devices Group III functions are as follows e IBRDA e IBWRTA e IBRDF e IBWRTF e IBWAIT e IBSTOP e IBTMO e IBONL and IBPCT National Instruments Corp 3 5 GPIB PC User Manual GPIB PC Functions Introduction Section Three These functions are used under the following conditions e Program execution must proceed in parallel with GPIB I O often called asynchronous operation e I O is to or from a file rather than a memory buffer e Controller In Charge authority must be transferred to another GPIB device e The timeout value must be changed e The handler must be reinitialized with respect to certain devices IBRDA bd buf cnt and IBWRTA bd buf cnt These functions are similar to IBRD and IBWRT except that the operation is asynchronous This means that the function re
168. on Four A BASICA QuickBASIC GPIB PC Function Calls Device Example 1 Return the device DVM to local state 100 CALL IBLOC DVMS Board Example 1 Return the interface board BRDO to local state 100 CALL IBLOC BRDO National Instruments Corp 4A 39 GPIB PC User Manual BASICA QuickBASIC GPIB PC Function Calls Section Four A BASICA QuickBASIC BASICA QuickB ASIC IBONL IBONL Purpose Place the device or interface board online or offline Format CALL IBONL BD V Remarks BD specifies a device or an interface board If V is non zero the device or interface board is enabled for operation i e online If V is zero it is held in a reset disabled mode offline Taking a device or interface board offline may be thought of as disconnecting its GPIB cable from the other devices IBONL can also be used to restore the default configuration settings of a device or interface board Calling IBONL with 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 PLOTTERS 100 V 0 110 CALL IBONL PLOTTER V 2 Enable the device PLOTTERS after taking it offline temporarily 100 BDNAMES PLOTTER Device name 110 assigned at configuration time 120 CALL IBFIND BDNAMES PLOTTERS 130 REM IBONL with V non zero is 140 REM automatically performed as
169. ons are easy to learn and use They automatically execute sequences of commands that handle bus management operations required to perform activities such as reading from and writing to devices and polling them for status These functions free you from having to know the GPIB protocol or bus management details involved Most device functions functions that specify a device are high level functions Low Level Functions In contrast low level functions perform rudimentary or primitive operations that require that you know something about GPIB protocol to use them effectively They are needed because high level functions do not always meet the requirements of applications In such cases low level functions offer the flexibility you need to solve most of your application problems All board functions functions that specify a board are low level functions Calling Syntax The calling syntax for GPIB PC functions varies according to the language used In this section a generic syntax is used to identify the function and its arguments National Instruments Corp 3 1 GPIB PC User Manual GPIB PC Functions Introduction Section Three Group I Group I functions may be the only functions you need for many of your instrument control applications Group I functions are as follows e IBRD e IBWRT and IBFIND They are suitable for your applications under the following conditions e Communication is between the Controller computer an
170. ons at beginning of this section Device Example 1 Read 56 bytes of data into the integer array RD from the device TAPE while performing other processing 100 RE Perform device read 110 CNT 56 120 RE Array size is equal to CNT divided 130 RE by 2 140 DIM RD 28 150 CALL IBRDIA TAPE RD 0 CNTS 160 ASKS amp H4100 TIMO CMPL 170 RE Perform other processing here then 180 RE wait for I O completion or a 190 RE timeout 200 CALL IBWAIT TAPE MASK 210 RE Check IBSTA to see how the read 220 RE terminated on CMPL END TIMO or 230 RE ERR 240 RE If CMPL or ERR is not set 250 RE continue processing 260 IF IBSTA AND amp H8100 0 GOTO 160 270 RE Data is stored in RD 280 RE All unaddressing has been done QuickBASIC Version 2 0 or 3 0 replace line 150 with 150 CALL IBRDIA TAPE VARPTR RD 0 CNTS National Instruments Corp 4A 61 GPIB PC User Manual BASICA QuickBASIC GPIB PC Function Calls Section Four A QuickBASIC Version 4 0 replace line 150 with 150 CALL IBRDIA TAPE Board Examples 1 Read 56 bytes of data into the integer array RD from a device at talk address amp H4C ASCII L and then unaddress it the GPIB PC listen address is amp H20 or ASCII space 100 RE Perform addressing in preparation 110 REM for board read 120 CMDS L UNL MLA TAD 130 CALL IBCMD
171. our system to load the handler into DOS and e Run IBTEST to test the installation of the software Step 3 Run IBCONF optional The pamphlet Getting Started with your GPIB PC that comes with your interface board explains when you must run IBCONF to reconfigure the software You may also run IBCONF to examine how the software is configured See More About 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 that DOS will load the GPIB PC handler Step 5 Test Software Installation Run IBTEST from the directory GPIB PC in your boot area by entering cd gpib pc ibtest IBTEST tests whether the handler is installed and functioning with the GPIB PC National Instruments Corp 2 5 GPIB PC User Manual Installation and Configuration Section Two If errors occur check the following e Did you read Getting Started with your GPIB PC and make any required changes If not do so now e Did you change hardware switch settings on your GPIB PC board If so run IBCONF and accurately input the new settings for the board e Are the GPIB COM and CONFIG SYS files installed in the root directory of your boot drive If not check and repeat the installation instructions e Did you reboot your system
172. own The ECIC error results if the GPIB PC is not CIC Refer also to IBCAC In the example that follows GPIB commands and addresses are coded as printable ASCII characters When the hex values to be sent over the GPIB correspond to printable ASCII characters this is the simplest means of specifying the values Refer to Appendix A for conversions of hex values to ASCII characters GPIB PC User Manual 4A 34 National Instruments Corp Section Four A BASICA QuickBASIC GPIB PC Function Calls Board Example 1 Turn the ATN line off with the IBGTS function after unaddressing all Listeners with the Unlisten UNL or ASCII command addressing a Talker at amp H46 ASCII F and addressing a Listener at amp H31 ASCII 1 to allow the Talker to send data messages 100 CMD F1 UNL MTA1 MLA2 110 CALL IBCMD BRDO CMDS 120 Ve 1 Listen in continuous mode 130 CALL IBGTS BRD0 V National Instruments Corp 4A 35 GPIB PC User Manual BASICA QuickBASIC GPIB PC Function Calls Section Four A BASICA QuickBASIC BASICA QuickB ASIC IBIST IBIST Purpose Set or clear individual status bit for Parallel Polls Format CALL IBIST BD V Remarks BD specifies an interface board If V is non zero the individual status bit is set If V is zero the bit is cleared The IBIST function is used when the GPIB PC participates in a parallel poll that is conducted by another device that is the Active Controller
173. part of 150 REM IBFIND 3 Reset the configuration settings of the device PLOTT their defaults Gl W ae 100 V 1 110 CALL IBONL PLOTTER V GPIB PC User Manual 4A 40 National Instruments Corp Section Four A BASICA QuickBASIC GPIB PC Function Calls Board Examples 1 Disable the interface board BRDOS 100 V 0 110 CALL IBONL BRDO V 2 Enable the interface board BRDO after taking it offline temporarily 100 BDNAMES GPIBO Board name assigned 110 at configuration time 120 CALL IBFIND BDNAMES BRDO 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 BRDO to their defaults 100 V 1 110 CALL IBONL BRD0 V National Instruments Corp 4A 41 GPIB PC User Manual BASICA QuickBASIC GPIB PC Function Calls Section Four A BASICA QuickBASIC BASICA QuickB ASIC IBPAD IBPAD Purpose Change Primary Address Format CALL IBPAD BD V Remarks BD specifies a device or an interface board V specifies the primary GPIB address of the device or interface board IBPAD is needed only to alter the value from its configuration setting Only the low five bits of V are significant and they must not all be ones Thus there are 31 valid GPIB addresses ranging from 0 to amp H1E An EARG error results if the value of V is not in this range The assignment made by th
174. pendent data messages The two methods permit a Talker to send data messages of any length without the Listener s knowing in advance the number of bytes in the transmission The two methods are as follows e END message In this method the Talker asserts the EOI End Or Identify signal simultaneously with transmission of the last data byte By design the Listener stops reading when it detects a data message accompanied by EOI regardless of the value of the byte e End of string EOS character In this method the Talker uses a special character at the end of its data string By prior arrangement the Listener stops receiving data when it detects that character Either a 7 bit ASCII character or a full 8 bit binary byte may be used The methods can be used individually or in combination However it is important that the Listener be properly configured to unambiguously detect the end of a transmission The GPIB PC always terminates IBRD operations on the END message Using the configuration program you can accommodate all permissible forms of read and write termination The default configuration settings for read and write termination can be changed at run time using the IBEOS and IBEOT functions if necessary National Instruments Corp 4 11 GPIB PC User Manual GPIB PC Functions Overview Section Four Device Function Calls Device functions are those functions in which the unit descriptor identifies a device rather than
175. personal computer plays all three roles e Controller to manage the GPIB e Talker to send data and e Listener to receive data The Controller In Charge and System Controller Although there can be multiple Controllers on the GPIB only one Controller at a time is active or Controller In Charge CIC Active control can be passed from the current CIC to an idle Controller Only one device on the bus the System Controller can make itself the CIC The GPIB PC is usually the System Controller GPIB PC User Manual 1 2 National Instruments Corp Section One Operation of the GPIB GPIB Signals and Lines The interface system consists of 16 signal lines and 8 ground return or shield drain lines The 16 signal lines are divided into the following three groups e 8 data lines e 3 handshake lines and e 5 interface management lines Data Lines The eight data lines DIO1 through DIO8 carry both data and command messages All commands and most data use the 7 bit ASCII or ISO code set in which case the 8th bit DIO8 is unused or used for parity Handshake Lines Three lines asynchronously control the transfer of message bytes between devices NRFD e NDAC and e DAV The process is called a three wire interlocked handshake and it guarantees that message bytes on the data lines are sent and received without transmission error NRFD not ready for data NRFD indicates when a device is ready or not ready to receive a
176. plement Section Four contains a discussion of the important characteristics common to all programming languages The BASIC supplement lists the GPIB functions for BASICA and QuickBASIC languages When you order a language other than BASIC you receive a separate supplement unless your language is very similar to BASICA Insert any new supplements in place of or in addition to Section Four A General Programming Information The following characteristics are common to all programming languages e A Status Word e Error Codes e A Count Variable e Read and Write Termination e Device Function Calls and e Automatic Serial Polling A thorough understanding of the concepts presented here is essential to the implementation of a GPIB system The next several paragraphs explain the status word IBSTA the error variable IBERR and the count variable IBCNT These variables are updated with each function call to reflect the status of the most recently referenced device or board National Instruments Corp 4 1 GPIB PC User Manual GPIB PC Functions Overview Section Four Status Word All functions return a status word containing information about the state of the GPIB and the GPIB PC You should test for the conditions reported in the status word to make decisions about continued processing The status word is returned in the variable IBSTA The status word contains 16 bits of which 14 are meaningful A bit value of
177. ponse in SPR National Instruments Corp 4A 69 GPIB PC User Manual BASICA QuickBASIC GPIB PC Function Calls Section Four A BASICA QuickBASIC BASICA QuickBASIC IBRSV IBRSV Purpose Request service and or set or change the serial poll status byte Format CALL IBRSV BD V Remarks BD specifies an interface board V specifies the response or status byte the GPIB PC provides when serially polled by another device that is the GPIB CIC If bit 6 the amp H40 bit is set the GPIB PC additionally 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 IBERRS Refer also to Table 2 1 Board Examples 1 Set the Serial Poll status byte to amp H41 which simultaneously requests service from an external CIC 100 V amp H41 110 CALL IBRSV BRD0O V 2 Change the status byte as in Example 1 without requesting service 100 V amp H01 New status byte value 110 CALL IBRSV BRD0O V GPIB PC User Manual 4A 70 National Instruments Corp Section Four A BASICA QuickBASIC GPIB PC Function Calls BASICA QuickBASIC BASICA QuickB ASIC IBSAD IBSAD Purpose Change or disable Secondary Address Form
178. primary GPIB address of all GPIB PC boards is 0 unless changed by IBCONF There are no hardware switches on the GPIB PC to select the GPIB address Secondary GPIB Address Any device or board using extended addressing must be assigned a secondary address in the range hex 60 to hex 7E or the option NONE may be selected to disable secondary addressing As with primary addressing the secondary GPIB address of any device is set within that device either with hardware switches or in some cases a software program This address and the address listed in IBCONF must be the same Refer to the device documentation for instructions Secondary addressing is disabled for all devices and boards unless changed by IBCONF Timeout Settings The timeout value is the approximate length of time that may elapse before I O functions such as IBRD IBWRT and IBCMD complete It is also the length of time that the IBWAIT function waits for an event before returning if the TIMO bit is set Consequently a wait for the SRQ line to be asserted will terminate after the time limit is reached if both the SRQI and TIMO bits are set in the mask passed to IBWAIT and no SRQ signal is detected Refer to the IBWAIT function description in Sections Three and Four for more information GPIB PC User Manual 2 12 National Instruments Corp Section Two Installation and Configuration This field is set to a code mnemonic which specifies the time limit as follows Tabl
179. programs that DOS loads when it is booted CONFIGURATION The process of altering the software parameters in the handler that describe the key characteristics of the devices and boards that are manipulated by the handler By keeping this information such as GPIB address in the handler it does not have to be defined in each application program IBCONF EXE is the GPIB PC configuration program CONTROLLER or CONTROLLER IN CHARGE CIC The device that manages the GPIB by sending interface messages to other devices DATA or DATA MESSAGE Common term for device dependent message DAV 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 Interpretive BASICA See Language Interface DEVICE An instrument peripheral computer or other electronics equipment that can be programmed over the GPIB See Board DEVICE DEPENDENT MESSAGE A message sent from one device to another device such as a programming instructions data or device status See Commands or Interface Message DEVICE FUNCTION A function that operates on or otherwise pertains to a GPIB device rather than to the GPIB PC interf
180. ps are performed automatically to write to the device 1 The IBCMD function is called to address the device to listen and the assigned interface board to talk 2 The board IBWRTA function is called to write the data to the device as explained in the following discussion Other command bytes may be sent as necessary GPIB PC User Manual 4A 90 National Instruments Corp Section Four A BASICA QuickBASIC GPIB PC Function Calls When the device IBWRTA function returns IBSTA holds the latest device status and IBERR is the first error detected if the ERR bit in IBSTA is set When the I O finally completes and the CMPL bit is set in IBSTA the handler automatically unaddresses all devices Board IBWRTA Function When BD specifies an interface board the IBWRTA function attempts to write to a GPIB device that is assumed to be already properly initialized and addressed If the board is CIC the IBCMD function must be called prior to IBWRTA to address the device to listen and the board to talk Otherwise the device on the GPIB that is the CIC must 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 ITBCMD function An ENOL error occurs if there are no listene
181. r for a timeout if the current time limit is too short use IBTMO to change it SK amp H5000 LL IBWAIT BRDO MASK IBSTAS AND amp HC000 lt gt 0 THEN GOTO 3000 Since neither a timeout nor an error occurred IBWAIT must have returned on SRQ Next do a serial poll First unaddress bus devices and send the Serial Poll Enable SPE command then send the CM CA BE RD IF IF DVM s talk address and the GPIB PC listen address amp H20 ASCII space D _ CHR amp H18 C LL IBCMD BRDO CMDS IBSTA lt 0 THEN GOTO 3000 Now read the status byte If it is amp HCO the DVM has valid data to send otherwise it has a fault condition to report SPACE 1 CALL IBRD BRDO RDS IBSTAS lt 0 THEN GOTO 3000 ASC RDS lt gt amp HCO THEN GOTO 4000 If more than one device were attached to the bus it would be necessary to explicitly check the amp H40 bit of the DVM status word to be sure that another device had not been responsible for asserting SRO Complete the serial poll by sending the Serial Poll Disable SPD message lt S SEEKERS RES CMDS CHR amp H19 IF CALL IBCMD BRD0 CMD IBSTA lt 0 THEN GOTO 3000 GPIB PC User Manual 4A 106 National Instruments Corp Section Four A BASICA QuickBASIC GPIB PC Function Calls 790 REM 800 REM Since the DVM and GP
182. r the duration of the program execution While the IEEE 488 standard does not specifically allow schemes in which System Control can be passed dynamically from one device to another the IBRSC function would be used in such a scheme When IBRSC is called and an error does not occur the previous value of ist is stored in IBERRS amp Refer also to Table 2 1 GPIB PC User Manual 4A 66 National Instruments Corp Section Four A BASICA QuickBASIC GPIB PC Function Calls Board Example 1 Request to be System Controller if the interface board BRDO is not currently so designated 100 V 1 Any non zero value will do 110 CALL IBRSC BRD0 V National Instruments Corp 4A 67 GPIB PC User Manual BASICA QuickBASIC GPIB PC Function Calls Section Four A BASICA QuickBASIC BASICA QuickB ASIC IBRSP IBRSP Purpose Return serial poll byte Format CALL IBRSP BD SPR Remarks BD specifies a device SPR is the variable in which the poll response is stored The IBRSP function is used to serially poll one device and obtain its status byte or to obtain a previously stored status byte If bit 6 the amp H40 bit of the response is set the status response is positive i e the device is requesting service On exit all devices are unaddressed When automatic 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
183. r this contains its value otherwise it is undefined contains the GPIB status information contains the GPIB error information or the previous value of the value parameter if no error occurred contains the number of bytes transferred for functions that have a buffer as a parameter this displays its contents Each byte of the buffer is shown with its index character image and ASCII value shows the state of the individual bits of IBSTA A x indicated the bit is active The active bits of the trap mask are highlighted for easy identification shows the state of the individual bits of IBERR A x indicates the bit is active contains any message concerning the current GPIB call National Instruments Corp 6 5 GPIB PC User Manual IBIC Section Six NOTE All numbers are displayed in hexadecimal Also the monitor is unable to record IBF IND or IBTRAP calls GPIB PC User Manual 6 6 National Instruments Corp Section Six IBIC Main Commands When the main monitor screen is displayed the following command keys are available Fl continue executing applications 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 b
184. rror does not occur the previous value of ist is stored in IBERRS Device IBPPC Function When BD specifies a device the IBPPC function enables or disables the device from responding to parallel polls IBPPC calls the board IBCMD function to send the following commands e Listen address of the device e Secondary address of the device if applicable e Parallel Poll Configure PPC and e 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 parallel poll The assigned message is interpreted by the device along with the current value of the individual status ist bit to determine if the selected line is driven true or false For example if the PPE amp H64 DIOS is driven true if ist 0 and false if ist 1 And if PPE amp H68 DIO1 is driven true if ist 1 and false if ist 0 Any PPD message or zero value cancels the PPE message in effect National Instruments Corp 4A 45 GPIB PC User Manual BASICA QuickBASIC GPIB PC Function Calls Section Four A Which PPE and PPD messages are sent and the meaning of a particular parallel poll response are all system dependent protocol matters to be determined by you On exit all devices are unaddressed Board IBPPC Function When BD specifies an interface board the board it
185. rs 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 Between the issuing of the IBWRTA call and the corresponding CMPL other GPIB function calls to this device or to any other device with the same access board or any board calls to the access board itself will return the error EOIP with the following exceptions e IBSTOP to cancel the asynchronous I O e IBWAIT to monitor other GPIB conditions or IBONL to cancel the I O and reset the interface National Instruments Corp 4A 9 GPIB PC User Manual BASICA QuickBASIC GPIB PC Function Calls Section Four A Device Example 1 Write 10 instruction bytes to the device DVM while performing other processing 100 110 120 130 140 150 160 170 180 190 200 210 Board Example ry H EM ry H D RTS F3R1X5P2G0 M M M CALL IBWRTA DVM WRTS ASK amp H4100 TIMO CMPL Perform other processing here then wait for I O completion or a timeout LL IBWAIT DVM MASK Check IBSTA to see how the write terminated on CMPL END TIMO or ry E ry E ry ry H M F ERR If CMPL is not set continue processing IBSTA AND amp H100 0 GOTO 130 1 Write 10 instruction bytes to a device at listen address amp H2F ASCII while testing for a high priority event to occur and then unaddres
186. ruments family of GPIB interface boards to personal computers Family members include GPIB PCII GPIB PCITA GPIB PCIII GPIB PCjr GPIB PC2000 and Rainbow GPIB PC GTL or GO TO LOCAL A GPIB command used to place an addressed Listener in local front panel control mode HANDSHAKE The mechanism used to transfer bytes from the Source Handshake function of one device to the Acceptor Handshake function of another device The three GPIB lines DAV NRFD and NDAC are used in an interlocked fashion to signal the phases of the transfer so that bytes can be sent asynchronously e g without a clock at the speed of the slowest device National Instruments Corp G 3 GPIB PC User Manual Glossary HANDLER Device driver software installed within the operating system Same as a DOS installed device driver See Driver HARD BOOT See Boot HIGH LEVEL FUNCTION A device function that combines several rudimentary board operations into one function so that the user does not have to be concerned with bus management or other GPIB protocol matters See Low Level Function IBCONF EXE The GPIB PC configuration program See Configuration IBCNT A global variable that is updated after each I O function call to show the actual number of bytes sent or received IBERR A global variable that contains the specific error code associated with a function call that failed IBSTA A global variable that is updated at the end of each function ca
187. s Introduction Section Three IBPPC bd v IBPPC locally configures or unconfigures the board for parallel polls IBIST bd v IBIST sets or clears the board s parallel poll flag also known as the individual status bit IBWAIT bd mask This function is described in Group IV It is included here to describe the additional events associated with noncontroller operations that the function can detect These include being triggered DTAS or cleared DCAS by the controller being placed in remote programming mode REM by the controller or being placed in a lockout state LOK by the controller GPIB PC User Manual 3 16 National Instruments Corp Section Three GPIB PC Functions Introduction Group VI Group VI functions are used only when the default values of the configuration parameters set during software installation need to be changed dynamically or temporarily during execution of the application program Group VI functions are as follows They IBEOT IBEOS IBBNA IBDMA IBPAD IBSAD IBRSC and IBTMO are used to accomplish the following actions Change the way I O transmissions are terminated Associate a device with a different access board Change from DMA to programmed I O Change the GPIB address of a board or device Request or release System Control IBEOT bd v IBEOT enables or disables sending the END message EOI with the last byte written by the board National Instr
188. s Corp Section Four A BASICA QuickBASIC GPIB PC Function Calls BASICA QuickBASIC GPIB Programming Examples This section illustrates the programming steps that could be used to program a representative IEEE 488 instrument from your personal computer using the GPIB PC handler functions The applications are written in BASICA and QuickBASIC The target instrument is a digital voltmeter DVM This instrument is otherwise unspecified that is it is not a DVM manufactured by any particular manufacturer The purpose here is to explain how to use the handler to execute certain programming and control sequences and not how to determine those sequences Because the instructions that are sent to program a device as well as the data that might be returned from the device are called device dependent messages 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 program this DVM to make and return measurements of a high frequency AC voltage signal in the autoranging mode 1 Initialize the GPIB interface circuits of the DVM so that it can respond to messages 2 Place the DVM in remote programming mode and t
189. s called to address the device to talk and the access 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 number of data bytes read from the device and IBERR3 is the first error detected if the ERR bit in IBSTA is set Board IBRD Function When BD specifies an interface board the IBRD function attempts to read from a GPIB device that is assumed to already be properly initialized and addressed If the access board is CIC the IBCMD function must be called prior to IBRD to address a device to talk and the board to listen Otherwise the device on the GPIB that is the CIC must perform the addressing National Instruments Corp 4A 47 GPIB PC User Manual BASICA QuickBASIC GPIB PC Function Calls Section Four A If the access board is Active Controller the board is first placed in Standby Controller state with ATN off and remains there after the read operation is completed Otherwise the read operation commences immediately An EADR error results if the board is CIC but has not been addressed to listen with the IBCMD function An EABO error results if the board is not the CIC and is
190. s cleared whenever REN becomes unasserted or when the GPIB PC as a Listener detects the Go to Local GTL command has been sent either by the GPIB PC or by another Controller or when the IBLOC function is called while the LOK bit is cleared in the status word CIC specifies whether the GPIB PC is the Controller In Charge It is set whenever the IBSIC function is called while the GPIB PC is System Controller or when another Controller passes control to the GPIB PC It is cleared whenever the GPIB PC detects Interface Clear IFC from the System Controller or when the GPIB PC passes control to another device ATN specifies the state of the GPIB Attention ATN line It is set whenever the GPIB ATN line is asserted and cleared when the ATN line is unasserted TACS specifies whether the GPIB PC has been addressed GPIB PC User Manual 4 4 National Instruments Corp Section Four GPIB PC Functions Overview as a Talker It is sent either by the GPIB PC itself or by another Controller It is cleared whenever the GPIB PC detects the Untalk UNT command a talk address other than its own talk address or Interface Clear IFC LACS b LACS specifies whether the GPIB PC has been addressed as a Listener It is set whenever the GPIB PC detects its listen address and secondary address if enabled has been sent either by the GPIB PC itself or by another Controller It is also set whenever the GPIB PC shadow handshakes as a result of the
191. s 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 IBSTAS indicating that the I O is complete IBCNT3 indicates the number of bytes received Between the issuing of the IBRDA call and the corresponding CMPL other GPIB function calls to this device or to any other device with the same access board or any board calls to the access board itself will return the error EOIP with the following exceptions e IBSTOP to cancel the asynchronous I O e IBWAIT to monitor other GPIB conditions or e IBONL to cancel the I O and reset the interface National Instruments Corp 4A 51 GPIB PC User Manual BASICA QuickBASIC GPIB PC Function Calls Device Example 1 other processing Section Four A Read 56 bytes of data from the device TAPE while performing 100 REM Perform device read 110 RDS SPACES 56 120 CALL IBRDA TAPE RDS 130 MASK amp 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 S 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 amp H100 0 GOTO 130 230 REM Data is stored in RDS 240 REM All un
192. s it the GPIB PC talk address is amp H40 or ASCH 100 REM Perform addressing in preparation 110 REM for board write 120 CMD UNL MTA LAD 130 CALL IBCMD BRDO CMDS 140 REM Perform board asynchronous write 150 WRTS F3R1X5P2G0 160 CALL IBWRTA BRDO WRTS 170 REM Perform other processing here then 180 REM wait for I O completion or a 190 REM timeout 200 MASKS amp H4100 TIMO CMPL 210 CALL IBWAIT BRDO MASK 220 REM Unaddress the Talker and Listener 230 CMDS _ UNT UNL 240 CALL IBCMD BRD0 CMD GPIB PC User Manual 4A 92 National Instruments Corp Section Four A BASICA QuickBASIC GPIB PC Function Calls BASICA QuickBASIC BASICA QuickB ASIC IBWRTF IBWRTF Purpose Write data from file Format CALL IBWRTF BD FLNAMES Remarks BD specifies a device or an interface board FLNAMES indicates the filename from which the data is written to the GPIB FLNAMES may be up to 50 characters long including a drive and path designation IBWRTF automatically opens the file On exit IBWRTF closes the file An EFSO error results if it is not possible to open seek read or close the file Device IBWRTF Function When BD specifies a device the device IBWRT function is 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 devic
193. sable a configured device from participating in polls There are 16 PPD commands PPE or PARALLEL POLL ENABLE A GPIB command used to enable a configured device to participate in polls and to assign a DIO response line There are 16 PPE commands PPU or PARALLEL POLL UNCONFIGURE A GPIB command used to disable any device from participating in polls PROGRAMMED I O Low speed data transfer between the GPIB PC and memory in which the CPU moves each data byte according to program instructions 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 reading the status byte of one device at a time See Parallel Poll SOFT BOOT See Boot SOURCE HANDSHAKE The GPIB interface function that transmits data and commands Talkers use this function to send data and the Controller uses it to send commands See Acceptor Handshake and Handshake SPD or SERIAL POLL DISABLE A GPIB command that cancels a SPE command SPE or SERIAL POLL ENABLE A GPIB command used to enable a specific device to be polled That device must also be addressed to talk See SPD GPIB PC User Manual G 6 National Instruments Corp
194. se commands which are listed in Appendix A include device talk and listen addresses secondary addresses serial and parallel poll configuration messages and device clear and trigger instructions The IBCMDA function is also used to pass GPIB control to another device This function is NOT used to transmit programming instructions to devices Programming instructions and other device dependent information are transmitted with the write and read functions IBCMDA is used in place of IBCMD when the application program must perform other functions while processing the GPIB I O operation IBCMDA returns after starting the I O operation If the number of bytes to send is small and the bytes are accepted quickly by the GPIB device s the operation may complete on the initial call In this case the CMPL bit will be set in IBSTA If the operation does not complete on the initial call you should monitor the IBSTAS variable after subsequent calls usually IBWAIT calls to know that the I O is completed When CMPL becomes set in IBSTA indicating that the I O is complete the number of bytes sent is reported in the IBCNTS variable Between the issuing of the IBCMDA call and the corresponding CMPL other GPIB function calls to this board will return the error EOIP with the following exceptions IBSTOP to cancel the asynchronous I O e IBWAIT to monitor other GPIB conditions and National Instruments Corp 4A 23 GPIB PC User Manual
195. self is programmed to respond to a parallel poll by setting 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 DIOS true ist 0 100 V S amp 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 S amp H68 110 CALL IBPPC DVM V 3 Cancel the parallel poll configuration of the device DVM 100 V amp H70 110 CALL IBPPC DVM V Board Example 1 Configure the interface board BRDO to respond to a parallel poll by sending data line DIOS true ist 0 100 V S amp H64 110 CALL IBPPC BRD0 V GPIB PC User Manual 4A 46 National Instruments Corp Section Four A BASICA QuickBASIC GPIB PC Function Calls BASICA QuickBASIC BASICA QuickB ASIC IBRD IBRD Purpose Read data to string Format CALL IBRD BD RD Remarks BD specifies a device or an interface board RD identifies the storage buffer for data bytes that are read from the GPIB The IBRD function reads from 1 to 255 bytes of data from a GPIB device In QuickBASIC the IBRD function reads from 1 to 32K bytes of data from a GPIB device Device IBRD Function When BD specifies a device the following board steps are performed automatically to read from the device 1 The IBCMD function i
196. stalling the Hardware To install your hardware follow the instructions in the Section Two supplement for your interface board If you change the default settings of any switches make a note of the new values so that you can refer to them when you configure your software Install the hardware before continuing The GPIB PC Software Package Before you install your software you might wish to review the files on your GPIB PC distribution diskette to gain an understanding of what they are The following files are the main files of the GPIB PC software e GPIB COM is a device handler file that is loaded at system start up by the DOS operating system Handler is a term used by National Instruments to refer to a loadable device driver e BIB M is a language interface file that provides an application program access to the GPIB PC handler BIB M is intended for use with programs written in BASICA e QBIB OBd is a language interface file that provides an application program access to the GPIB PC handler QBIB OBJ is intended for use with programs written in QuickBASIC National Instruments Corp 2 1 GPIB PC User Manual Installation and Configuration Section Two DECL BAS is a declaration file that contains code to be placed at the beginning of the BASICA and QuickBASIC application programs QBDECL BAS is a declaration file that contains code to be placed at the beginning of the QuickBASIC application programs
197. status bit 100 V 0 110 CALL IBIST BRDO V National Instruments Corp 4A 37 GPIB PC User Manual BASICA QuickBASIC GPIB PC Function Calls Section Four A BASICA QuickBASIC BASICA QuickB ASIC IBLOC IBLOC Purpose Go to Local Format CALL IBLOC BD Remarks BD specifies a device or an interface board Unless the Remote Enable line has been unasserted with the IBSRE function all device functions automatically place the specified device in remote program mode IBLOC is used to move devices temporarily from a remote program mode to a local mode until the next device function is executed on that device Device IBLOC Function IBLOC places the device indicated in local mode by calling IBCMD to send the command sequence e Unlisten UNL e Listen address of the device e Secondary address of the device if necessary e Go To Local GTL and e 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 interface board the board is placed in a local state by sending the local Return To Local rtl message provided it is not locked in remote mode The LOK bit of the status word indicates whether the board is in a lockout state The IBLOC function is used to simulate a front panel Return To Local switch when the computer is used as an instrument GPIB PC User Manual 4A 38 National Instruments Corp Secti
198. system has slower devices you may want to select a longer data setting time by selecting no for this field Interrupt Jumper Setting Boards Only This field must be set to the same value as the interrupt level jumper setting on the GPIB PC board itself For most personal computers this jumper setting reflects the actual interrupt level selected Any exception is explained in the Getting Started with your GPIB PC pamphlet that comes with the interface board Any valid interrupt level may be selected provided the level does not conflict with other equipment Base I O Address Boards Only The GPIB PC may be assigned any one of the legal base I O or port addresses as described in the appropriate supplement to this section The value entered must match the hardware setting selected during hardware configuration If it does not match the handler cannot communicate with the GPIB PC National Instruments Corp 2 15 GPIB PC User Manual Installation and Configuration Section Two DMA Channel Boards Only This field appears only on computers supporting DMA capability The GPIB PC may use any of the three DMA channels 1 2 or 3 provided that another device is not already using that channel If a DMA channel is not available programmed I O can be enabled by selecting NONE Internal Clock Frequency Boards Only For the GPIB PCII this value is equal to the frequency of the PC bus signal OSC divided by 2 and rounded up Since OSC
199. te Enable REN signal V 1 CALL IBSRE BRDO V IF IBSTA S lt 0 THEN GOTO 3000 Inhibit front panel control with the lt ek EE HYPAAAAAAR r A i A Fe I Z J D D D Bo amp amp ss listen socal Lockout DVM in remote mode by addressing it to send the Device Clear DCL LLO command place the functions message to clear internal device and address the GPIBO to talk CMD CHR amp H11 CHRS amp H14 CALL IBCMD BRDO CMDS IF IBSTAS lt 0 THEN GOTO 3000 z M Write the function range and trigger source instructions to the DVM WRT F3R7T3 CALL IBWRT BRDO WRTS IF IBSTAS lt 0 THEN GOTO 3000 4A 105 GPIB PC User Manual BASICA QuickBASIC GPIB PC Function Calls 430 440 450 455 460 470 480 490 500 510 515 520 530 540 550 560 570 580 590 600 610 615 620 630 640 650 660 670 680 690 695 700 710 720 730 TIL 732 734 735 736 738 740 750 760 765 770 780 NAA DA GF FF GF FI D N NNN Er FF GF Er eA HHA AKRAXK AB DEY OS EE Ge Be ed lt S KER EES DUNN ED A r Ee A SRR HPAHAAAAARARA DD DE EP eb Bed ey A EM EM EM S CMD CHR amp H8 E MA CA IF Section Four A Send the GET message to trigger a measurement reading CALL IBCMD BRD0 CMD IBSTA lt 0 THEN GOTO 3000 Wait for the DVM to set SRQ o
200. the number of commands sent A short count can occur on any event but the first An ECIC error results if the GPIB PC is not CIC If it is not Active Controller it takes control and asserts ATN prior to sending the command bytes It remains Active Controller afterward GPIB PC User Manual 4A 20 National Instruments Corp Section Four A BASICA QuickBASIC GPIB PC Function Calls In the examples that follow GPIB commands and addresses are coded as printable ASCII characters When the values to be sent over the GPIB correspond to printable ASCII characters this is the simplest means of specifying the values Refer to Appendix A for conversions of numeric values to ASCII characters Board Examples 1 Unaddress all Listeners with the Unlisten UNL or ASCII command and address a Talker at amp H46 ASCII F and a Listener at amp H31 ASCII 1 100 CMDS F1 UNL TAD1 LAD2 110 CALL IBCMD BRDO CMDS Same as Example 1 except the Listener has a secondary address of amp H6E ASCII n 100 CMDS Fin UNL TAD1 LAD2 SAD2 110 CALL IBCMD BRDO CMDS Clear all GPIB devices i e reset internal functions with the Device Clear DCL or amp H14 command 100 CMDS CHRS amp H14 DCL 110 CALL IBCMD BRDO CMDS Clear two devices with listen addresses of amp H21 ASCII and amp H28 ASCII left parenthesis with the Selected Device Clear SDC or amp H04 command 100 CMDS CHRS amp HO4
201. the number of bytes read is reported in the IBCNT variable Device IBRDA Function When BD specifies a device the following board steps are performed automatically to read from the device 1 The IBCMD function is called to address the device to talk and the access board to listen 2 The board IBRDA function is called to read the data from the device as explained in the following discussion Other command bytes may be sent as necessary When the device IBRDA function returns IBSTA holds the latest device status IBERR is the first error detected if the ERR bit in IBSTAS is set GPIB PC User Manual 4A 50 National Instruments Corp Section Four A BASICA QuickBASIC GPIB PC Function Calls When the I O finally completes and the CMPL bit is set in IBSTA the handler automatically unaddresses all devices Board IBRDA Function When BD specifies an interface board the IBRDA function attempts to read from a GPIB device that is assumed to be already properly initialized and addressed If the board is CIC the IBCMD function must be called prior to IBRDA to address the device to talk and the board to listen Otherwise the device on the GPIB that is the CIC must 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 read operation is completed Otherwise the read operation commences immediately An EADR error result
202. thin the time limit An ENOL error occurs 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 e All bytes are transferred e Error is detected e Time limit is exceeded or e 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 written A short count can occur on any event but the first Device Examples 1 Write 10 instruction bytes to the device DVM 100 WRITS F3R1X5P2G0 110 CALL IBWRT DVM WRTS 2 Write 5 instruction bytes terminated by a carriage return and a linefeed to the device PTR Linefeed is the device s EOS character 100 WRTS IP2X5 CHRS amp HOD CHRS amp HOA 110 CALL IBWRT PTR WRTS GPIB PC User Manual 4A 88 National Instruments Corp Section Four A BASICA QuickBASIC GPIB PC Function Calls Board Example 1 Write 10 instruction bytes to a device at listen address amp H2F ASCII and then unaddress it the GPIB PC talk address is amp H40 or ASCII National Instruments Corp 4A 89 UNL MTA LAD Unaddress the Talker and Listener UNT UNL 100 REM Perform addressing 110 CMDS 120 CALL IBCMD BRDO CMDS
203. tly 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 IBF IND performs the equivalent of IBONL to open the specified device or board and to initialize software parameters to their default configuration settings The variable name selected should suggest the actual name of the device or board in order to simplify programming effort If the IBF IND call fails a negative number is returned in place of the unit descriptor The most probable reason for a failure is that the string argument passed into IBF IND does not match the default or configured device or board name GPIB PC User Manual 4A 32 National Instruments Corp Section Four A BASICA QuickBASIC GPIB PC Function Calls Device Example 1 Assign the unit descriptor associated with the device named FSDVM Fluke Sampling Digital Voltmeter to the variable FSDVM 100 BDNAMES FSDVM 110 120 130 CALL IBFIND 140 IF FSDVM Board Example BDNAMES FSDVM lt 0 GOTO 1000 ERROR ROUTIN Device name assigned at configuration time oX E 1 Assign the unit descriptor associated with the interface board GPIBO to the variable BRDO 100 BDNAMES 110 120 130 CALL IBFI 140 IF BRDO National Instruments Corp GPIBO ND lt 0 GOTO
204. to respond positively on DIO3 if its individual status bit is 1 and then parallel poll all configured devices 100 REM Send LAD PPC PPE and UNL 110 CMDS CHRS amp HO5 4 120 CALL IBCMD BRD0O CMDS 130 CALL IBRPP BRD0 PPR 2 Disable and unconfigure all GPIB devices from parallel polling using the PPU amp H15 command 100 CMDS CHRS amp H15 PPU 110 CALL IBCMD BRD0 CMD National Instruments Corp 4A 65 GPIB PC User Manual BASICA QuickBASIC GPIB PC Function Calls Section Four A BASICA QuickBASIC BASICA QuickB ASIC IBRSC IBRSC Purpose Request or release System Control Format CALL IBRSC BD V Remarks BD specifies an interface board If V is non zero functions requiring System Controller capability are subsequently allowed If V is zero functions requiring System Controller capability are disallowed The IBRSC function is used to enable or disable the capability of the GPIB PC to send the Interface Clear IFC and Remote Enable REN messages to GPIB devices using the IBSIC and IBSRE functions respectively 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 System Controller fo
205. turns 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 IBWRIF bd buf cnt These functions are similar to IBRD and IBWRT except that data is read into a file IBWAIT bd mask IBWAIT waits for one or more events to occur For the IBRDA and IBWRTA functions the event to wait for is the completion of the operation IBSTOP bd IBSTOP aborts any asynchronous operation associated with the device GPIB PC User Manual 3 6 National Instruments Corp Section Three GPIB PC Functions Introduction IBTMO bd v IBTMO changes the time limit in which operations with the device must complete IBONL bd v IBONL re initializes the device and cancels any asynchronous I O in progress All reconfigurable software parameters such as the time limit just discussed are reset to their power on values See the discussion of software configuration in Section Two for further information on reconfigurable software parameters The last function in this group allows the computer to pass control to another device capable of being the Controller IBPCT bd IBPCT passes Controller In Charge authority to the specified device by sending the Take Control TCT commands and appropriate addressing commands Most GPIB compatible instruments or other t
206. uments Corp 3 17 GPIB PC User Manual GPIB PC Functions Introduction Section Three IBEOS bd v IBEOS assigns the end of string EOS character to use with subsequent IBRD and IBWRT operations This character is compared with incoming bytes from the device and may be used to terminate a read operation It is also compared with outgoing bytes to the device and may be used to generate the END message EOI IBBNA bd GPIBn IBBNA assigns board n to be the access board for device bd IBDMA bd v IBDMA selects DMA or programmed I O for the board This function is only appropriate for boards with DMA capability IBPAD bd v IBPAD sets the primary GPIB address of the device or board IBSAD bd v IBSAD sets the board s or device s secondary GPIB address or disables secondary addressing IBRSC bd v IBRSC causes the board to request or release System Control authority IBTMO bd v IBTMO sets the time limit in which operations with a device or board must complete Another important feature of the GPIB PC functions is that they return status information about the boards and devices in the system This information is returned in the form of three global status variables IBSTA IBERR and IBCNT The beginning of Section Four fully describes these variables GPIB PC User Manual 3 18 National Instruments Corp Section Four GPIB PC Functions Overview This section consists of Section Four and a BASIC sup
207. urn off front panel control 3 Initialize the internal measurement circuits 4 Program the DVM to the proper function F3 for high frequency AC volts range R7 for autoranging and trigger source T3 for external or remote 5 For each measurement a Send the GET Group Execute Trigger command to trigger the DVM b Wait until the DVM asserts Service Request SRQ to indicate that the measurement is ready to be read National Instruments Corp 4A 101 GPIB PC User Manual BASICA QuickBASIC GPIB PC Function Calls Section Four A c Serially poll the DVM to determine if the measured data is valid status byte amp HCO or if a fault condition exists the amp H40 bit and another bit of the status byte other than amp H80 are set d If the data is valid read 16 bytes from the DVM 6 End the session The example programs that follow are based on these assumptions e The GPIB PC is the designated System Active Controller of the GPIB e There is no change to the GPIB PC default hardware settings e The only changes made to the software parameters are those necessary to define the device DVM at primary address 3 e There is only one GPIB PC in use which is designated GPIBO e Its primary listen and talk addresses are amp H20 ASCII space character and amp H40 ASCII character respectively GPIB PC User Manual 4A 102 National Instruments Corp Section Four A BASICA QuickBASIC GPIB PC Function Calls
208. used with the function IBWAIT Each MASK bit is set cleared to trap or cleared not to trap respectively when the corresponding bit appears in the status word after 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 this call the ERR bit of IBSTA will be set and IBERR will be one of the following 1 Applications monitor not installed 2 Invalid monitor mode 4 EARG IBTRAP not supported by installed handler Otherwise IBERR will contain the previous mask value Refer to Section Six for more information National Instruments Corp 4A 81 GPIB PC User Manual BASICA QuickBASIC GPIB PC Function Calls Section Four A Device Example 1 Configure applications monitor to record and trap on SRQ or CMPL 100 MASK amp H1100 SRQ or CMPL 110 MODE 3 Record and trap on 120 CALL IBTRAP MASK MODES G6 GPIB PC User Manual 4A 82 National Instruments Corp Section Four A BASICA QuickBASIC GPIB PC Function Calls BASICA QuickBASIC BASICA QuickB ASIC IBTRG IBTRG Purpose Trigger selected device Format CALL IBTRG BD Remarks BD specif
209. useful in debugging sequences of GPIB calls from within your application Appendix A Multiline Interface Messages is a listing of Multiline Interface Command Messages Appendix B Common Errors and Their Solutions singles out the most common errors users have encountered and some probable solutions National Instruments Corp vii GPIB PC User Manual Preface Appendix C Differences Between Software Revisions points out differences between revisions of the GPIB PC handler Appendix D Using your Printer with the GPIB PC gives some quick steps to connect your GPIB PC with your printer Appendix E Application Notes is an application note about computer to computer transfers Appendix F Customer Communication contains forms you can use to request help from National Instruments or to comment on our products and manuals The Glossary contains an alphabetical list and description of terms used in this manual including abbreviations acronyms metric prefixes mnemonics and symbols The Index contains an alphabetical list of key terms and topics in this manual including the page where you can find each one Now with your personal computer your GPIB PC your manuals and supplements and these instructions you are ready to get started with your GPIB We hope your experience will be a rewarding one Customer Support National Instruments wants to receive your comments on our products and manuals We are interested in
210. uses the EOI line to mark the end of a message string The Controller uses the EOI line to tell devices to identify their response in a parallel poll Physical and Electrical Characteristics Devices are usually connected with a cable assembly consisting of a shielded 24 conductor cable with both a plug and receptacle connector at each end This design allows devices to be linked in either a linear or a star configuration or a combination of the two See Figures 1 1 1 2 and 1 3 The standard connector is the Amphenol or Cinch Series 57 MICRORIBBON or AMP CHAMP type An adapter cable using non standard cable and or connector is used for special interconnect applications The GPIB uses negative logic with standard TTL logic level When DAV is true for example it is a TTL low level lt 0 8V and when DAV is false it is a TTL high level 2 0V National Instruments Corp 1 5 GPIB PC User Manual Operation of the GPIB Section One J9 DIO1 DIO5 DIO2 DIO6 DIO3 DIO7 DIO8 REN GND TW PAIR W DAV GND TW PAIR W NRFD GND TW PAIR W NDAC GND TW PAIR W IFC SRQ o J22 GND TW PAIR W SRQ ATN GND TW PAIR W ATN SHIELD 24 SIGNAL GROUND o Figure 1 1 GPIB Connector and the Signal Assignment GPIB PC User Manual 1 6 National Instruments Corp Section One Operation of the GPIB T 0 a a r tI Figure 1 2 Linear Configuration National Instruments Corp 1 7 GPIB PC User Manu
211. ut has occurred It is set in the status word following a call to IBWATT if the TIMO bit of the IBWAIT mask parameter is also set and if the wait has exceeded the time limit value that is set by the IBTMO call It is also set following a call to any of the synchronous I O functions e g IBRD IBWRT and IBCMD if a timeout occurs during a call TIMO is cleared in the status word in all other circumstances END db END specifies whether the END or EOS message has been received It is set in the status word following a read function if the END or EOS message was detected during the read While the GPIB PC is performing a shadow handshake as a result of the IBGTS function any other function call may return a status word with the END bit set if the END or EOS message occurred before or during that call It is cleared in the status word when any I O operation is initiated SRQI b SRQI specifies whether a device is requesting service It is set in the status word whenever the GPIB PC is CIC and the GPIB SRQ line is asserted It is cleared whenever the GPIB PC ceases to be the CIC or the GPIB SRQ line is unasserted The bit is also cleared when executing board functions and the GPIB PC is an active talker i e it is addressed to talk and ATN is unasserted In Revision D software the SRQI status bit always reflects the current level of the SRQ line whether or not the GPIB PC is CIC National Instruments Corp 4 3 GPIB PC User Manual
212. vice RDR 100 CALL IBSTOP RDR GPIB PC User Manual 4A 76 National Instruments Corp Section Four A BASICA QuickBASIC GPIB PC Function Calls Board Example 1 Stop any asynchronous operations associated with the interface board BRDOS 100 CALL IBSTOP BRDO National Instruments Corp 4A 77 GPIB PC User Manual BASICA QuickBASIC GPIB PC Function Calls Section Four A BASICA QuickBASIC BASICA QuickB ASIC IBTMO IBTMO Purpose Change or disable time limit Format CALL IBTMO BD V Remarks BD specifies a device or an interface board V is a code specifying the time limit as follows Value Minimum of V Timeout 0 disabled 1 10 psec 2 30 usec 3 100 usec 4 300usec 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 effect until IBTMO is called again the IBONL or IBF IND function is called or the system is rebooted GPIB PC User Manual 4A 78 National Instruments Corp Section Four A BASICA QuickBASIC GPIB PC Function Calls The IBTMO function changes the length of time that the following functions wait for the embedded I O operation to finish or for the specified event to occur before returning with a timeout indication 7 IBC s IBR 7 IBR
213. y BASICA programs may be interrupted on the occurrence of the GPIB SRQ signal When the interrupt occurs a branch can be taken to a service routine which determines the cause of the SRQ and takes the appropriate action National Instruments uses this statement to intercept SRQ interrupt and make them available to user programs For more complete information regarding the operation of ON PEN refer to the IBM BASICA User s Manual and Microsoft QuickBASIC under the ON PEN Statement All the information in that section applies to both the light pen and to the GPIB SRQ signal Statements such as ON PEN which intercept interrupts are a special feature of some versions of BASIC including BASICA and QuickBASIC These statements however are not usually a feature of non BASIC languages and are not necessarily supported in other National Instruments language interfaces To determine if this feature is supported in languages other than BASICA and QuickBASIC refer to the manual supplement that comes with that language GPIB PC User Manual 4A 6 National Instruments Corp Section Four A Table 4A 1 BASICA Description hange access board of device ecome Active Controller lear specified device end commands from string Send commands asynchronously from string nable disable DMA hange disable EOS mode nable disable END message i ies et clear ist Go to local lace device online offline hange primary address ass control ar
214. y GPIB PC on the boot disk Only GPIB COM and IBCONF EXE are copied to the root directory Change to the GPIB PC directory with the DOS command cd GPIB PC to run other programs Error Condition Function call does not return and the program seems to hang forever Solutions e Run IBCONF and 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 e 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 IBIC call IBTMO and pass to it the timeout argument value you believe is correct the default is 13 which represents 10 seconds Assuming that the IBTMO call does not result in an error the previous value returned by the call will equal the value passed to it if the time limit was what you expected e Check that you do not call IBWAIT for an event that may not happen without also waiting for TIMO as well For example if you fail to set the TIMO bit while waiting for RQS from a device and for some reason the device will not assert SRQ the IBWAIT call will not return National Instruments Corp B 7 GPIB PC User Manual Common Errors and Their Solutions Appendix B e All device functions require the board to be Controller
215. y address ass control arallel poll configure Read data to string to string onduct a parallel poll Open device and return unit descripto Go from Active Controller to Standb Read data asynchronousl Read data to file Read data to integer array Read data asynch to integer array Request release system control Return serial poll byte Request service hange secondary address end interface clear et clear remote enable line Abort asynchronous operation continues GPIB PC User Manual 4A 10 CALL Function Syntax BD BNAMES D amp V DS D CMDS Hi WW WW Z D Hi w Q D Q Ww H w Q H w Q 5 wo o H Pe gJ gt BD CMD D V DS V DS V BDNAMI D3 V o HH IH w jw i H J ojo afe vja fe ale ole foe ole IBFI IBGT nS iw www w w w j HHH w wW W O tv Q W WO M f Tools DO J r Joe V lt H wW H n J UO oX lt d Q oe O BLO D H wW O Zz pa UJ oe oe x lt BPA iw o9 lt oe a H Ww UO Q UO oe BRDA o or w 0 FLNAME H w ps U ty 2 wr IBRDI BD IARR CNT IBRDIA BD IARR CNT BRPP BD PPR IBRSC BD V3 DS SPR DS V3 V3 oe oe iJH iH lee tw n aw D n 1JQ O td w w w UO XP oX lt HH w ve n lt w w wo J jo oe za
216. y from your keyboard It helps you to learn the functions to program your instrument or other GPIB device and to develop your application program GPIB PC User Manual 2 2 National Instruments Corp Section Two Installation and Configuration DBSAMP BAS BBSAMP BAS DOBSAMP BIBSAMP and DIBSAMP are example programs for BASICA QuickBASIC and IBIC The BASICA and QuickBASIC supplement of the manual Section Four A contains additional examples Installing the Software The term boot disk refers to the hard disk or floppy disk that contains DOS and that is read by your computer when it is booted The term boot refers to the action of loading DOS into your system from your boot disk either when power is applied or when the warm boot keys are pressed Step 1 Preparation Your first step is determined by whether you wish to boot from a floppy disk or a hard disk Perform the step that applies to your system Booting from a Floppy Disk If you boot DOS from a floppy diskette you need a boot disk with enough free space to hold a copy of the GPIB PC software contained on the distribution diskette Insert the boot diskette into the first drive usually named A and the distribution diskette into the second drive B Boot your system if you have not already done so Booting from a Hard Disk If you boot DOS from a hard disk you need a personal computer with one floppy drive The hard disk must have enough free space
217. you may ignore the occurrence of the automatic polls The polls occur rarely and the error conditions described will not occur unless you use the feature National Instruments Corp 4 13 GPIB PC User Manual GPIB PC Functions Overview Section Four If the handler is configured with automatic serial polling enabled this feature will be disabled after a board level I O function call and resumed after a device level I O function call However if any device level I O call results in a timeout error this feature will be disabled until the next I O call completes NOTE If the RQS bit of the device status word is still set after IBRSP is called the response byte queue has at least one more response byte remaining IBRSP should be called until RQS is cleared to gather all stored response bytes and to guard against queue overflow GPIB PC User Manual 4 14 National Instruments Corp Section Four A BASICA QuickBASIC GPIB PC Function Calls This section contains information for programming the GPIB PC in BASICA and QuickBASIC Versions 4 0 and earlier The term BASICA as used in this section refers to Advanced IBM Interpretive BASIC for the IBM Personal Computer The term QuickBASIC refers to Microsoft QuickBASIC The programming information in this supplement can be used with all versions of BASICA and QuickBASIC unless specified otherwise When different programming information is required that is specific to a particular v
218. ypes of devices can be programmed using the high level functions of Groups I II or M Not all devices however are completely compatible with the IEEE 488 specification nor are the combinations of bus management and or I O operations contained in the high level functions suitable for all applications Some operations such as interprocessor networks and peripheral sharing require additional capabilities and flexibility in controlling the GPIB This is achieved in part with low level functions that perform single GPIB activities each with a limited scope or objective Powerful and versatile routines can be developed using these functions Groups IV V and VI consist mostly of low level functions National Instruments Corp 3 7 GPIB PC User Manual GPIB PC Functions Introduction Group IV Section Three The functions described previously have been device functions that is the bd argument referred to a device on the GPIB This section introduces board functions where bd refers to a specific GPIB PC interface board in the computer Group IV functions are as follows e IBFIND e IBCMD e IBCMDA e IBRD e IBRDA e IBWRT e IBWRTA e IBSTOP e IBWAIT e IBTMO e IBONL e IBSIC e IBSRE e IBGTS e IBCAC e IBRPP and IBPPC GPIB PC User Manual 3 8 National Instruments Corp Section Three GPIB PC Functions Introduction Group IV functions can be used under the following conditions

Download Pdf Manuals

image

Related Search

Related Contents

HD Video Camera Pen Item No. 203775  Robacta Drive CMT  SERVICE MANUAL LAVAGE  753 Dremometer Mini  Lite-On External 16x 8x 8x / 16x 6x 4x / 16x / + 48x 24x 48x Half-Height DVD-Dual  AEDI STAR GROUND user manual  User Manual  Philips FTR9964 User's Manual  MODE D`EMPLOI Contours CV-BTE, CA-BTE, CM-BTE  CyberPower PR3000LCDRT2UTAA uninterruptible power supply (UPS)  

Copyright © All rights reserved.
Failed to retrieve file