background image

Chapter 6

Interactive Control Utility

©

 National Instruments Corporation

6-11

NI-488.2 User Manual for Windows

In this example, the addressing command bytes could not be transmitted to 
the device. This indicates that either the GPIB device is powered off or the 
GPIB cable is disconnected. 

For a detailed list of the error codes and their meanings, refer to Chapter 4

Debugging Your Application

.

Count Information

When an I/O function completes, the Interactive Control utility displays the 
actual number of bytes sent or received, regardless of the existence of an 
error condition. 

If one of the addresses in an address list is invalid, then the error is EARG 
and the Interactive Control utility displays the index of the invalid address 
as the count.

The count has a different meaning depending on which NI-488.2 call is 
made. For the correct interpretation of the count return, refer to the function 
descriptions in the NI-488.2 online help. For instructions on accessing the 
online help, refer to th

Using the NI-488.2 Documentation

 section in 

About This Manual

.

Summary of Contents for NI-488.2

Page 1: ...NI 488 2 NI 488 2 User Manual for Windows NI 488 2 User Manual for Windows June 1999 Edition Part Number 321819D 01 ...

Page 2: ...48 14 24 24 Germany 089 741 31 30 Hong Kong 2645 3186 India 91805275406 Israel 03 6120092 Italy 02 413091 Japan 03 5472 2970 Korea 02 596 7456 Mexico D F 5 280 7625 Mexico Monterrey 8 357 7695 Netherlands 0348 433466 Norway 32 27 73 00 Singapore 2265886 Spain Madrid 91 640 0085 Spain Barcelona 93 582 0251 Sweden 08 587 895 00 Switzerland 056 200 51 51 Taiwan 02 2377 1200 United Kingdom 01635 52354...

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

Page 4: ...ed with NI 488 2 2 2 Troubleshoot NI 488 2 Problems 2 4 Add a New GPIB Interface 2 4 Delete a GPIB Interface 2 5 Scan for GPIB Instruments 2 5 Instruments Not Found 2 6 Instruments Enumeration Failed 2 6 Communicate with Your Instrument 2 6 Basic Communication Query Write Read 2 6 Advanced Communication 2 7 View NI 488 2 Software Version 2 8 Monitor Record and Display NI 488 2 Calls 2 8 View or Ch...

Page 5: ...riables 3 5 Status Word ibsta 3 5 Error Variable iberr 3 7 Count Variables ibcnt and ibcntl 3 7 Using Interactive Control to Communicate with Devices 3 7 Programming Models 3 8 Applications That Communicate with a Single GPIB Device 3 8 Items to Include 3 8 General Program Steps and Examples 3 8 Applications That Use Multiple Interfaces or Communicate with Multiple GPIB Devices 3 10 Items to Inclu...

Page 6: ...d 4 5 Other Errors 4 5 Chapter 5 NI Spy Utility Overview 5 1 Starting NI Spy 5 1 Using the NI Spy Online Help 5 2 Locating Errors with NI Spy 5 2 Viewing Properties for Recorded Calls 5 2 Exiting NI Spy 5 3 Performance Considerations 5 3 Chapter 6 Interactive Control Utility Overview 6 1 Getting Started with Interactive Control 6 1 Interactive Control Syntax 6 4 Number Syntax 6 4 String Syntax 6 4...

Page 7: ...ications 7 11 Serial Polling 7 12 Service Requests from IEEE 488 Devices 7 12 Service Requests from IEEE 488 2 Devices 7 12 Automatic Serial Polling 7 13 Stuck SRQ State 7 13 Autopolling and Interrupts 7 14 SRQ and Serial Polling with Device Level Traditional NI 488 2 Calls 7 14 SRQ and Serial Polling with Multi Device NI 488 2 Calls 7 15 Example 1 Using FindRQS 7 16 Example 2 Using AllSpoll 7 16 ...

Page 8: ... 4 Figure 2 4 NI 488 2 Communicator 2 7 Figure 2 5 NI 488 2 Calls Recorded by NI Spy 2 9 Figure 2 6 Properties Dialog Box in Windows 98 95 2 10 Figure 2 7 GPIB Configuration Utility in Windows NT 2 11 Figure 3 1 NI 488 2 Communicator 3 2 Figure 4 1 NI 488 2 Calls Recorded by NI Spy 4 2 Figure 5 1 NI 488 2 Calls Recorded by NI Spy 5 2 Figure 6 1 Instrument Address in Measurement Automation Explorer...

Page 9: ...ve Control 6 7 Table 6 3 Syntax for Multi Device NI 488 2 Calls in Interactive Control 6 8 Table 6 4 Auxiliary Functions in Interactive Control 6 9 Table A 1 GPIB Handshake Lines A 3 Table A 2 GPIB Interface Management Lines A 3 Table B 1 Status Word Layout B 1 Table C 1 GPIB Error Codes C 1 Table D 1 Device Manager Status Codes D 3 ...

Page 10: ...are Guide contains detailed instructions on how to install and configure your GPIB hardware This guide also includes hardware and software specifications and compliance information To view these documents online insert your NI 488 2 for Windows CD When the NI 488 2 Software for Windows screen appears select the View Documentation option The View Documentation Wizard helps you find the documentatio...

Page 11: ... a cross reference or an introduction to a key concept This font also denotes text that is a placeholder for a word or value that you must supply monospace Text in this font denotes text or characters that you should enter from the keyboard sections of code programming examples and syntax examples This font is also used for the proper names of disk drives paths directories programs subprograms sub...

Page 12: ...consisting of a shielded 24 conductor cable with both a plug and receptacle connector at each end With this design you can link devices in a linear configuration a star configuration or a combination of the two configurations Figure 1 1 shows the linear and star configurations Figure 1 1 Linear and Star System Configuration Device A Device B Device C Device D Device A Device C Device B a Linear Co...

Page 13: ... Figure 1 2 Example of Multiboard System Configuration Configuration Requirements To achieve the high data transfer rate that the GPIB was designed for you must limit the number of devices on the bus and the physical distance between devices The following restrictions are typical A maximum separation of 4 m between any two devices and an average separation of 2 m over the entire bus A maximum tota...

