National Instruments NI-488.2M User Manual
National Instruments NI-488.2M User Manual

National Instruments NI-488.2M User Manual

Hide thumbs Also See for NI-488.2M:
Table of Contents

Advertisement

Quick Links

NI-488.2M
User Manual for Windows NT
January 1996 Edition
Part Number 320646B-01
© Copyright 1994, 1996 National Instruments Corporation.
All Rights Reserved.

Advertisement

Table of Contents
loading

Summary of Contents for National Instruments NI-488.2M

  • Page 1 ™ NI-488.2M User Manual for Windows NT January 1996 Edition Part Number 320646B-01 © Copyright 1994, 1996 National Instruments Corporation. All Rights Reserved.
  • Page 2 National Instruments Corporate Headquarters 6504 Bridge Point Parkway Austin, TX 78730-5039 (512) 794-0100 Technical support fax: (800) 328-2203 (512) 794-5678 Branch Offices: Australia 03 9 879 9422, Austria 0662 45 79 90 0, Belgium 02 757 00 20, Canada (Ontario) 519 622 9310, Canada (Québec) 514 694 8521,...
  • Page 3 The reader should consult National Instruments if errors are suspected. In no event shall National Instruments be liable for any damages arising out of or related to this document or the information contained in it.
  • Page 4 Any use or application of National Instruments products for or involving medical or clinical treatment must be performed by properly...
  • Page 5: Table Of Contents

    NI-488.2M Driver and Driver Utilities ..........1-6 DOS and 16-bit Windows Support Files........... 1-7 C Language Files................1-7 Sample Application Files ..............1-7 How the NI-488.2M Software Works with Windows NT....... 1-8 Unloading and Reloading the NI-488.2M Driver ..........1-9 Chapter 2 Application Examples ...................
  • Page 6 GPIB Win32 Application................. 3-17 Microsoft Visual C/C++ ..............3-17 Direct Entry with C ................3-17 Microsoft Visual C/C++ ............. 3-19 Borland C/C++..............3-19 Running Existing DOS and Windows GPIB Applications......3-20 NI-488.2M UM for Windows NT © National Instruments Corp.
  • Page 7 Debugging Your Application ................4-1 Running the Software Diagnostic Test ............4-1 Presence Test of Driver ..............4-1 Examining NT Devices to Verify the NI-488.2M Installation................4-1 Examining the NT System Log Using the Event Viewer............... 4-2 GPIB Cables Connected ..............4-2 Running GPIBInfo...................
  • Page 8 Cable Length for High Speed ............7-4 OK ..................... 7-4 Cancel ....................7-4 Help ....................7-4 Software..................... 7-4 Base/IO Address................7-4 Interrupt Level................... 7-5 DMA Channel ................... 7-5 Use Demand Mode DMA ..............7-5 NI-488.2M UM for Windows NT viii © National Instruments Corp.
  • Page 9 Serial Poll Timeout................7-10 Repeat Addressing................7-10 Appendix A Status Word Conditions ..................A-1 Appendix B Error Codes and Solutions ................. B-1 Appendix C Customer Communication ................. C-1 Glossary ......................Glossary-1 Index ........................Index-1 © National Instruments Corp. NI-488.2M UM for Windows NT...
  • Page 10 Figure 1-2. Linear and Star System Configuration ............1-4 Figure 1-3. Example of Multiboard System Setup ............1-5 Figure 1-4. How the NI-488.2M Software Works with Windows NT ......1-9 Figure 2-1. Program Flowchart for Example 1 ............. 2-3 Figure 2-2. Program Flowchart for Example 2 ............. 2-5 Figure 2-3.
  • Page 11: About This Manual

    Use the getting started manual to install and configure your GPIB hardware and NI-488.2M software for Windows NT. Use the NI-488.2M User Manual for Windows NT to learn the basics of GPIB and how to develop an application program. The user manual also contains debugging information and detailed examples.
  • Page 12: Organization Of This Manual

    Organization of This Manual This manual is organized as follows: • Chapter 1, Introduction, gives an overview of GPIB and the NI-488.2M software. • Chapter 2, Application Examples, contains nine sample applications designed to illustrate specific GPIB concepts and techniques that can help you write your own applications.
  • Page 13: Conventions Used In This Manual

    ANSI/IEEE Standard 488.1-1987 and the ANSI/IEEE Standard 488.2-1992, respectively, which define the GPIB. Abbreviations, acronyms, metric prefixes, mnemonics, symbols, and terms are listed in the Glossary. © National Instruments Corp. xiii NI-488.2M UM for Windows NT...
  • Page 14: Related Documentation

    • Microsoft Win 32 Software Development Kit for Windows NT: Tools Customer Communication National Instruments wants to receive your comments on our products and manuals. We are interested in the applications you develop with our products, and we want to help if you have problems with them.
  • Page 15: Chapter 1 Introduction

    Some devices are capable of playing more than one role. A digital voltmeter, for example, can be a Talker and a Listener. If your personal computer has a National Instruments GPIB interface board and NI-488.2M software installed, it can function as a Talker, Listener, and Controller.
  • Page 16: Gpib Addressing

    GPIB interface, which consists of 16 signal lines and eight ground return (shield drain) lines. The 16 signal lines are discussed in the following sections. Data Lines Eight data lines, DIO1 through DIO8, carry both data and command messages. NI-488.2M UM for Windows NT © National Instruments Corp.
  • Page 17: Handshake Lines

    Controller. EOI (end or identify) Talker uses the EOI line to mark the end of a data message. Controller uses the EOI line when it conducts a parallel poll. © National Instruments Corp. NI-488.2M UM for Windows NT...
  • Page 18: Setting Up And Configuring Your System

    Figure 1-2 shows the linear and star configurations. Linear Device A Configuration Device B Device C Star Configuration Device D Device A Device B Device C Figure 1-2. Linear and Star System Configuration NI-488.2M UM for Windows NT © National Instruments Corp.
  • Page 19: Controlling More Than One Board

    Introduction Controlling More Than One Board The NI-488.2M driver can control up to 10 GPIB boards. Figure 1-3 shows an example of a multiboard system configuration. gpib0 is the access board for the voltmeter, and gpib1 is the access board for the plotter and printer. The control functions of the devices automatically access their respective boards.
  • Page 20: The Ni-488.2M Software Elements

    The distribution disk contains the following driver and utility files: • readme.txt is a documentation file that contains important information about the NI-488.2M software and a description of any new features. Before you use the software, read this file for the most recent information. •...
  • Page 21: Dos And 16-Bit Windows Support Files

    • gpibinfo.exe is a utility you can use to obtain information about your GPIB hardware and software, such as the version of the NI-488.2M software and the type of interface board you are using. DOS and 16-bit Windows Support Files •...
  • Page 22: How The Ni-488.2M Software Works With Windows Nt

    Chapter 1 How the NI-488.2M Software Works with Windows NT The main components of the NI-488.2M software are a dynamic link library that runs in user mode and a layered NT device driver that runs in kernel mode. The layered NT...
  • Page 23: Unloading And Reloading The Ni-488.2M Driver

    Double-click on the ibconf icon to start it. The main ibconf window has an Unload button and a Restart button. If you click on the Unload button, the NI-488.2M driver is unloaded. If you click on the Restart button, the NI-488.2M driver is automatically unloaded and then reloaded.
  • Page 24: Application Examples

    Use this chapter along with your NI-488.2M software, which includes the C source code for each of the nine examples. The programs are listed in order of increasing complexity.
  • Page 25: Example 1: Basic Communication

    A technician needs to monitor voltage readings using a GPIB multimeter. His computer is equipped with an IEEE 488.2 interface board. The NI-488.2M software is installed, and a GPIB cable runs from the computer to the GPIB port on the multimeter.
  • Page 26 "VOLTS DC;AUTO" to Take Voltages ibwrt Tell Multimeter to "VOLTS?" Take Measurement ibrd Read "+ 5 volts" Measurement from Multimeter Finished Getting Measurements? CLEAN UP Figure 2-1. Program Flowchart for Example 1 © National Instruments Corp. NI-488.2M UM for Windows NT...
  • Page 27: Example 2: Clearing And Triggering Devices

    This example illustrates how you can clear and trigger GPIB devices. Two freshman physics lab partners are learning how to use a GPIB digital oscilloscope. They have successfully loaded the NI-488.2M software on a personal computer and connected their GPIB board to a GPIB digital oscilloscope. Their current lab assignment is to write a small application to practice using the oscilloscope and its command set using high-level GPIB commands.
  • Page 28 Trigger Oscilloscope to Command Get Reading ibwrt Request Data from "CURV?" Oscilloscope ibrd Read Data from Data Oscilloscope Display Waveform Finished Reading? CLEAN UP Figure 2-2. Program Flowchart for Example 2 © National Instruments Corp. NI-488.2M UM for Windows NT...
  • Page 29: Example 3: Asynchronous I/O

    The entire operation is computer-controlled. The CAT scan machine sends the images it acquires to a computer that has the NI-488.2M software installed and is connected to a GPIB color printer. The biologist is familiar with the command set of her color printer, as described in the user manual provided by the manufacturer.
  • Page 30 Print Image Print Image Asynchronously Non-GPIB Activity: Save to Disk ibwait Is GPIB Printing Non-GPIB Activity: Done? Compute Statistics More Images? CLEAN UP Figure 2-3. Program Flowchart for Example 3 © National Instruments Corp. NI-488.2M UM for Windows NT...
  • Page 31: Example 4: End-Of-String Mode

    The application starts the scan by writing the scan command to the scanner. The application reads the scan data into the computer. As a cleanup step before exiting, the application returns the interface board to its original state by taking it offline. NI-488.2M UM for Windows NT © National Instruments Corp.
  • Page 32 "RES:3 \ r \ n" Resolution ibrd Read Status "OK" ibwrt Start Scan "scan \ r \ n" ibrd Read Scanned Data Data CLEAN UP Figure 2-4. Program Flowchart for Example 4 © National Instruments Corp. NI-488.2M UM for Windows NT...
  • Page 33: Example 5: Service Requests

    IEEE 488.2 interface board installed in her computer. She has installed the NI-488.2M software on the host computer and is familiar with the programming instructions for the film recorder, as described in the user manual provided by the manufacturer.
  • Page 34 Steps 6 through 9 are repeated as long as film is in the camera and more images need to be recorded. 10. As a cleanup step before exiting, the application returns the interface board to its original state by taking it offline. © National Instruments Corp. 2-11 NI-488.2M UM for Windows NT...
  • Page 35 Did You Request Request Service Service ? ibrsp Read Response from Response the Film Recorder Finished Loading Film? Exit Application and Repair Film Recorder (continues) Figure 2-5. Program Flowchart for Example 5 NI-488.2M UM for Windows NT 2-12 © National Instruments Corp.
  • Page 36: Figure 2-5. Program Flowchart For Example 5

    Wait for Film Recorder to Did You Request Request Service? Service ibrsp Read Response From Response Film Recorder Reached End of Film? CLEAN UP Figure 2-5. Program Flowchart for Example 5 (Continued) © National Instruments Corp. 2-13 NI-488.2M UM for Windows NT...
  • Page 37: Example 6: Basic Communication With Ieee 488.2-Compliant Devices

    The application reads the identification information returned by each of the devices as it responds to the query in Step 3. As a cleanup step before exiting, the application returns the interface board to its original state by taking it offline. NI-488.2M UM for Windows NT 2-14 © National Instruments Corp.
  • Page 38: Figure 2-6. Program Flowchart For Example 6

    "MUTT 10426" from Device 2 Send Tell Device 3 "*IDN?" to Identify Itself Receive Read "MUTT 10528" Response from Device 3 CLEAN UP Figure 2-6. Program Flowchart for Example 6 © National Instruments Corp. 2-15 NI-488.2M UM for Windows NT...
  • Page 39: Example 7: Serial Polls Using Ni-488.2 Routines

    The GPIB strain gauges are connected to a computer with an IEEE 488.2 interface board and the NI-488.2M software installed. The process is controlled by an application that uses NI-488.2 routines to communicate with the IEEE 488.2-compliant strain gauges.
  • Page 40 Gauge Does the Gauge Need Service? Provide Whatever Service is Mixture is Ready. Required Display "Remove Mixture" Message Done for Day? CLEAN UP Figure 2-7. Program Flowchart for Example 7 © National Instruments Corp. 2-17 NI-488.2M UM for Windows NT...
  • Page 41: Example 8: Parallel Polls

    The three monitoring units are connected to the IEEE 488.2 interface board of a computer that has the NI-488.2M software installed. An application using NI-488.2 routines operates the three monitoring units. The application will obtain information from the multiple units by conducting a parallel poll, and will then determine when to pour the metals into the mixture tank.
  • Page 42 Non-GPIB Activity PPoll Parallel Poll Are All Metals Ready? SendList "MIX ON" Start Power Supplies PPollUnconfig PPoll Parallel Poll Unconfigure Disable CLEAN UP Figure 2-8. Program Flowchart for Example 8 © National Instruments Corp. 2-19 NI-488.2M UM for Windows NT...
  • Page 43: Example 9: Non-Controller Example

    Chapter 2 Example 9: Non-Controller Example This example illustrates how you can use the NI-488.2M software to emulate a GPIB device that is not the GPIB Controller. A software engineer has written firmware to emulate a GPIB device for a research project and is testing it using an application that makes simple GPIB calls.
  • Page 44 Is This the Internal Clear Event? State Is This the Talk Addressed Event? ibwrt Write Out Data New Data ibrd Read In Data New Data Figure 2-9. Program Flowchart for Example 9 © National Instruments Corp. 2-21 NI-488.2M UM for Windows NT...
  • Page 45: Developing Your Application

    NI-488.2 routines. Choosing How to Access the NI-488.2M DLL Applications can access the NI-488.2M dynamic link library ( gpib-32.dll) either by using an NI-488.2M language interface or with direct access. If you need to access the gpib-32.dll from a language other than C, you must directly access the gpib-32.dll.
  • Page 46: Using Ni-488 Functions: One Device For Each Board

    • Communicating with non-compliant (non-IEEE 488.2) devices • Altering various low-level board configurations • Managing the bus in non-typical ways NI-488.2M UM for Windows NT © National Instruments Corp.
  • Page 47: Using Ni-488.2 Routines: Multiple Boards And/Or Multiple Devices

    You simply substitute the board index as the first parameter of the board function call. With this flexibility, you can handle non-standard or unusual situations that you cannot resolve using NI-488.2M routines only. Using NI-488.2 Routines: Multiple Boards and/or Multiple Devices When your system includes a board that must access multiple devices, use the NI-488.2...
  • Page 48: Table 3-1. Status Word (Ibsta) Layout

    A DCAC, DTAS, or IFC event has occurred CMPL dev, brd I/O completed Lockout State Remote State Controller-In-Charge Attention is asserted TACS Talker LACS Listener DTAS Device Trigger State DCAS Device Clear State NI-488.2M UM for Windows NT © National Instruments Corp.
  • Page 49: Error Variable - Iberr

    (ud, rdbuf, 20L); if (!(ibsta & ERR)){ rdbuf[ibcntl] = '\0'; printf ("Read: %s\n", rdbuf); else { error(); © National Instruments Corp. NI-488.2M UM for Windows NT...
  • Page 50: Using Ibic To Communicate With Devices

    NI-488 example. In this manual the example code is presented in C using the standard C language interface. The NI-488.2M software includes the source code for this example written in C (devsamp.c) and the source code for this example written to use direct entry to access the gpib-32.dll (dlldev.c ).
  • Page 51: Ni-488 Program Shell

    (ibrd) • Clear Device (ibclr) (ibrsp) • Serial Poll Device and so on Finished GPIB Programming? Close Device (ibonl) Closed All Devices? Figure 3-1. General Program Shell Using NI-488 Device Functions © National Instruments Corp. NI-488.2M UM for Windows NT...
  • Page 52: General Program Steps And Examples

    Step 2. Clear the Device Clear the device before you configure the device for your application. Clearing the device resets its internal functions to a default state. ibclr(ud); if (ibsta & ERR) { gpiberr("ibclr error"); NI-488.2M UM for Windows NT © National Instruments Corp.
  • Page 53: Step 3. Configure The Device

    Notice that the ibwait function also returns when the I/O timeout value is exceeded. printf("Waiting for RQS...\n"); ibwait (ud, TIMO|RQS); if (ibsta & (ERR|TIMO)) gpiberr("ibwait error"); © National Instruments Corp. NI-488.2M UM for Windows NT...
  • Page 54: Step 6. Read The Measurement

    10 readings is %f\n", sum/10.0); Step 8. Place the Device Offline As a final step, take the device offline using the ibonl function. ibonl (ud, 0); NI-488.2M UM for Windows NT 3-10 © National Instruments Corp.
  • Page 55: Writing Your Ni-488.2 Application

    NI-488.2 routines, general program steps, and an NI-488.2 example. In this manual the example code is presented in C using the standard C language interface. The NI-488.2M software includes the source code for this example written in C (samp4882.c) and the code for this example written to use direct entry to access the gpib-32.dll...
  • Page 56: Ni-488.2 Program Shell

    • Receive Data from Addressed Talker (ReadStatusByte) (RcvRespMsg) and so on and so on Finished GPIB Programming? Close Board (ibonl) Are All Boards Closed? Figure 3-2. General Program Shell Using NI-488.2 Routines NI-488.2M UM for Windows NT 3-12 © National Instruments Corp.
  • Page 57: General Program Steps And Examples

    IEEE 488.2-compatible and can accept the identification query, *IDN?. In addition, assume that FindLstn found the GPIB interface board at primary address 0 (default) and, therefore, you can skip the first entry in the result array. © National Instruments Corp. 3-13 NI-488.2M UM for Windows NT...
  • Page 58: Step 4. Initialize The Instrument

    Send(0, fluke, "*RST", 4L, NLend); (ibsta & ERR) { gpiberr("Send *RST error"); sum = 0.0; for(m =0; m<10; m++){ /* start of loop for Steps 5 through 8 */ NI-488.2M UM for Windows NT 3-14 © National Instruments Corp.
  • Page 59: Step 5. Configure The Instrument

    The first argument in WaitSRQ is the GPIB board number. The second argument is a flag returned by WaitSRQ that indicates whether or not SRQ is asserted. WaitSRQ(0, &SRQasserted); if (!SRQasserted) { gpiberr("WaitSRQ error"); © National Instruments Corp. 3-15 NI-488.2M UM for Windows NT...
  • Page 60: Step 8. Read The Measurement

    Repeat Steps 5 through 8 in a loop until 10 measurements have been read. Then print the average of the readings as shown: printf ("The average of the 10 readings is : %f\n", sum/10); NI-488.2M UM for Windows NT 3-16 © National Instruments Corp.
  • Page 61: Step 10. Place The Board Offline

    Direct Entry with C Before you compile your Win32 C application, make sure that the following lines are included at the beginning of your application: #ifdef __cplusplus extern "C"{ #endif #include "decl-32.h" © National Instruments Corp. 3-17 NI-488.2M UM for Windows NT...
  • Page 62 The prototypes for each function that gpib-32.dll exports can be found in the NI-488.2M Function Reference Manual for Windows NT . The NI-488.2M direct entry sample programs illustrate how to use direct entry to access gpib-32.dll. Use the LoadLibrary and GetProcAddress functions to load the gpib-32.dll and get...
  • Page 63: Microsoft Visual C/C

    Start menu. Enter the name of the compiled program in the dialog box that appears. To run your application from a DOS shell, type the name of your compiled program on the DOS command line. © National Instruments Corp. 3-19 NI-488.2M UM for Windows NT...
  • Page 64: Running Existing Dos And Windows Gpib Applications

    To run 16-bit Windows GPIB applications, the system uses the special GPIB dynamic link library, gpib.dll. When you install the NI-488.2M software, gpib.dll is copied into the <winnt> \system32 directory, where <winnt> is your Windows NT directory, for example c:\windows).
  • Page 65: Debugging Your Application

    If the software is not properly installed or if there is a conflict between the GPIB hardware and the other hardware in the system, the NI-488.2M driver fails to start. Two Windows NT utilities are useful in determining the source of the problem: the Devices applet in the Control Panel in the Main group, and the Event Viewer in the Administrative Tools group.
  • Page 66: Examining The Nt System Log Using The Event Viewer

    Examining the NT System Log Using the Event Viewer Windows NT maintains a system log. If the NI-488.2M driver is unable to start, it records entries in the system log explaining why it failed to start. You can examine the system log by running the Event Viewer utility in the Administrative Tools window of the Program Manager .
  • Page 67: Running Gpibinfo

    This information helps you determine the capabilities of your NI-488.2M software and is also helpful if you need to call National Instruments for technical support. Run GPIBInfo with no parameters. The program displays software information such as...
  • Page 68: Debugging With Ibic

    Asynchronous I/O in progress ECAP No capability for operation EFSO File system error EBUS GPIB bus error ESTB Serial poll status byte queue overflow ESRQ SRQ stuck in ON position ETAB Table problem NI-488.2M UM for Windows NT © National Instruments Corp.
  • Page 69: Configuration Errors

    IEEE 488.2 standard should remain in their current state until specific commands are sent across the GPIB to change their state. You might need to configure your NI-488.2M driver to perform repeat addressing if your device does not remain in its currently ©...
  • Page 70: Termination Method

    You should be aware of the data termination method that your device uses. By default, your NI-488.2M software is configured to send EOI on writes and terminate reads on EOI or a specific byte count. If you send a command string to your device and it does not respond, it might be because it does not recognize the end of the command.
  • Page 71 Run the GPIBInfo utility. It returns information about the GPIB boards currently configured for use in your system. How can I determine which version of the NI-488.2M software I have installed? Run the GPIBInfo utility. It provides information about the version of the NI-488.2M software currently installed.
  • Page 72: Ibic-Interface Bus Interactive Control Utility

    This section shows how you might use ibic to test a sequence of NI-488 device function calls. You do not need to remember the parameters that each function takes. If you enter the function name only, ibic prompts you for the necessary parameters. © National Instruments Corp. NI-488.2M UM for Windows NT...
  • Page 73 Then enter the command ibic. Your screen should appear as follows: National Instruments IEEE 488 Interface Bus Interactive Control Program (IBIC) Copyright 1993 National Instruments Corp. Version 3.0 (Win32) Version Date: May 28 1993 Version Time: 09:42:25 All rights reserved Type ‘help’...
  • Page 74 TIMO RQS [0900] (rqs cmpl) Read the serial poll status byte. This serial poll status byte varies depending on the device used. ud0: ibrsp [0100] (cmpl) Poll: 0x40 (decimal : 64) © National Instruments Corp. NI-488.2M UM for Windows NT...
  • Page 75: Ibic Syntax

    Hexadecimal numbers –You must precede hex numbers by zero and x (for example, 0xD). Octal numbers–You must precede octal numbers by zero only (for example, 015). Decimal numbers –Enter the number only. NI-488.2M UM for Windows NT © National Instruments Corp.
  • Page 76: String Syntax

    For more information about the function parameters, use the ibic help feature or refer to the NI-488.2M Function Reference Manual for Windows NT . © National Instruments Corp.
  • Page 77: Table 5-1. Syntax For Device-Level Ni-488 Functions In Ibic

    Wait for selected event where mask is a hex, octal, or decimal integer or a mask bit mnemonic ibwrt string Write data ibwrta string Write data asynchronously ibwrtf flname Write data from a file where flname is pathname of file to write NI-488.2M UM for Windows NT © National Instruments Corp.
  • Page 78: Table 5-2. Syntax For Board-Level Ni-488 Functions In Ibic

    Wait for selected event where mask is a hex, octal, or decimal integer or a mask bit mnemonic ibwrt string Write data ibwrta string Write data asynchronously ibwrtf flname Write data from a file where flname is pathname of file to write © National Instruments Corp. NI-488.2M UM for Windows NT...
  • Page 79: Ibic Syntax For Ni-488.2 Routines

    For more information about the routine parameters, use the ibic help feature or refer to the NI-488.2M Function Reference Manual for Windows NT.
  • Page 80: Status Word

    1 ud0: In this example, the addressing command bytes could not be transmitted to the device. This indicates that either dev1 is powered off, or the GPIB cable is disconnected. © National Instruments Corp. NI-488.2M UM for Windows NT...
  • Page 81: Count

    EARG and ibic displays the index of the invalid address as the count. The count has a different meaning depending on which NI-488 function or NI -488.2 routine is called. Refer to the function descriptions in the NI-488.2M Function Reference Manual for Windows NT for the correct interpretation of the count return.
  • Page 82 In this case, run ibconf to verify that the base address of the board is set correctly and that the Use This GPIB Interface field is set to yes . © National Instruments Corp. 5-11 NI-488.2M UM for Windows NT...
  • Page 83: Ibwrt

    4e 44 43 56 28 30 30 30 N D C V 9 0 0 0 2e 30 30 34 37 45 2b 30 . 0 0 4 7 E + 0 0d 0a NI-488.2M UM for Windows NT 5-12 © National Instruments Corp.
  • Page 84: Common Ni-488.2 Routines In Ibic

    The ibic program also displays the status word and the count of transferred bytes. 488.2 (0): Receive 5 10 STOPend [2124] (end cmpl cic lacs) count: 5 48 65 6c 6c 6f Hello © National Instruments Corp. 5-13 NI-488.2M UM for Windows NT...
  • Page 85: Auxiliary Functions

    The following example shows how to enter 488.2 mode. The 488.2 (0) prompt indicates that you are in NI-488.2 mode on board 0. : set 488.2 0 488.2 (0): NI-488.2M UM for Windows NT 5-14 © National Instruments Corp.
  • Page 86: Help (Display Help Information)

    8 [2100] (end cmpl) count: 8 61 62 63 64 65 66 67 68 a b c d e f g h ud0: - ud0: ibrd 8 © National Instruments Corp. 5-15 NI-488.2M UM for Windows NT...
  • Page 87: N* (Repeat Function N Times)

    The following example repeats the operation three times. gpib0: 3*$ userfile The display mode that is in effect before this function was executed can be changed by functions in the indirect file. NI-488.2M UM for Windows NT 5-16 © National Instruments Corp.
  • Page 88: Print (Display The Ascii String)

    : print "and\r\n\x67\x6f\x6f\x64\x62\x79\x65" goodbye You can also use print to display comments from indirect files. The print string appears even if the display is suppressed with the - function. © National Instruments Corp. 5-17 NI-488.2M UM for Windows NT...
  • Page 89: Gpib Programming Techniques

    GPIB data transfers are terminated either when the GPIB EOI line is asserted with the last byte of a transfer or when a preconfigured end-of-string (EOS) character is transmitted. By default, the NI-488.2M driver asserts EOI with the last byte of writes and the EOS modes are disabled.
  • Page 90: High-Speed Data Transfers (Hs488)

    IbcEndBitIsNormal option to configure the software to report only the END bit in ibsta when the GPIB EOI line is asserted. By default, the NI-488.2M driver reports END in ibsta when either the EOS byte is read in or the EOI line is asserted during a read.
  • Page 91: System Configuration Effects On Hs488

    (option IbaHSCableLength) in your application program. For CFE and CFGn messages, refer to Appendix A, Multiline Interface Messages, in the NI-488.2M Function Reference Manual for Windows NT.
  • Page 92: Talker/Listener Applications

    The interface board returns a response byte of hex 42. The current CIC passes control to the GPIB board. If the current CIC does not pass control, the NI-488.2M driver returns the ECIC error code to your application. This error can occur if the current CIC does not understand the CIC Protocol.
  • Page 93: Requesting Service

    Bit 5, the Event Status bit (ESB), is set if one or more of the enabled IEEE 488.2 events occurs. These events include power-on, user © National Instruments Corp. NI-488.2M UM for Windows NT...
  • Page 94: Automatic Serial Polling

    RQS is made. When ibwait is issued, the stuck SRQ state is terminated and the driver attempts a new set of serial polls. NI-488.2M UM for Windows NT © National Instruments Corp.
  • Page 95: Autopolling And Interrupts

    In this case, an automatic serial poll can occur even when your application is not making any calls to the NI-488.2M software. Autopolling can also occur when a device-level ibwait for RQS is in progress. Autopolling is not allowed whenever an application calls a board-level NI-488 function or any NI-488.2 routine, or the stuck SRQ...
  • Page 96: Srq And Serial Polling With Ni-488.2 Routines

    Chapter 6 SRQ and Serial Polling with NI-488.2 Routines The NI-488.2M software includes a set of NI-488.2 routines that you can use to conduct SRQ servicing and serial polling. Routines pertinent to SRQ servicing and serial polling are AllSpoll, FindRQS , ReadStatusByte, TestSRQ , and WaitSRQ .
  • Page 97: Example 1: Using Findrqs

    AllSpoll ( 0, AddrList, ResponseList ); if (!(ibsta & ERR)) for ( i = 0; AddrList[i] != NOADDR; i++ ) printf ("Device at pad %x returned byte %x.\n", AddrList[i], ResponseList[i] ); return; © National Instruments Corp. NI-488.2M UM for Windows NT...
  • Page 98: Parallel Polling

    For example, DIO3 has a binary bit pattern of 010. The following example code configures a device for parallel polling using NI-488 functions. The device asserts DIO7 if its ist = 0. NI-488.2M UM for Windows NT 6-10 © National Instruments Corp.
  • Page 99: Parallel Polling With Ni-488.2 Routines

    Configure the device for parallel polling using the PPollConfig routine, unless the device can configure itself for parallel polling. The following example configures a device at address 3 to assert data line 5 (DIO5) when its ist value is 1. © National Instruments Corp. 6-11 NI-488.2M UM for Windows NT...
  • Page 100 If NOADDR is the only value in the array, all devices receive the parallel poll disable message. AddressList[0] = 3; AddressList[1] = NOADDR; PPollUnconfig(0, AddressList); NI-488.2M UM for Windows NT 6-12 © National Instruments Corp.
  • Page 101: Ibconf-Interface Bus Configuration Utility

    If your application program uses ibconfig whenever it needs to modify a configuration option, it is able to run on any computer with the appropriate NI-488.2M software, regardless of the configuration of that computer.
  • Page 102: Board Configuration

    GPIB-related applications and click Restart again, or to shut down and restart your computer. If you need to unload the NI-488.2M software and prevent it from reloading when you restart your computer, click the Unload button. If ibconf cannot unload the NI-488.2M software, it instructs you either to exit all GPIB-related applications, or to...
  • Page 103: Use This Board

    Use this Board Use this item to disable an interface board. If this item is not selected, the NI-488.2M software ignores the board. By default, gpib0 is enabled and gpib1, gpib2, and gpib3 are disabled. © National Instruments Corp.
  • Page 104: Bus Timing

    When you change the position of the switches, ibconf updates the number displayed in the Base I/O Address field. Set the switch in ibconf to look like the switch on your board. NI-488.2M UM for Windows NT © National Instruments Corp.
  • Page 105: Interrupt Level

    DMA channel of your board, refer to the getting started manual that came with your GPIB interface board. Use Demand Use this item to select the DMA transfer mode that the NI-488.2M Mode DMA software uses. When this item is selected, the NI-488.2M software uses demand mode for DMA transfers.
  • Page 106: Figure 7-3. Expanded Board Configuration For An At-Gpib Board

    GPIB Primary All GPIB boards must be assigned a unique primary address. This Address address, a number in the range 0 to 30 decimal, is used by the NI-488.2M software to compute the talk and listen addresses of the board. The default primary address of all interface boards is zero. GPIB...
  • Page 107: Set Eoi With Eos On Write

    EOS byte for a match. When this item is selected, the NI-488.2M software uses all eight bits of the EOS byte when checking for a match. By default this option is not selected.
  • Page 108: Enable Cic Protocol

    (for example, ibfind ("dev1") ) instead of using the preferred function ibdev. In some cases, you might need to change the actual name of the device template. NI-488.2M UM for Windows NT © National Instruments Corp.
  • Page 109: Name

    GPIB EOI line whenever it sends the EOS byte. By default this option is not selected. 8-bit EOS When the NI-488.2M software is configured to use the EOS byte, it can Compare test either seven or eight bits of the EOS byte for a match. When this item is selected, the NI-488.2M software uses all eight bits of the EOS...
  • Page 110: Eos Byte

    The default timeout period is 10 s. Serial Poll Use t his option to select the length of time the NI-488.2M software Timeout waits for a serial poll response from the device. The IEEE 488 standard does not specify the length of time a Controller should wait for the response byte.
  • Page 111: Appendix A Status Word Conditions

    A DCAC, DTAS, or IFC event has occurred CMPL dev, brd I/O completed Lockout State Remote State Controller-In-Charge Attention is asserted TACS Talker LACS Listener DTAS Device Trigger State DCAS Device Clear State © National Instruments Corp. NI-488.2M UM for Windows NT...
  • Page 112 CIC, the GPIB SRQ line is asserted, and the automatic serial poll capability is disabled. SRQI is cleared either when the GPIB board ceases to be the CIC or when the GPIB SRQ line is unasserted. NI-488.2M UM for Windows NT © National Instruments Corp.
  • Page 113 GPIB board detects that the Local Lockout (LLO) message has been sent either by the GPIB board or by another Controller. LOK is cleared when the System Controller unasserts the Remote Enable (REN) GPIB line. © National Instruments Corp. NI-488.2M UM for Windows NT...
  • Page 114 GPIB board shadow handshakes as a result of the ibgts function. LACS is cleared whenever the GPIB board detects the Unlisten (UNL) command, its own talk address, Interface Clear (IFC), or that the ibgts function has been called without shadow handshake. NI-488.2M UM for Windows NT © National Instruments Corp.
  • Page 115 DCAS bit was set in the ibwait mask parameter. It also clears on any call immediately following a read or write. © National Instruments Corp. NI-488.2M UM for Windows NT...
  • Page 116: Table B-1. Gpib Error Codes

    2, File Not Found. This error occurs when you try to access a board or device that is not installed or configured properly. EDVR is also returned if an invalid unit descriptor is passed to any NI-488 function call. © National Instruments Corp. NI-488.2M UM for Windows NT...
  • Page 117: Error Codes And Solutions

    This Board field is selected. • If the NI-488.2M driver is installed and configured, but you continue to receive the error EDVR, use the Windows NT Event Viewer to find a solution. The driver maintains a log of errors in this utility and posts possible corrections to any problems that occur while loading.
  • Page 118 Make sure that the GPIB board is addressed correctly before calling ibrd, ibwrt, RcvRespMsg, or SendDataBytes. • Avoid calling ibgts except immediately after an ibcmd call. (ibcmd causes ATN to be asserted.) © National Instruments Corp. NI-488.2M UM for Windows NT...
  • Page 119 EABO indicates that an I/O operation has been canceled, usually due to a timeout condition. Other causes are calling ibstop or receiving the Device Clear message from the CIC while performing an I/O operation. NI-488.2M UM for Windows NT © National Instruments Corp.
  • Page 120 If a call might interfere with the I/O operation in progress, the driver returns EOIP. Solutions Resynchronize the driver and the application before making any further GPIB calls. Resynchronization is accomplished by using one of the following three functions: © National Instruments Corp. NI-488.2M UM for Windows NT...
  • Page 121 Devices are expected to accept these command bytes within the time limit specified by the default configuration or the ibtmo function. EBUS results if a timeout occurred while sending these command bytes. NI-488.2M UM for Windows NT © National Instruments Corp.
  • Page 122 GPIB operations, except that you cannot depend on the RQS bit while the condition lasts. Solutions Check to see if other devices not used by your application are asserting SRQ. Disconnect them from the GPIB if necessary. © National Instruments Corp. NI-488.2M UM for Windows NT...
  • Page 123 SRQ. Disconnect them from the GPIB if necessary. In the case of ETAB returned from ibevent , call ibevent more often to empty the queue. NI-488.2M UM for Windows NT © National Instruments Corp.
  • Page 124: Customer Communication

    Filling out a copy of the Technical Support Form before contacting National Instruments helps us help you better and faster. National Instruments provides comprehensive technical assistance around the world. In the U.S.
  • Page 125 Instruments for technical support helps our applications engineers answer your questions more efficiently. If you are using any National Instruments hardware or software products related to this problem, include the configuration forms from their user manuals. Include additional pages if necessary.
  • Page 126 National Instruments software product Version Configuration The problem is List any error messages The following steps will reproduce the problem...
  • Page 127 Documentation Comment Form National Instruments encourages you to comment on the documentation supplied with our products. This information helps us provide quality products to meet your needs. ™ Title: NI-488.2M User Manual for Windows NT Edition Date: January 1996 Part Number: 320646B-01 Please comment on the completeness, clarity, and organization of the manual.
  • Page 128 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 Austin, TX 78730-5039 Fax to: Technical Publications National Instruments Corporation (512) 794-5678...
  • Page 129: Glossary

    An action or event that occurs at an unpredictable time with respect to the execution of a program. automatic serial polling A feature of the NI-488.2M software in which serial polls (autopolling) are executed automatically by the driver whenever a device asserts the GPIB SRQ line.
  • Page 130 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. NI-488.2M UM for Windows NT Glossary-2 © National Instruments Corp.
  • Page 131 (MSA). The GPIB board has both a GPIB address and an I/O address. GPIB board Refers to the National Instruments family of GPIB interface boards. Go To Local is the GPIB command used to place an addressed (Go To Local) Listener in local (front panel) control mode.
  • Page 132 Hertz. After each NI-488 I/O function, this global variable contains ibcnt the actual number of bytes transmitted. The NI-488.2M driver configuration program. ibconf A global variable that contains the specific error code iberr associated with a function call that failed.
  • Page 133 A GPIB command used to address a device to be a Talker. It (My Talk Address) can be any one of the 31 primary addresses. multitasking The concurrent processing of more than one program or task. © National Instruments Corp. Glossary-5 NI-488.2M UM for Windows NT...
  • Page 134 Low-speed data transfer between the GPIB board and memory in which the CPU moves each data byte according to program instructions. See DMA. Random-access memory. resynchronize The NI-488.2M software and the user application must resynchronize after asynchronous I/O operations have completed. Request Service. NI-488.2M UM for Windows NT Glossary-6 ©...
  • Page 135 The IEEE 488.2-defined data byte sent by a device when it is serially polled. status word See ibsta. synchronous Refers to the relationship between the NI-488.2M driver functions and a process when executing driver functions is predictable; the process is blocked until the driver completes the function. System Controller...
  • Page 136 The GPIB command used to pass control of the bus from the (Take Control) current Controller to an addressed Talker. timeout A feature of the NI-488.2M driver that prevents I/O functions from hanging indefinitely when there is a problem on the GPIB. An integrated circuit that implements most of the GPIB Talker, Listener, and Controller functions in hardware.
  • Page 137: Index

    3-7 general steps and examples, 3-8 to 3-10 items to include, 3-6 opening devices, 3-8 placing device offline, 3-10 processing of data, 3-10 program shell (illustration), 3-7 reading measurement, 3-10 © National Instruments Corp. Index-1 NI-488.2M UM for Windows NT...
  • Page 138 - (turn display off), 5-15 to 5-16 Help (display help information), 5-15 n* (repeat function n times), 5-16 print (display the ASCII string), 5-16 Set (udname or 488.2), 5-14 to 5-15 table of functions, 5-14 NI-488.2M UM for Windows NT Index-2 © National Instruments Corp.
  • Page 139 Bus Timing option, ibconf utility, 7-4 C language compiling, linking, and running applications, 3-17 to 3-19 direct entry, 3-17 to 3-19 files available with NI-488.2M software, 1-7 cables checking with ibtest, 4-2 setting cable length for high-speed data transfers, 7-4 CIC.
  • Page 140 4-5 to 4-6 repeat addressing, 4-5 to 4-6 termination method, 4-6 configuration errors, 4-5 examining NT devices to verify NI-488.2M installation, 4-1 to 4-2 global status variables, 4-3 GPIB error codes (table), 4-4, B-1 GPIBInfo utility, 4-3 ibic utility, 4-4...
  • Page 141 DOS GPIB applications, 3-20 DOS support files, 1-7 drivers configuring, 4-5 driver and driver utilities for NI-488.2M software, 1-6 to 1-7 testing with ibtest, 4-1 to 4-2 DTAS status word condition bit position, hex value, and type (table), 3-4 description, A-5...
  • Page 142 Send EOI at end of Write option, 7-7, 7-9 Set EOI with EOS on Write option, 7-7, 7-9 purpose (table), 1-3 termination of data transfers, 6-1 to 6-2 EOIP error code definition (table), 4-4 description, B-5 to B-6 NI-488.2M UM for Windows NT Index-6 © National Instruments Corp.
  • Page 143 4-5 error variable - iberr, 3-5 ESAC error code definition (table), 4-4 description, B-4 ESRQ error code definition (table), 4-4 description, B-7 ESTB error code definition (table), 4-4 description, B-7 © National Instruments Corp. Index-7 NI-488.2M UM for Windows NT...
  • Page 144 1-1 overview, 1-1 sending messages across, 1-2 to 1-3 data lines, 1-2 handshake lines, 1-3 interface management lines, 1-3 Talkers, Listeners, and Controllers, 1-1 gpib-32.dll file, 1-6 gpib-32.obj file, 1-7 NI-488.2M UM for Windows NT Index-8 © National Instruments Corp.
  • Page 145 Controller, 6-4 termination of data transfers, 6-1 to 6-2 waiting for GPIB conditions, 6-3 gpib-vdd.dll file, 1-7 gpibclsd.sys file, 1-6 gpib.dll file, 1-7. See also NI-488.2M DLL. GPIBInfo utility, 1-7, 4-3 gpibxxxx.sys file, 1-6 © National Instruments Corp. Index-9...
  • Page 146 Help button, 7-4 I/O Timeout option, 7-7, 7-10 Interrupt Level option, 7-5 main dialog box (illustration), 7-2 Name option, 7-9 OK button, 7-4 options for all boards, 7-3 to 7-4 overview, 7-1 NI-488.2M UM for Windows NT Index-10 © National Instruments Corp.
  • Page 147 Software button, 7-4 starting, 7-1 to 7-2 System Controller option, 7-7 Terminate Read On EOS option, 7-6, 7-9 unloading and restarting NI-488.2M driver, 1-9, 7-2 Use Demand Mode DMA option, 7-5 Use this Board option, 7-3 ibconf.cpl file, 1-7 ibconf.hlp file, 1-7...
  • Page 148 See status word - ibsta. ibtest utility, 1-7 cable connections, 4-2 NT devices, examining, 4-1 to 4-2 presence of driver, 4-1 to 4-2 ibtrg function triggering devices, 3-9 using in ibic (example), 5-3 NI-488.2M UM for Windows NT Index-12 © National Instruments Corp.
  • Page 149 Message Available (MAV) bit, 6-5 to 6-6 messages, sending across GPIB, 1-2 to 1-3 data lines, 1-2 handshake lines, 1-3 interface management lines, 1-3 Microsoft Visual C++, See C Language. © National Instruments Corp. Index-13 NI-488.2M UM for Windows NT...
  • Page 150 3-14 items to include, 3-11 placing board offline, 3-17 processing of data, 3-16 program shell (illustration), 3-12 reading measurement, 3-16 triggering instruments, 3-15 waiting for measurement, 3-15 to 3-16 NI-488.2M UM for Windows NT Index-14 © National Instruments Corp.
  • Page 151 SendList, 5-13 NI-488.2M DLL choosing how to access, 3-1 requirements for direct access, 3-1 NI-488.2M software, 1-6 to 1-9. See also application development; NI-488 functions; NI-488.2 routines. C language files, 1-7 DOS and 16-bit Windows support files, 1-7 driver and driver utility files, 1-6 to 1-7 interaction with Windows NT, 1-8 reloading NI-488.2M driver, 1-9...
  • Page 152 1-6, 1-7 ReadStatusByte routine, 6-8 Receive routine reading measurements, 3-16 using in ibic, 5-12 reloading NI-488.2M driver, 1-9, 7-2 REM status word condition bit position, hex value, and type (table), 3-4 description, A-4 REN (remote enable) line Assert REN When SC option, ibconf utility, 7-8...
  • Page 153 DTAS, 6-4 to 6-5, A-5 END, A-2 ERR, A-2 EVENT, A-3 ibic example, 5-9 LACS, 6-4, A-4 LOK, A-3 programming considerations, 3-3 to 3-5 REM, A-4 RQS, A-3 SPOLL, A-3 © National Instruments Corp. Index-17 NI-488.2M UM for Windows NT...
  • Page 154 2-4 to 2-5 troubleshooting. See debugging; ibic utility turn display off (-) function, ibic, 5-15 turn display on (+) function, ibic, 5-15 unloading NI-488.2M driver, 1-9, 7-2 NI-488.2M UM for Windows NT Index-18 © National Instruments Corp.
  • Page 155 3-15 to 3-16 Windows (16-bit) GPIB applications, 3-20 Windows 16-bit support files, 1-7 Windows NT examining NT devices to verify NI-488.2M installation, 4-1 to 4-2 interaction with NI-488.2M software, 1-8 viewing NT system log, 4-2 © National Instruments Corp.

Table of Contents