Academic Company Events Community Support Solutions Products & Services Contact NI MyNI
77 ratings:
 2.31 out of 5     Rate this Document

Why Can't I Communicate with My GPIB Instrument?



Hardware: GPIB

Problem:
Why can't I communicate with my GPIB instrument?

Solution:
The answer to this question depends on the type of behavior you are seeing. This document highlights some of the most common problems and their solutions. You may be trying to communicate with your instrument from Measurement & Automation Explorer (MAX), using Interactive Control (IBIC), LabVIEW, LabWindows/CVI, or another application program. Usually, to establish basic communication, you are trying to write to your instrument and then read some useful data back from that instrument.

Can't Find Your Instrument During a "Scan For Instruments"
The "Scan for Instruments" functionality of Measurement & Automation Explorer can be helpful in quickly testing out your GPIB setup. Clicking on this button in MAX will conduct a FindLstn() test for all GPIB addresses 0-30 to find active listeners on the bus and then will attempt to identify these instruments by sending them "*IDN?" and then performing a read. While not all instruments will respond to the "*IDN?", most should be picked up by the initial FindLstn() test.
If your instruments are not detected during this phase:
  • Check your cabling. GPIB has strict capacity and distance requirements (no more than 15 devices, no more than 4 meters of cable between any 2 adjacent instruments, average of 2 meters of cable between all instruments on the bus). Make sure the cable is connected securely to both your instrument and your controller board. Try another cable if possible, especially a shorter one.
  • If you have more than one instrument connected, disconnect all but one instrument. An instrument with a bad GPIB Interface could prevent other good instruments from communicating on the bus.
  • Note that the GPIB address 0 is usually reserved for the controller (usually your National Instruments GPIB card in your computer). If your controller has an address of 0, make sure that your instrument has a different address. You must set the address of your instrument on its front panel or via DIP switches somewhere on the instrument.
  • Occasionally, some instruments do not respond fast enough to the "Scan for Instruments" command.  It is likely that communication with GPIB device will still happen fine if IBIC or a LabVIEW program is used.

Error on a Write
You may be experiencing an NI-488.2 error on a write. The EABO (abort) status being returned from your write call (IBWRT function call) is the most common of these problems. The GPIB bus relies on a handshake to guarantee that data is received by instruments when it is placed on the bus by the controller card. An EABO error is usually caused by a TIMO (timeout) error where the controller card times out waiting for an instrument out on the bus to complete the handshake. The default timeout value is 10 seconds, so usually your write will seem to wait for 10 seconds and then fail.
Things to check:
  • For EABO and other write errors, make sure that you are trying to write to the correct GPIB address. Most instruments can be configured for any GPIB address 0-30. If you are using Windows, the "Scan for Instruments" functionality of MAX (mentioned above) will usually return the valid address for your instrument. This is especially useful if you are unsure of its current setting.
  • An EBUS status indicates that there is no GPIB cable connected or there are no active devices on that cable, so check to make sure that the cable is securely connected and that all devices are powered on.
  • Note that the GPIB address 0 is usually reserved for the controller (usually your National Instruments GPIB card in your computer). If your controller has an address of 0, make sure that your instrument has a different address. You must set the address of your instrument on its front panel or via dipswitches somewhere on the instrument.
Error on a Read and No Data is Returned
If you wrote to your instrument without an error being returned by the write, you can reasonably assume that your written message was properly sent to the instrument due to the 3-wire handshake of GPIB. Now, you should perform a read (IBRD function call) to ask the instrument for a response. If you receive an error on a read, it will most likely be an EABO (abort) due to a TIMO condition. This indicates that the GPIB controller board was waiting for a response from the instrument but that response never came.
Things to check:
  • The command that you previously wrote to your instrument. If you wrote an invalid command, the instrument may not respond with anything at all. See your instrument's user manual or contact its manufacturer for a simple command to send it. Many instruments will respond to "*IDN?" or "ID" (without the quotes), but a large number will not respond to these basic identification commands.
  • The termination method used on your write string. There are two main ways to terminate data messages sent to instruments: assert the EOI (End or Identify) line on the GPIB with the last byte of the transmission, or send an EOS (End of String) character at the end (usually, this is a carriage return or a linefeed, both nonprintable characters. You can usually indicate them by "\r" or "\n" respectively, though this varies by application). The default termination for the National Instruments GPIB driver software is to assert the EOI line with the last character sent on GPIB writes. If your device requires a termination character, add it to the end of the string that you write to the instrument. You can change the EOI setting by making driver calls (see IBCONFIG) or in the GPIB Configuration utility (MAX in Windows, GPIB Explorer on other Operating Systems)
See the related KnowledgeBase entry on "GPIB Error Codes and Common Solutions" (linked below) for a complete list of GPIB error codes and their common causes. The other KnowledgeBase entries linked below offer more information on GPIB communication problems. Troubleshooting assistance for GPIB communication problems is also available on the main GPIB Support page (linked below).

Related Links:
KnowledgeBase 1DREQIQA: GPIB Error Codes and Common Solutions
KnowledgeBase 20H8G27Z: Why Can I Communicate with My GPIB Instrument in MAX, but Not in LabVIEW
Product Manuals Library
Product Manuals: NI-488.2 User Manual
Product Manuals: NI-488.2 Function Reference Manual for Windows
GPIB Support Main

Attachments:





Report Date: 02/06/1996
Last Updated: 04/29/2011
Document ID: 0I593DEO

Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
  1 2 3 4 5
Please Contact NI for all product and support inquiries.submit