Page 14: ...ed on Cable lengths must be as short as possible with up to a maximum of 15 m of cable for each system There must be at least one equivalent device load per meter of cable If you want to exceed these limitations you can use a bus extender to increase the cable length or a bus expander to increase the number of device loads You can order bus extenders and expanders from National Instruments ...

Page 15: ...IB related tasks in Measurement Automation Explorer Establish basic communication with your GPIB instruments Scan for instruments connected to your GPIB interface Launch the NI 488 2 Getting Started Wizard to get started with GPIB instrument communication Launch the NI 488 2 Troubleshooting Wizard to troubleshoot GPIB and NI 488 2 problems Launch NI Spy to monitor NI 488 2 or VISA API calls to GPI...

Page 16: ...surement Automation Explorer Figure 2 1 Measurement Automation Explorer Getting Started with NI 488 2 To get started with GPIB instrument communication using Measurement Automation Explorer complete the following steps 1 Refer to your Getting Started card and install the NI 488 2 software and your GPIB hardware If you do not have a Getting Started card complete the following steps to view your get...

Page 17: ... the NI 488 2 Getting Started Wizard to verify the installation and establish basic communication with your GPIB instruments Note After you install the NI 488 2 software and restart your system the NI 488 2 Getting Started Wizard runs automatically To start it within Measurement Automation Explorer select Measurement Automation in the left window pane and select Help Getting Started NI 488 2 Getti...

Page 18: ...Figure 2 3 Figure 2 3 NI 488 2 Troubleshooting Wizard To view online help for the Troubleshooting Wizard click on the Help button Add a New GPIB Interface To add a new GPIB interface to your system complete the following steps 1 Select Start Programs National Instruments NI 488 2 Explore GPIB to start Measurement Automation Explorer 2 Select the Devices and Interfaces folder 3 In the right window ...

Page 19: ...es and Interfaces directory by clicking on the next to the folder 3 Right click on your GPIB interface and select Delete Interface from the drop down menu that appears 4 When prompted click on the Yes button to confirm the removal of your interface Scan for GPIB Instruments To scan for instruments connected to your GPIB interface or to add a new instrument to your system complete the following ste...

Page 20: ... cannot detect any instruments connected to your GPIB interface Instead you can verify communication with your instruments using the Interactive Control utility To do so select Tools NI 488 2 Utilities Interactive Control For more information about verifying instrument communication type help Interactive Control getting started at the Interactive Control command prompt Communicate with Your Instru...

Page 21: ...municator 6 Type a command in the Send String field and do one of the following To write a command to the instrument then read a response back click on the Query button To write a command to the instrument click on the Write button To read a response from the instrument click on the Read button To view sample C C code that performs a simple query of a GPIB instrument click on the Show Sample butto...

Page 22: ...Programs National Instruments NI 488 2 Explore GPIB to start Measurement Automation Explorer 2 Select Help About Measurement Automation Explorer The Value column in the About Measurement Automation Explorer dialog box displays the version number of the NI 488 2 software Monitor Record and Display NI 488 2 Calls To monitor NI 488 2 calls use NI Spy as follows 1 Select Start Programs National Instru...

Page 23: ... Utility View or Change GPIB Interface Settings To view or change the settings of your GPIB interface refer to one of the following sections Windows 98 95 To view or change your interface settings in Windows 98 95 complete the following steps 1 Select Start Programs National Instruments NI 488 2 Explore GPIB to start Measurement Automation Explorer 2 Expand the Devices and Interfaces directory by ...

Page 24: ... dialog box click on the button in the upper right corner of the dialog box then click on the field 4 Optional Change the settings for your interface Windows 2000 NT To view or change GPIB interface information complete the following steps 1 Select Start Programs National Instruments NI 488 2 Explore GPIB to start Measurement Automation Explorer 2 Expand the Devices and Interfaces directory by cli...

Page 25: ...hanging the settings for your interface click on the Help button View GPIB Instrument Information To view information about your GPIB instruments complete the following steps 1 If you have not already done so scan for connected instruments as described in the Scan for GPIB Instruments section earlier in this chapter 2 Select Start Programs National Instruments NI 488 2 Explore GPIB to start Measur...

Page 26: ...plate refer to one of the following sections Windows 98 95 To reconfigure GPIB device templates in Windows 98 95 complete the following steps 1 Select Start Settings Control Panel 2 Double click on the System icon 3 Select the Device Manager tab and click on the View devices by type button 4 Click on the National Instruments GPIB Interfaces icon 5 Click on the Properties button 6 Select the Device...

Page 27: ...ation 6 Click on the OK button twice to save your changes and exit Enable Disable NI 488 2 DOS Support To enable or disable DOS support for your NI 488 2 application refer to one of the following sections Windows 98 95 To enable or disable NI 488 2 DOS support in Windows 98 95 complete the following steps 1 Make sure that no older version of the NI 488 2 DOS device driver is being loaded from your...

Page 28: ...omment the REM following line REM device path doswin16 gpib nt com where path is the directory in which you installed the NI 488 2 software 3 Remove REM from the last line so that it reads as follows device path doswin16 gpib nt com To disable DOS support add REM back to the line where it was removed Access Additional Help and Resources To access additional help and resources for the NI 488 2 soft...

Page 29: ...Software for Windows 98 95 manual Assign IP Address You can run the Assign IP Address utility in Measurement Automation Explorer as follows 1 Contact your network administrator to determine whether you should use the Assign IP Address utility to assign the IP address manually 2 Select Start Programs National Instruments NI 488 2 Explore GPIB to start Measurement Automation Explorer 3 Expand the De...

Page 30: ...P Settings utility click on the Help button Update GPIB ENET Firmware You can run the Update Firmware utility in Measurement Automation Explorer as follows 1 Select Start Programs National Instruments NI 488 2 Explore GPIB to start Measurement Automation Explorer 2 Expand the Devices and Interfaces directory by clicking on the next to the folder 3 Right click on your GPIB ENET interface and select...

Page 31: ...an for connected instruments as described in the Scan for GPIB Instruments section in Chapter 2 Measurement Automation Explorer 2 Select Start Programs National Instruments NI 488 2 Explore GPIB to start Measurement Automation Explorer 3 Expand the Devices and Interfaces directory by clicking on the next to the folder 4 Select your GPIB interface Measurement Automation Explorer displays the connec...

