Unable to Communicate with GPIB Instrument

Updated Sep 21, 2023

Reported In

Hardware

  • GPIB Cable

Software

  • LabVIEW
  • Measurement & Automation Explorer (MAX)

Driver

  • NI-VISA
  • NI-488.2

Issue Details

  • My GPIB instrument not responding when I attempt to communicate with it.
  • I'm receiving Error (2) ENOL when I try to communicate with my device.
  • My GPIB instrument will work on another laptop, but not on my desktop computer.

Solution

Confirm that your GPIB cable is working and that you're able to write commands to your instrument.

Confirm that you have the appropriate software installed to communicate to your GPIB device. Ensure you have a compatible version of NI-VISA driver and the NI 488.2 driver. These pieces of software bridge communication between your computer's environment, and your instrument, and are necessary to function your GPIB device.

The Measurement and Automation Explorer (MAX) provides a Scan for Instruments function to quickly test your GPIB setup. Scan for Instruments identifies instruments by sending them *IDN? and performing a read. Note that if your instrument does not support the *IDN? command, it will not be identified.

Follow Step 3, How to Create a VISA Resource for an Instrument in MAX, in GPIB Instrument Control Tutorial to Scan for Instruments to see your instrument in NI MAX as shown in the image below.
 

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:
  1. Check your cabling is compliant with the following strict requirements:
    • No more than 15 GPIB devices connected to your GPIB network
    • No more than 4 meters of cable between any 2 adjacent instruments
    • Average of 2 meters of cable between all instruments on the bus
  2. Check that you are writing to the correct GPIB address.
  3. 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.
  4. 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.
  5. 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 NI 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.
  6. Occasionally, some instruments do not respond fast enough to the Scan for Instruments command.  You can test this by using the VISA Test Panel or a LabVIEW application to send commands to the instruments and see if communication is successful.
If you're still unable to see your instrument in NI MAX, follow the troubleshooting steps linked in Step 3 in GPIB Instrument Control Tutorial.

If no error is returned by the write then it was sent and received successfully.
 

Check if you are able to read from your instrument.

Now perform a read to ask the instrument for a response. If you receive an error on the read, it will most likely be an EABO due to timeout. If you experience this error, check the following:
  1. 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, but not all.
  2. 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 NI 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. 
    • The Function Reference Manual explains that the function for configuring the EOS termination mode or character is: ibeos. The parameter v describes the new EOS configuration to use, if it is zero then EOS is disabled. Otherwise, the low byte is the EOS and the upper byte contains flags which define the EOS mode. Table 1-7 from the manual describes the different EOS configuration and the corresponding values of v.

Additional Information

Most problems with GPIB instruments are due to either the physical setup (unable to detect the device) or the commands being sent (read/write).

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.