Academic Company Events Community Support Solutions Products & Services Contact NI MyNI

Legacy: Introduction to the Interactive Control (IBIC)

IBIC stands for Interface Bus Interactive Control program. This utility allows you to use a subset of the NI-488 and NI-488.2 functions and routines, respectively, to communicate with the GPIB. By entering various commands via the computer keyboard, this feature will help you learn how to communicate with GPIB devices, learn how to troubleshoot problems, and learn the syntax and order of events required in developing your own GPIB application. Most 488 commands are valid calls in IBIC.

How do I open IBIC?

IBIC Window

Initial Troubleshooting
For initial troubleshooting, try the following commands after opening IBIC:

: ibfind gpib0 Initiate board level communication with the GPIB board. gpib0 is the default interface name of the first National Instruments GPIB board, that you install in your computer. Subsequent boards will have similar interface names that increment the board index. For example, the second board that you install will be gpib1, the third board will be gpib2, etc.

gpib0: ibpad 0 Confirm that the board's primary address is 0. This is the default primary address of all National Instruments GPIB boards. Do not confuse the primary address of your GPIB board with the primary address of your instrument. Like houses on a street, each device on the GPIB will have a unique address.

gpib0: ibrsc 1 This command requests system control for your GPIB board. It confirms that the board is the system controller (the ultimate authority on the bus).

gpib0: ibsic This sends an "interface clear" to remove old errors and assert that the board is the controller-in-charge. This resets the bus.

gpib0: ibsre 1 This is the "set remote enable" command. If you have an instrument that must have the Remote Enable line asserted when you send it commands, then this will enable that option. Not all devices require this, but it usually does not hurt to use this command. This is an OPTIONAL command.

gpib0: ibln PAD SAD
Note: PAD and SAD must be replaced with appropriate primary address and secondary address of the instrument.
This command looks for listeners on the bus at the primary address (PAD) and the secondary address (SAD) listed, where PAD is an integer between 1 and 30. SAD is usually 0 (for "None"). If no device is found, then make sure the device is powered on, connected to the bus, and at the primary address specified.

gpib0: ibdev 0 PAD SAD 13 1 0x140A
Note: PAD and SAD must be replaced with appropriate primary address and secondary address of the instrument.
Initiate device level communication with the instrument at primary address PAD. This command will change the prompt from gpib0: to ud0:. (Every time you use this command, you will get a new ud# prompt. ud stands for "unit descriptor".)

The parameters in this commmand represent the following information:

0   This is the board index. For most GPIB boards this will be 0 (zero), but it depends on the interface name. For example, gpib0 has a board index of 0, gpib1 has a board index of 1, etc.

PAD   This is the primary address of the instrument, not the board.

SAD   This is the secondary address of the instrument (not the board), which is typically 0 (for "None").

13   This is the timeout value for communications. The number corresponds to a table of possible values, so the number 13 does not mean 13 seconds; it represents a 10 second timeout.

1   This is the "flag" for using EOI (End Or Identify) as the termination method. A 1 means that EOI is used, while a 0 means that EOI is not used.

0   This is the "flag" for using EOS (End Of String) as the termination method. A 0 means that no EOS character is used. To specify the EOS termination mode and character, do the following. The low byte of this flag is the termination character. For example, a 0x0A or decimal 10 represents the linefeed character, and a 0x0D or decimal 13 represents the carriage return character. Refer to the table below to determine the high byte.

High Byte Terminate read when EOS is detected.
00000100 Set EOI with EOS on write function.
00001000 Compare all 8 bits of EOS byte rather than low 7 bits (all read and write calls).
00010000 For instance, 0x140A or decimal 1034 means that the reads will terminate when the linefeed character is detected.

Note: If you use EOS as the termination method, then you must still append the termination character to your messages, the NI-488.2 driver will not add it for you automatically!

ud0: ibwrt "*idn?" This command writes a data message to the device identified as ud0. In this case, *idn? is an identification query that is understood by devices that support the SCPI command set (an extension of the 488.2 command set). Not all devices support SCPI. If the instrument understands the *idn? message, then it will respond with its identification string.

Note: If you use EOS as the termination method, then your message would be *idn?TC, where TC represents the termination character. For example, if linefeed is your termination character, then you would send *idn?\n, where \n is the way IBIC represents a linefeed. (Similarly, you would use *idn?\r, if your EOS character is a carriage return.)

Each write command should return [0100], which is the GPIB status word (two bytes, in hex). Status words of less than [8000] indicate that the command executed successfully, otherwise an error occurred. The write commands will also return a count: #, which is the number of bytes sent in the message. In this case, the value of count should be 5.

ud0: ibrd 100 This command reads data messages from the device. 100 is the maximum number of bytes you expect to receive from the device (you can specify any integer number, you don't have to use 100). The actual number of bytes received from the device will depend on the message it sends, of course.

The read command has three possible termination methods: (1) the EOI line can assert to indicate that the device is done sending data (this is the default method), (2) the device can send an EOS character, one that was specified in the ibdev command (in this case, there was no EOS character specified in the ibdev call), or (3) the number of bytes to expect is reached (this is known as the "count" method). Any or all of these methods can be used to terminate data transfer. See your GPIB Reference Manual for more information.

This should return identification information about the device. If the program waits, it is waiting for a response from the device, and will wait 10 seconds before giving up (timing out). If the device times out, then there was no information placed in the buffer of the device, so either it didn't understand the write command, or there is a problem with the board, the device, or the cable.

Note: The ibonl command is used to close down the unit descriptors after you are done using them. You should call ibonl at the end of your application, once for each call you made to ibdev or ibfind. It is used this way:

    ud0: ibonl 0

Another useful command that is only available in IBIC is the set command. You can use this command to switch between device-level (the ud0: prompt) and board-level (the gpib0: prompt) communication like this:

    ud0: set gpib0

Finding Listeners
You can also have ibic find all listeners. However, this is an IEEE 488.2 command, so you must have a GPIB board (post-1990) that can support IEEE 488.2 commands.

: set 488.2 0 This activates IEEE 488.2 commands; 0 is the board index.

488.2 (0): SendIFC This sends the "interface clear" command, which makes gpib0 the controller-in-charge (CIC).

488.2 (0): FindLstn This is the find listeners command. Unlike its 488.1 counterpart, ibln, this function will allow you specify an address list, so that you can locate multiple listeners at the same time.

enter address list: 0, 1, 2, 3, 4, 5 (possible addresses for devices, numbers between 0 and 30, separated by commas)

enter 'limit' number: 3 (maximum number of devices ibic will look for)

[0130] ( cmpl cic atn ) (transaction completed, board is controller in charge, attention asserted)

count: 2 (count is the number of listeners found)

In this example the FindLstn command found two listeners: the GPIB board at PAD 0 and an instrument at PAD 2.

This will help you determine if any devices are listening and what their addresses are. At this point you can use set gpib0 to go back to 488.1 commands and direct communication with your GPIB board.

Exiting IBIC

    ud0: quit (this quits ibic)

Other Troubleshooting Tips
If IBIC fails, then try a different cable or a different instrument. The problem may simply be a bad connection or a misunderstood command.

  • Solutions to Common Errors

  • Use our Request Support page to contact National Instruments for assistance. Please mention what happened when you followed the troubleshooting advice given here, as well as any errors that you may have seen.

Related Links
For more information about the commands used in the preceeding instructions, please refer to the following resources:

Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality?   Answered Your Question? 
  1 2 3 4 5
Please Provide Additional Feedback below
Please visit Request Support for product support inquiries. submit