Page 32: ...ple C C code that performs a simple query of a GPIB instrument click on the Show Sample button Interactive Instrument Control Before you write your NI 488 2 application you might want to use the Interactive Control utility to communicate with your instruments interactively by typing individual commands rather than issuing them from an application You can also use the Interactive Control utility to...

Page 33: ...and prompt For more information refer to Chapter 6 Interactive Control Utility Choosing Your Programming Methodology Based on your development environment you can select a method for accessing the driver and based on your NI 488 2 programming needs you can choose how to use the NI 488 2 API Choosing a Method to Access the NI 488 2 Driver Applications can access the NI 488 2 dynamic link library DL...

Page 34: ...ing needs A typical NI 488 2 application with a single device has three phases Initialization use ibdev to get a handle and use ibclr to clear the device Device Communication use ibwrt ibrd ibtrg ibrsp and ibwait to communicate with the device Cleanup use ibonl to put the handle offline Refer to the sample applications that are installed with the NI 488 2 software to see detailed examples for diff...

Page 35: ...I 488 2 calls to have access to all the NI 488 2 functionality Checking Status with Global Variables Each NI 488 2 API call updates four global variables to reflect the status of the device or interface that you are using These global status variables are the status word ibsta the error variable iberr and the count variables ibcnt and ibcntl They contain useful information about the performance of...

Page 36: ... shows the condition that each bit position represents the bit mnemonics and the type of calls for which the bit can be set For a detailed explanation of each status condition refer to Appendix B Status Word Conditions Table 3 1 Status Word Layout Mnemonic Bit Pos Hex Value Type Description ERR 15 8000 dev brd NI 488 2 error TIMO 14 4000 dev brd Time limit exceeded END 13 2000 dev brd END or EOS d...

Page 37: ...cation or Appendix C Error Codes and Solutions Count Variables ibcnt and ibcntl The count variables are updated after each read write or command function In Win32 applications ibcnt and ibcntl are 32 bit integers On some systems like MS DOS ibcnt is a 16 bit integer and ibcntl is a 32 bit integer For cross platform compatibility all applications should use ibcntl If you are reading data the count ...

Page 38: ...le NI 488 2 errors This function takes the device offline and closes the application If the function is declared as void gpiberr char msg function prototype Then your application invokes it as follows if ibsta ERR gpiberr NI 488 2 error General Program Steps and Examples The following steps show you how to use the device level traditional NI 488 2 calls in your application The NI 488 2 software in...

Page 39: ...andle ud that is used for all device level traditional NI 488 2 calls that communicate with the GPIB instrument Step 2 Clear the Device Use ibclr to clear the device This resets the device s internal functions to the default state Device Communication Step 3 Communicate with the Device Communicate with the device by sending it the IDN query and then reading back the response Many devices respond t...

Page 40: ...lare and define a function to handle NI 488 2 errors This function takes the device offline and closes the application If the function is declared as void gpiberr char msg function prototype Then your application invokes it as follows if ibsta ERR gpiberr NI 488 2 error General Program Steps and Examples The following steps show you how to use the multi device NI 488 2 calls in your application Th...

Page 41: ...trument and use it for subsequent calls Alternately if you already know your GPIB device s primary and secondary address you can create an appropriate GPIB address to use in subsequent NI 488 2 calls as follows a GPIB address is a 16 bit value that contains the primary address in the low byte and the secondary address in the high byte If you are not using secondary addressing the secondary address...

Page 42: ...tructions The following sections describe how to develop compile and link your Win32 NI 488 2 applications using various programming languages Microsoft Visual C C Version 2 0 or Later Before you compile your Win32 C application make sure that the following lines are included at the beginning of your program include windows h include decl 32 h To compile and link a Win32 console application named ...

Page 43: ...ntry with C gpib 32 dll Exports gpib 32 dll exports pointers to the global variables and all of the NI 488 2 calls Pointers to the global variables ibsta iberr ibcnt and ibcntl are accessible through these exported variables int user_ibsta int user_iberr int user_ibcnt long user_ibcntl Except for the functions ibbna ibfind ibrdf and ibwrtf all the NI 488 2 call names are exported from gpib 32 dll ...

Page 44: ...he NI 488 2 online help For instructions on accessing the online help refer to the Using the NI 488 2 Documentation section in About This Manual The direct entry sample programs illustrate how to use direct entry to access gpib 32 dll For more information about direct entry refer to the online help for your development environment Directly Accessing the gpib 32 dll Exports Make sure that the follo...

Page 45: ... in the NI 488 2 online help For instructions on accessing the online help refer to the Using the NI 488 2 Documentation section in About This Manual Following is an example of how to cast the function pointer and how the parameter list is set up for ibdev and ibonl functions int _stdcall Pibdev int ud int pad int sad int tmo int eot int eos int _stdcall Pibonl int ud int v Next your Win32 applica...

Page 46: ... Free the GPIB library FreeLibrary Gpib32Lib printf GetProcAddress failed Your Win32 application needs to dereference the pointer to access either the status variables or function The following code shows you how to call a function and access the status variable from within your application dvm Pibdev 0 1 0 T10s 1 0 if Pibsta ERR printf Call failed Before exiting your application you need to free ...

Page 47: ...om your config sys file To do so complete the following steps a Locate your config sys file and open it for editing b Find the following line device path gpib com where path refers to the drive and directory where gpib com is located c If that line appears type REM at the beginning of the line as follows REM device path gpib com d Save your config sys file and close it 2 Select Start Programs Nati...

Page 48: ... NT complete the following steps 1 Open your config nt file located in the Windows 2000 NT system32 directory for example c windows system32 2 Find the following lines REM To run DOS GPIB applications uncomment the REM following line REM device path doswin16 gpib nt com where path is the directory in which you installed the NI 488 2 software 3 Remove REM from the last line so that it reads as foll...

Page 49: ... Win32 Win16 and DOS NI 488 2 applications To start NI Spy complete the following steps 1 Select Start Programs National Instruments NI 488 2 Explore GPIB to start Measurement Automation Explorer 2 Expand the Devices and Interfaces directory by clicking on the next to the folder 3 Right click on your GPIB interface and select NI Spy from the drop down menu that appears 4 On the NI Spy toolbar clic...

