Why Can't I Communicate with My GPIB Instrument?
Why can't I communicate with my GPIB instrument?
Most problems with GPIB instruments are due to either the physical setup (unable to detect the device) or the commands being sent (read/write).
Unable to Detect GPIB Instrument
Related Links: KnowledgeBase 1DREQIQA: GPIB Error Codes and Common Solutions (Part 1) 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 Products and Services: GPIB Support Main
The Measurement and Automation Explorer (MAX) provides a "Scan for Instruments" function to quickly test your GPIB setup. If you do not have MAX installed simply enter the commands below into your GPIB controller application (IBIC or other) instead.
Clicking on the "Scan for Instruments" button in MAX will conduct a FindLstn() test for all GPIB addresses 0-30 to find active listeners on the bus. It will then attempt to identify these instruments by sending them "*IDN?" and 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 check the following:
Error on a Write
- Check your cabling is compliant with the following strict 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. If one instrument is working but another is not, try swapping the cables.
- 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.
- Check the address of your instruments and make sure that they are different from the controller. The GPIB address 0 is usually reserved for the controller (usually your National Instruments GPIB card in your computer). You must set the address of your instruments on their front panels or via DIP switches somewhere on the instruments.
- Occasionally, some instruments do not respond fast enough to the "Scan for Instruments" command. You can test this by using IBIC or a LabVIEW application to send commands to the instruments and see if communication is successful.
The EABO (abort) status being returned from your GPIB write call (IBWRT function call) is the most common write problem.
The GPIB bus relies on a handshake to guarantee that data is received by instruments. An EABO error is usually caused by a TIMO (timeout) error where the controller card times out waiting for the handshake to complete. The default timeout value is 10 seconds, so you could observe the write function wait for 10 seconds and then fail. If you experience this error, check the following:
Error on a Read and No Data is Returned
- Check that you are writing to the correct GPIB address.
- Note: 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.
- Go through the troubleshooting steps listed above.
If no error is returned by the write then it was sent and received successfully. You should then perform a read (IBRD function call) to ask the instrument for a response. If you receive an error on the read, it will most likely be an EABO (abort) due to a TIMO (timeout) condition. If you experience this error, check the following:
- Verify the command you sent is valid for that instrument. Most instruments do not respond to invalid commands at all. See your instrument's user manual or contact its manufacturer for the list of valid commands.
- Many instruments will respond to "*IDN?" or "ID" (without the quotes), but not all.
- Verify the termination method used on your write string. There are two types of message termination:
- Assert the EOI (End or Identify) line on the GPIB with the last byte of the transmission. This is the default behavior for the National Instruments GPIB driver. EOI settings are changed by making driver calls (see IBCONFIG) or in a GPIB Configuration utility (MAX in Windows, GPIB Explorer on other Operating Systems).
- Send an EOS (End of String) character at the end (carriage return('\r') or a linefeed('\n')). To send an EOS add it to the end of the string written to the instrument.
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).