Page 50: ...ou should check for errors after each NI 488 2 call If a NI 488 2 call failed the high bit of ibsta the ERR bit is set For a failed NI 488 2 call iberr contains a value that defines the error In some error cases the value in ibcntl contains even more error information You can use NI Spy to determine which NI 488 2 call is failing Once you know which NI 488 2 call fails refer to Appendix B Status W...

Page 51: ...out This Manual NI 488 2 Error Codes The error variable is meaningful only when the ERR bit in the status variable ibsta is set For a detailed description of each error and possible solutions refer to Appendix C Error Codes and Solutions Configuration Errors Several applications require customized configuration of the NI 488 2 driver For example you might want to terminate reads on a special end o...

Page 52: ... Right click on your GPIB interface and select Interactive Control from the drop down menu that appears 4 At the command prompt type NI 488 2 API calls to communicate interactively with the your instrument For example you might use ibdev ibclr ibwrt ibrd and ibonl To view the online help for Interactive Control type help at the Interactive Control command prompt A well behaved IEEE 488 device does...

Page 53: ...works properly regardless of the previous configuration For more information about ibconfig refer to the description of ibconfig in the NI 488 2 online help For instructions on accessing the online help refer to the Using the NI 488 2 Documentation section in About This Manual Termination Method You should be aware of the data termination method that your device uses By default your NI 488 2 softw...

Page 54: ...g errors in your application and for verifying that the communication with your GPIB instrument is correct Starting NI Spy To start NI Spy complete the following steps 1 Select Start Programs National Instruments NI 488 2 Explore GPIB to start Measurement Automation Explorer 2 Expand the Devices and Interfaces directory by clicking on the next to the folder 3 Right click on your GPIB interface and...

Page 55: ...Spy You can also view the online help by clicking on the question mark button on the NI Spy toolbar and then clicking on the area of the screen about which you have a question Locating Errors with NI Spy All NI 488 2 calls returned with an error are displayed in red within the main NI Spy window Viewing Properties for Recorded Calls To see the detailed properties of any call recorded in the main N...

Page 56: ...ile Save As to save the data in a spy file After you save your data select File Exit to exit the NI Spy utility Performance Considerations NI Spy can slow down the performance of your NI 488 2 application and certain configurations of NI Spy have a larger impact on performance than others For example configuring NI Spy to record calls to an output file or to use full buffers might have a significa...

Page 57: ... Control utility helps you to learn about your instrument and to troubleshoot problems by displaying the following information on your screen after you enter a command Results of the status word ibsta in hexadecimal notation Mnemonic constant of each bit set in ibsta Mnemonic value of the error variable iberr if an error exists the ERR bit is set in ibsta Count value for each read write or command...

Page 58: ...t of 10 seconds enables the END message and disables the EOS mode ibdev enter board index 0 enter primary address 6 enter secondary address 0 enter timeout 13 enter EOI on last byte flag 1 enter end of string mode byte 0 ud0 Note If you type a command and no parameters Interactive Control prompts you for the necessary arguments If you already know the required arguments you can type them at the co...

Page 59: ...rt enter string IDN 0100 cmpl count 5 Or equivalently ud0 ibwrt IDN 0100 cmpl count 5 7 To read data from your device use ibrd The data that is read from the instrument is displayed For example to read 29 bytes enter the following ud0 ibrd enter byte count 29 0100 cmpl count 29 46 4C 55 4B 45 2C 20 34 FLUKE 4 35 2C 20 34 37 39 30 31 5 47901 37 33 2C 20 31 2E 36 20 73 1 6 44 31 2E 30 0A D 10 Or equ...

Page 60: ...turn ibsta value for the function it also prints other return values If you do not know what parameters are appropriate to pass to a given function call type in the function name and press Enter The Interactive Control utility then prompts you for each required parameter Number Syntax You can enter numbers in either hexadecimal or decimal format Hexadecimal numbers You must prefix hexadecimal numb...

Page 61: ...ed by a comma separated list of addresses such as 1 2 3 Interactive Control Commands Tables 6 1 and 6 2 summarize the syntax of the traditional NI 488 2 calls in the Interactive Control utility Table 6 3 summarizes the syntax of the multi device NI 488 2 calls in the Interactive Control utility Table 6 4 summarizes the auxiliary functions that you can use in the Interactive Control utility For mor...

Page 62: ... the bytes to read ibrdf flname Read data to file where flname is pathname of file to read ibrpp Conduct a parallel poll ibrsp Return serial poll byte ibsad v Change secondary address ibstop Abort asynchronous operation ibtmo v Change disable time limit ibtrg Trigger selected device ibwait mask Wait for selected event where mask is a hex or decimal integer or a list of mask bit mnemonics such as i...

Page 63: ...e EOS message ibeot v Enable disable END message ibfind udname Return unit descriptor where udname is the symbolic name of interface for example gpib0 ibgts v Go from Active Controller to standby ibist v Set clear ist iblines Read the state of all GPIB control lines ibln pad sad Check for presence of device on the GPIB at pad sad ibloc Go to local ibonl v Place device online or offline ibpad v Cha...

Page 64: ...scription AllSpoll addrlist Serial poll multiple devices DevClear address Clear a device DevClearList addrlist Clear multiple devices EnableLocal addrlist Enable local control EnableRemote addrlist Enable remote control FindLstn padlist limit Find all Listeners FindRQS addrlist Find device asserting SRQ PassControl address Pass control to a device PPoll Parallel poll devices PPollConfig address da...

Page 65: ...o perform self tests Trigger address Trigger a device TriggerList addrlist Trigger multiple devices WaitSRQ Wait for service request Table 6 4 Auxiliary Functions in Interactive Control Function Description set udname Select active device or interface where udname is the symbolic name of the new device or interface for example dev1 or gpib0 Call ibfind or ibdev initially to open each device or int...

Page 66: ...ion If an NI 488 2 call completes with an error the Interactive Control utility displays the relevant error mnemonic In the following example an error condition EBUS has occurred during a data transfer ud0 ibwrt IDN 8100 err cmpl error EBUS count 1 ud0 Turn ON display n function Execute function n times where function represents the correct Interactive Control function syntax n Execute previous fu...

Page 67: ...ion completes the Interactive Control utility displays the actual number of bytes sent or received regardless of the existence of an error condition If one of the addresses in an address list is invalid then the error is EARG and the Interactive Control utility displays the index of the invalid address as the count The count has a different meaning depending on which NI 488 2 call is made For the ...

Page 68: ...mode is enabled the GPIB EOI line is asserted when the last byte of a write is sent out on the GPIB If it is disabled the EOI line is not asserted with the last byte of a write You can use the ibeos function to enable disable or configure the EOS modes EOS mode configuration includes the following information A 7 bit or 8 bit EOS byte EOS comparison method This indicates whether the EOS byte has s...

Page 69: ...tocol increases performance for GPIB reads and writes up to 8 Mbytes s depending on your system HS488 is a superset of the IEEE 488 standard thus you can mix IEEE 488 1 IEEE 488 2 and HS488 devices in the same system If HS488 is enabled the TNT4882C hardware implements high speed transfers automatically when communicating with HS488 instruments If you attempt to enable HS488 on a GPIB interface th...

Page 70: ...stem It is called the Configure CFGn message Because HS488 can operate only with cable lengths of 1 to 15 m only CFGn values of 1 through 15 hex 61 through 6F are valid If the cable length was configured properly in the NI 488 2 Configuration utility you can determine how many meters of cable are in your system by calling ibask option IbaHSCableLength in your application For more information about...

Page 71: ...oose to use ibnotify if your application only needs to interact with your GPIB device when it is requesting service After calling ibnotify your application does not need to check the status of your GPIB device Then when your GPIB device requests service the NI 488 2 driver automatically notifies your application that the event has occurred by invoking a callback function The callback function is r...

Page 72: ...About This Manual Note The ibnotify callback is executed in a separate thread of execution from the rest of your application If your application will be performing other NI 488 2 operations while it is using ibnotify use the per thread NI 488 2 globals that are provided by the ThreadIbsta ThreadIberr ThreadIbcnt and ThreadIbcntl functions described in the Writing Multithreaded Win32 NI 488 2 Appli...

Page 73: ...ns an available device and assigns it to access GPIB0 with a primary address of 1 a secondary address of 0 a timeout of 10 seconds the END message enabled and the EOS mode disabled If ud is less than zero then print an error message that the call failed and exit the program ud ibdev 0 connect board 1 primary address of GPIB device 0 secondary address of GPIB device T10s 10 second I O timeout 1 EOT...

Page 74: ...all MyCallback int LocalUd int LocalIbsta int LocalIberr long LocalIbcntl void RefData char SpollByte char ReadBuffer 40 If the ERR bit is set in LocalIbsta then print an error message and return if LocalIbsta ERR printf GPIB error d has occurred No more callbacks n LocalIberr DeviceError TRUE return 0 Read the serial poll byte from the device If the ERR bit is set in ibsta then print an error mes...

Page 75: ...length is specified by the byte count in ibcntl However many GPIB instruments return ASCII data strings and this example makes this assumption Because of this it is possible to add a NULL character to the end of the data received and use the printf function to display the ASCII data The following code illustrates that ReadBuffer ibcntl 0 Convert the data into a numeric value sscanf ReadBuffer f Re...

Page 76: ...parate threads that make NI 488 2 calls thread 1 and thread 2 Just as thread 1 is about to examine one of the NI 488 2 globals it gets preempted and thread 2 is allowed to run Thread 2 proceeds to make several NI 488 2 calls that automatically update the NI 488 2 globals Later when thread 1 is allowed to run the NI 488 2 global that it is ready to examine is no longer in a known state and its valu...

Page 77: ...c ibcnt long ThreadIbcntl return thread specific ibcntl In your application instead of accessing the per process NI 488 2 globals substitute a call to get the corresponding per thread NI 488 2 global For example the following line of code if ibsta ERR could be replaced by if ThreadIbsta ERR A quick way to convert your application to use per thread NI 488 2 globals is to add the following define li...

Page 78: ... 2 Configuration utility to activate the CIC protocol If the interface is not CIC and you make a device level call with the CIC protocol enabled the following sequence occurs 1 The GPIB interface asserts the SRQ line 2 The current CIC serial polls the interface 3 The interface returns a response byte of hex 42 4 The current CIC passes control to the GPIB interface If the current CIC does not pass ...

Page 79: ...poll This section describes how to set up your application to detect and respond to service requests from GPIB devices Service Requests from IEEE 488 Devices IEEE 488 devices request service from the GPIB Controller by asserting the GPIB SRQ line When the Controller acknowledges the SRQ it serial polls each open device on the bus to determine which device requested service Any device requesting se...

Page 80: ...first in first out FIFO fashion If the RQS bit of the status word is not set when ibrsp is called a serial poll is conducted and returns the response received Empty the queue as soon as an automatic serial poll occurs because responses might be discarded if the queue is full 6 If the RQS bit of the status word is still set after ibrsp is called the response byte queue contains at least one more re...

Page 81: ...s As the transfer size increases the performance degradation decreases slightly but it remains a significant problem for all transfers under 1 Mbyte For instructions on how to assign an interrupt to your GPIB interface if one was not assigned refer to the Enabling Interrupts section in Appendix D Windows 98 95 Troubleshooting and Common Questions Windows 2000 NT The NI 488 2 software for Windows 2...

Page 82: ...evice requested service ReadStatusByte is similar to AllSpoll except that it only serial polls a single device It is also similar to the device level NI 488 2 ibrsp function FindRQS serial polls a list of devices until it finds a device that is requesting service or until it has polled all of the devices on the list The call returns the index and status byte value of the device requesting service ...

Page 83: ...serted n FindRQS 0 AddrList SerialPollResponse if ibsta ERR printf Device at pad x returned byte x n AddrList ibcnt int SerialPollResponse DevicePad AddrList ibcnt DeviceResponse SerialPollResponse return Example 2 Using AllSpoll This example shows you how to use AllSpoll to serial poll three devices with a single call void GetAllSerialPollResponses Addr4882_t AddrList short ResponseList int WaitR...

Page 84: ... NI 488 2 calls for parallel polling when the GPIB interface is not the Controller and the interface must configure itself for a parallel poll and set its own individual status bit ist Parallel Polling with Traditional NI 488 2 Calls Complete the following steps to implement parallel polling using traditional NI 488 2 calls Each step contains example code 1 Configure the device for parallel pollin...

Page 85: ...llel poll you should still use the ibppc function Pass the interface index or an interface unit descriptor value as the first argument in ibppc Also if the individual status bit ist of the interface needs to be changed use the ibist function In the following example the GPIB interface is to configure itself to participate in a parallel poll It asserts DIO5 when ist is 1 if a parallel poll is condu...

Page 86: ... line is asserted PPollConfig 0 3 5 1 2 Conduct the parallel poll using PPoll store the response and check the response for a certain value In the following example because DIO5 is asserted by the device if ist is 1 the program checks bit 4 hex 10 in the response to determine the value of ist PPoll 0 response If response has bit 4 hex 10 set the ist bit of the device at that time is equal to 1 If ...

Page 87: ... common device commands Talkers Listeners and Controllers GPIB devices can be Talkers Listeners or Controllers A Talker sends out data messages Listeners receive data messages The Controller usually a computer manages the flow of information on the bus It defines the communication links and sends GPIB commands to devices Some devices are capable of playing more than one role A digital voltmeter fo...

Page 88: ...lker Because the Controller is usually at primary address 0 it sends hex 20 address 0 with bit 5 set to make itself a Listener Figure A 1 shows the configuration of the GPIB address bits Figure A 1 GPIB Address Bits With some devices you can use secondary addressing A secondary address is a number in the range hex 60 to hex 7E When you use secondary addressing the Controller sends the primary talk...

Page 89: ...ready to receive a message byte Also used by the Talker to signal high speed GPIB transfers NDAC not data accepted Listening device has has not accepted a message byte DAV data valid Talking device indicates signals on data lines are stable valid data Table A 2 GPIB Interface Management Lines Line Description ATN attention Controller drives ATN true when it sends commands and false when it sends d...

Page 90: ...be set for device calls dev board calls brd or both dev brd Table B 1 shows the status word layout Table B 1 Status Word Layout Mnemonic Bit Position Hex Value Type Description ERR 15 8000 dev brd NI 488 2 error TIMO 14 4000 dev brd Time limit exceeded END 13 2000 dev brd END or EOS detected SRQI 12 1000 brd SRQ interrupt received RQS 11 800 dev Device requesting service CMPL 8 100 dev brd I O com...

Page 91: ...expires before any other specified mask bit condition occurs TIMO is cleared in all other circumstances END dev brd END indicates either that the GPIB EOI line has been asserted or that the EOS byte has been received if the software is configured to terminate a read on an EOS byte If the GPIB interface is performing a shadow handshake as a result of the ibgts function any other function can return...

Page 92: ...ly appear in ibsta You can also wait for a device to request service regardless of the state of automatic serial polling by calling ibwait with a mask that contains RQS Do not issue an ibwait call on RQS for a device that does not respond to serial polls Use ibrsp to acquire the serial poll response byte that was received RQS is cleared when all of the stored serial poll response bytes have been r...

Page 93: ...e CIC is set when the SendIFC or ibsic call is executed either while the GPIB interface is System Controller or when another Controller passes control to the GPIB interface CIC is cleared either when the GPIB interface detects Interface Clear IFC from the System Controller or when the GPIB interface passes control to another device ATN brd ATN indicates the state of the GPIB Attention ATN line ATN...

Page 94: ...S is set whenever the GPIB interface as a Listener detects that the Group Execute Trigger GET command has been sent by another Controller DTAS is cleared on any call immediately following an ibwait call if the DTAS bit is set in the ibwait mask parameter DCAS brd DCAS indicates whether the GPIB interface has detected a device clear command DCAS is set whenever the GPIB interface detects that the D...

Page 95: ...CIC 1 Function requires GPIB interface to be CIC ENOL 2 No Listeners on the GPIB EADR 3 GPIB interface not addressed correctly EARG 4 Invalid argument to function call ESAC 5 GPIB interface not System Controller as required EABO 6 I O operation aborted timeout ENEB 7 Nonexistent GPIB interface EDMA 8 DMA error EOIP 10 Asynchronous I O in progress ECAP 11 No capability for operation EFSO 12 File sy...

Page 96: ...bleshooting Wizard to ensure that each interface you want to access is working properly as follows 1 Select Start Programs National Instruments NI 488 2 Explore GPIB 2 Select Help Troubleshooting NI 488 2 Troubleshooting Wizard The Troubleshooting Wizard tests your GPIB interface and displays the results Use the unit descriptor returned from ibdev or ibfind as the first parameter in subsequent tra...

Page 97: ...lly occurs when a write operation is attempted with no Listeners addressed For a device write ENOL indicates that the GPIB address configured for that device in the software does not match the GPIB address of any device connected to the bus that the GPIB cable is not connected to the device or that the device is not powered on ENOL can occur in situations where the GPIB interface is not the CIC an...

Page 98: ... calling ibgts except immediately after an ibcmd call ibcmd causes ATN to be asserted EARG 4 EARG results when an invalid argument is passed to a function call The following are some examples ibtmo called with a value not in the range 0 through 17 ibeos called with meaningless bits set in the high byte of the second parameter ibpad or ibsad called with invalid addresses ibppc called with invalid p...

Page 99: ...I O is not progressing the Listener is not continuing to handshake or the Talker has stopped talking or the byte count in the call which timed out was more than the other device was expecting Solutions Possible solutions for this error are as follows Use the correct byte count in input functions or have the Talker use the END message to signify the end of the transfer Lengthen the timeout period f...

Page 100: ...MA Solutions Possible solutions for this error are as follows You can correct the EDMA problem in the hardware by using the NI 488 2 Configuration utility to reconfigure the hardware to not use a DMA resource You can correct the EDMA problem in the software by using ibdma to disable DMA EOIP 10 EOIP occurs when an asynchronous I O operation has not finished before some other call is made During as...

Page 101: ...tware and a call is made that requires the capability Solutions Check the validity of the call or make sure your GPIB interface and the driver both have the needed capability EFSO 12 EFSO results when an ibrdf or ibwrtf call encounters a problem performing a file operation Specifically this error indicates that the function is unable to open create seek write or close the file being accessed The s...

Page 102: ...oo short for the driver to send command bytes increase the timeout period ESTB 15 ESTB is reported only by the ibrsp function ESTB indicates that one or more serial poll status bytes received from automatic serial polls have been discarded because of a lack of storage space Several older status bytes are available however the oldest is being returned by the ibrsp call Solutions Possible solutions ...

Page 103: ...arns you of a definite GPIB problem it does not affect GPIB operations except that you cannot depend on the ibsta 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 ETAB 20 ETAB occurs only during the FindLstn and FindRQS functions ETAB indicates that there was some problem with a table...

Page 104: ...gned to a GPIB interface an EDVR error condition occurs with ibcntl set to 0xE028002C You can assign an interface number to a GPIB interface by configuring the NI 488 2 software and selecting an interface name For information about how to configure the NI 488 2 software refer to the online help in the NI 488 2 Configuration utility as follows 1 Select Start Programs National Instruments NI 488 2 E...

Page 105: ... drivers complete the following steps 1 Select Start Settings Control Panel 2 Double click on the System icon 3 Select the Performance tab 4 If the PC Cards PCMCIA line does not read 32 bit select Start Settings Control Panel and double click on the PC Card PCMCIA icon The PC Card PCMCIA Wizard enables the 32 bit PCMCIA drivers 5 Shut down your system and restart it Your system should detect your ...

Page 106: ... D 1 to troubleshoot your problem Table D 1 Device Manager Status Codes Code Problem Solution 9 Windows had a problem reading information from the GPIB interface This problem can occur if you are using an older revision of the AT GPIB TNT or AT GPIB TNT PnP interface Contact National Instruments to upgrade your GPIB interface 22 The GPIB interface is disabled To enable the GPIB interface check the...

Page 107: ...our system typically does not have any devices that can be removed In this case you should disable a device that you do not use such as LPT1 or COM1 To do so complete the following steps 1 Select Start Settings Control Panel 2 Double click on the System icon 3 Select the Device Manager tab and click on the View devices by type button If you do not use your LPT port you can disable the LPT1 device ...

Page 108: ... on the NI PCMCIA GPIB Multifunction Parent item and click on the Remove button Step 3 Refresh the Device Manager or Reinstall Your GPIB interface On the Device Manager tab click on the Refresh button If your GPIB interface does not appear under National Instruments GPIB Interfaces your GPIB interface is not Plug and Play In this case you must use the Add GPIB Hardware Wizard to reinstall your int...

Page 109: ... this appendix for information about what might cause this problem If you already completed the troubleshooting steps contact National Instruments How can I determine which type of GPIB hardware I have installed Select Start Programs National Instruments NI 488 2 Explore GPIB and expand the Devices and Interfaces directory by clicking on the next to the folder Measurement Automation Explorer lists...

Page 110: ... can I determine if my GPIB hardware and the NI 488 2 software are installed properly Run the NI 488 2 Troubleshooting Wizard To do so select Start Programs National Instruments NI 488 2 Explore GPIB Then select Help Troubleshooting NI 488 2 Troubleshooting Wizard When should I use the Interactive Control utility You can use the Interactive Control utility to test and verify instrument communicati...

Page 111: ...eck for errors in my NI 488 2 application Examine the value of ibsta after each NI 488 2 call If a call fails the ERR bit of ibsta is set and an error code is stored in iberr For more information about global status variables refer to Chapter 4 Debugging Your Application What information should I have before I call National Instruments Before you call National Instruments record the results of the...

Page 112: ... I troubleshoot problems Run the NI 488 2 Troubleshooting Wizard To do so select Start Programs National Instruments NI 488 2 Explore GPIB Then select Help Troubleshooting NI 488 2 Troubleshooting Wizard How can I determine which version of the NI 488 2 software I have installed To view the NI 488 2 software version complete the following steps 1 Select Start Programs National Instruments NI 488 2...

Page 113: ...number of devices is 32 Are interrupts and DMA required with the NI 488 2 software Interrupts are required but DMA is not How can I determine if my GPIB hardware and the NI 488 2 software are installed properly Run the NI 488 2 Troubleshooting Wizard To do so select Start Programs National Instruments NI 488 2 Explore GPIB Then select Help Troubleshooting NI 488 2 Troubleshooting Wizard How can I ...

Page 114: ...ost cases device level traditional NI 488 2 calls are sufficient for communicating with instruments For more information refer to Chapter 3 Developing Your NI 488 2 Application How do I check for errors in my NI 488 2 application Examine the value of ibsta after each NI 488 2 call If a call fails the ERR bit of ibsta is set and an error code is stored in iberr For more information about global sta...

Page 115: ...questions FAQs and their corresponding answers or solutions including special sections devoted to our newest products The database is updated daily in response to new customer experiences and feedback Troubleshooting Wizards Step by step guides lead you through common problems and answer questions about our entire product line Wizards include screen shots that illustrate the steps being described ...

Page 116: ...ranch offices maintain a Web site to provide information on local services You can access these Web sites from www natinst com worldwide If you have trouble connecting to our Web site please contact your local National Instruments office or the source from which you purchased your National Instruments product s to obtain support For telephone support in the United States dial 512 795 8248 For tele...

Page 117: ...ttached to it ANSI American National Standards Institute API Application Programming Interface ASCII American Standard Code for Information Interchange asynchronous 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 GPIB software in which serial polls are executed automatically by the driver whenever a device...

Page 118: ... devices See SDC device level function A 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 DIO1 through DIO8 The GPIB lines that are used to transmit command or data bytes from one device to another DLL Dynamic link library DMA Direct memory access High speed data transfer ...

Page 119: ... Standard 488 2 1992 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 board has both a GPIB address and an I O address GPIB board Refers to the National Instruments family of GPIB interfaces GTL Go To Local The GPIB command used to place an addressed Listener in local front panel control mode H handshake The mec...

Page 120: ...tains the actual number of bytes transmitted On systems with a 16 bit integer such as MS DOS ibcnt is a 16 bit integer and ibcntl is a 32 bit integer For cross platform compatibility use ibcntl iberr A global variable that contains the specific error code associated with a function call that failed ibsta At the end of each function call this global variable status word contains status information ...

Page 121: ... rudimentary board or device function that performs a single operation M m Meters MAV The Message Available bit is part of the IEEE 488 2 defined status byte which is received from a device responding to a serial poll MLA My Listen Address A GPIB command used to address a device to be a Listener It can be any one of the 31 primary addresses MSA My Secondary Address The GPIB command used to address...

Page 122: ...n polls PPD Parallel Poll Disable The GPIB command used to disable a configured device from participating in polls There are 16 PPD commands PPE Parallel Poll Enable The 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 Parallel Poll Unconfigure The GPIB command used to disable used to disable any device from par...

Page 123: ...ee acceptor handshake and handshake SPD Serial Poll Disable The GPIB command used to cancel an SPE command SPE Serial Poll Enable The GPIB command used to enable a specific device to be polled That device must also be addressed to talk See SPD SRQ Service Request The GPIB line that a device asserts to notify the CIC that the device needs servicing status byte The IEEE 488 2 defined data byte sent ...

Page 124: ...nts 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 U ud Unit descriptor A variable name and first argument of each function call that contains the unit descriptor of the GPIB interface or other GPIB device that is the object of the function UNL Unlisten The G...

Page 125: ...2 API subset 3 4 to 3 5 communicating with instruments multiple interfaces or multiple devices 3 5 single GPIB device 3 4 to 3 5 using Interactive Control utility 3 7 using NI 488 2 Communicator 3 1 to 3 2 interactive instrument control 3 2 to 3 3 language specific instructions 3 12 to 3 16 Borland C C 3 12 direct entry with C 3 13 to 3 16 directly accessing gpib 32 dll exports 3 14 to 3 16 gpib 3...

Page 126: ...s 3 12 cable length for high speed data transfers 7 2 to 7 3 CIC See Controller in Charge CIC CIC Protocol 7 11 CIC status word condition bit position hex value and type table 3 6 description B 4 CMPL status word condition bit position hex value and type table 3 6 description B 3 common questions See troubleshooting and common questions communicating with instruments multiple interfaces or multipl...

Page 127: ...s See NI 488 2 calls device level calls and bus management 7 11 Device Manager device status codes troubleshooting D 3 diagnostic resources online F 1 direct access to NI 488 2 dynamic link library 3 3 documentation accessing NI 488 2 Online Help xi conventions used in manual xii related documentation xii using NI 488 2 documentation xi DOS NI 488 2 applications enabling disabling support Windows ...

Page 128: ...or code C 5 ESRQ error code C 8 to C 9 ESTB error code C 8 ETAB error code C 9 event notification See asynchronous event notification in Win32 applications Event Status bit ESB 7 12 to 7 13 execute function n times n function Interactive Control utility 6 10 execute indirect file function Interactive Control utility 6 10 execute previous function n times n function Interactive Control utility 6 10...

Page 129: ...g information about 2 11 to 2 12 GPIB interface adding new 2 4 to 2 5 deleting 2 5 viewing or changing settings 2 9 to 2 11 Windows 98 95 2 9 to 2 10 Windows 2000 NT 2 10 to 2 11 H handshake lines A 3 help See online help Help display Interactive Control utility online help function table 6 9 Help option function Interactive Control utility 6 9 high speed data transfers HS488 7 2 to 7 3 cable leng...

Page 130: ... error information 6 10 to 6 11 getting started 6 1 to 6 4 NI 488 function examples 6 2 to 6 4 overview 6 1 programming considerations 3 2 to 3 3 status word 6 10 syntax 6 4 to 6 10 addresses 6 5 board level traditional NI 488 2 calls table 6 7 to 6 8 device level traditional NI 488 2 calls table 6 5 to 6 6 multi device NI 488 2 calls table 6 8 to 6 9 numbers 6 4 strings 6 4 to 6 5 interface manag...

Page 131: ...ines A 2 handshake lines A 3 interface management lines A 3 Microsoft Visual Basic programming instructions 3 13 Microsoft Visual C C programming instructions 3 12 Microsoft Windows See Windows 98 95 Windows 2000 NT multi device NI 488 2 calls See NI 488 2 calls multiple interfaces or multiple devices 3 5 multithreaded Win32 GPIB applications writing 7 9 to 7 10 N n execute previous function n tim...

Page 132: ...ditional NI 488 2 calls 7 14 to 7 15 with multi device NI 488 2 calls 7 15 to 7 17 Talker Listener applications 7 11 to 7 12 termination of data transfers 7 1 to 7 2 waiting for GPIB conditions 7 4 writing multithread Win32 GPIB applications 7 9 to 7 10 NI 488 2 software language interfaces 3 3 viewing version 2 8 NI Spy utility debugging applications 4 1 exiting 5 3 locating errors 5 2 online hel...

Page 133: ...autopolling and interrupts 7 14 stuck SRQ state 7 13 service requests from IEEE 488 devices 7 12 from IEEE 488 2 devices 7 12 SRQ and serial polling device level traditional NI 488 2 calls 7 14 to 7 15 multi device NI 488 2 calls 7 15 to 7 17 service requests serial polling IEEE 488 devices 7 12 IEEE 488 2 devices 7 12 stuck SRQ state 7 13 set 488 2 v function Interactive Control utility 6 9 set u...

Page 134: ...also debugging NI Spy utility online problem solving and diagnostic resources F 1 using Measurement Automation Explorer 2 4 Windows 98 95 D 1 to D 8 common questions D 5 to D 8 Device Manager device status code D 3 EDVR error conditions D 1 to D 2 enabling interrupts D 4 to D 5 Windows 2000 NT E 1 to E 3 turn OFF display function Interactive Control utility 6 9 turn ON display function Interactive...

Page 135: ...g interrupts D 4 to D 5 viewing or changing settings GPIB ENET network 2 15 to 2 16 GPIB interface 2 9 to 2 10 Windows 2000 NT autopolling and interrupts 7 14 changing GPIB device templates 2 13 enabling disabling NI 488 2 DOS support 2 13 to 2 14 running existing DOS NI 488 2 applications 3 18 troubleshooting and common questions E 1 to E 3 viewing or changing GPIB interface settings 2 10 to 2 11...

Reviews: