… from Appl Note 117

Using the Interactive Control to Get Started

The interactive control utility, also know as Interface Bus Interactive Control (IBIC), is a standard software utility included with National Instruments  GPIB controller  products. Using your computer keyboard, you can use this powerful development and debugging tool to interactively communicate (read, write, serial poll, etc.) with your GPIB instruments. With the interactive control utility, you can speed up application development by learning how to automate measurements with your instruments, uncover GPIB problems, and avoid headaches by identifying malfunctioning instruments. For Windows platforms, the interactive control utility comes complete with on-line help that describes the applicable NI-488 functions and NI-488.2 routines, syntax, error codes, and status variables that provide you with the debugging information you need to solve problems.

Typically, your first challenge in interacting with a GPIB instrument is determining its GPIB address. A fast way of accomplishing this is to use the interactive control utility. Two commands that are especially useful in getting started are findlstn and ibln.

For a detailed discussion on how to use the interactive control utility and the functions used in the examples, refer to the GPIB user and GPIB function reference manuals, respectively, that came with your GPIB controller.The following sections assume a basic knowledge of the interactive control utility and GPIB.

Quickly Determining GPIB Addresses

The "find all listeners" command, findlstn, is a 488.2 command that searches GPIB and first determines the number of listeners that are active on the bus; it then finds the GPIB address at which each listener resides. Findlstn can detect both 488.1 and 488.2 devices. The syntax for findlstn is as follows:

findlstn address_list limit_number
address_list = The possible addresses for connected instruments, ranging from 1 to 30, separated by commas
limit_number = The maximum number of instruments to search for
For instruments to be recognized, they must be powered on and connected to the GPIB controller via cable. If you have two or more instruments on the bus, you can disconnect all instruments except one to determine its address. By isolating each instrument on the bus and repeatedly running the findlstn command, you can quickly determine the address of each instrument. You could also execute findlstn once and then query each instrument for its identification (ID) string to match each instrument with its address. ID querying is discussed in a section to follow.
The following is an example of how to use the findlstn command. Suppose you had one instrument on the bus at address 5. You could use the following sequence of commands with the interactive control utility. Bold type represents the prompt, and status codes have been omitted because it is assumed the commands complete successfully. Commands are followed by pressing the "Enter" key or an equivalent key on your keyboard. The comments in parenthesis explain each step:
(This is the prompt when you first enter the interactive control utility)
: set 488.2
(This command activates 488.2 mode)
488.2 (0): sendifc
(This command sends the interface clear, and makes board 0 the controller in charge. The interface clear is sent to initialize the system. At any given time, there is one controller in charge (CIC) on the bus. CIC orchestrates communication over the bus addressing devices to talk and listen when appropriate.)
488.2 (0): findlstn
enter address list: 1,2,3,4,5,6,7,8
(Possible addresses for the instrument)
enter 'limit' number: 1
(The maximum number of instruments to search for)
The response you get is as follows. "Count" tells you the number of listening instruments on the bus and "listeners" tells you the address of the instrument(s):
count: 1
(count is the number of listeners found)
listeners: 5

Establishing Communication with Your Instruments

Once you have determined the GPIB address of your instruments, it is easy to establish communications to verify that you can send and receive data to and from the instrument. Because most instruments are 488.2 compliant, you can query the instrument for its identification by sending it "*IDN?". Instruments will typically respond with the manufacturer’s name, model name, and various alphanumeric characters that the manufacturer uses to track firmware revisions.
To communicate with our fictitious instrument at address 5, you would enter the following sequence of commands. Note that ibdev is a function used to open a session to an instrument. Ibwrt and ibrd are used to write data and read data, respectively, from instruments. Refer to your function reference manual to learn about the usage and parameters for these functions.

(This is the prompt when you first enter the interactive control utility)
: ibfind gpib0
(Place board 0 online and open a session)
gpib0: ibsic
(This command sends the interface clear, and makes board 0 the controller in charge)
gpib0: ibdev
enter board index: 0
enter primary address: 5
enter secondary address: 0
timeout: 13
enter 'EOI on last byte' flag: 1
enter end-of-string mode/byte: 0
(This command opens a session to the device at address 5)
ud0: ibwrt "*IDN?"
(ud0 is the new device level prompt for talking directly with your instrument. Send the 488.2 instrument a *IDN? to
query for its identification. You will need to consult the documentation for a 488.1 instrument to find an appropriate
command that provides data that can be read back from the instrument. 488.1 devices do not typically respond to a
ud0: ibrd 100
(Read 100 bytes back from the instrument – in this case the identification string for the instrument)
An Easy Way to Troubleshoot Instrument, Cable, and Power Problems

Many times systems are powered down and cables are disconnected from instruments for maintenance or to change the configuration of the system. Unfortunately, engineers sometimes forget to reconnect all the cables and power up all the instruments. Alternatively, system power may be disrupted for a variety of reasons or the actual instrument may begin to malfunction. Ibln is a convenient function for verifying that your instruments are still "alive" on the bus. Simply use the function to check if a particular instrument is listening at its assigned GPIB address. If it is not, then you know to check cables, power, and verify that the instrument is working properly.

The syntax for ibln is as follows:

ibln primary_address secondary_address
primary_address = The primary GPIB address
secondary_address = The secondary GPIB address
This function can detect both 488.1 and 488.2 instruments. Also, because most instruments do not use a secondary address, the value 0 is used to specify no secondary address.
As an example, suppose you had an instrument at address 10. You would use the following sequence to verify that it is still alive on the bus:
(This is the prompt when you first enter the interactive control utility)
:ibfind gpib0
(Place board 0 online and open a session)
gpib0: ibsic
(This command sends the interface clear, and makes board 0 the controller in charge)
gpib0: ibln 10 0
(Check for an instrument listening at address 10)
If the device is alive on the bus, you get the following response:
Listen: TRUE
If there was a problem you would get "Listen: FALSE" notifying you to check for loose or disconnected cables, power disruption, or a malfunctioning instrument.

The basic functions and concepts described above may seem simplistic; however they can be invaluable in trouble-shooting and getting your GPIB system up and running. These productivity tools help you focus on developing your test applications to avoid frustration in trying to track down obscure problems or establishing communications with your instruments.

... introduction to the Interactive Control Utility, 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.

IBIC Window

(1) For initial troubleshooting, try the following commands after opening IBIC:

: ibfind gpib0(this opens the board for board level commands)
gpib0: ibpad 0(set the board's primary address to 0)
gpib0: ibrsc 1(configure the board as system controller)
gpib0: ibsic(set interface clear to remove old errors and become controller-in-charge)
gpib0: ibsre 1(place devices in remote programming mode)
gpib0: ibln PAD 0 (Find device at primary address PAD, where PAD is an integer between 1 and 30. This must return true before proceeding. If it returns false, verify that the device is powered on, connected to the bus, and at the address specified.)
gpib0: ibdev 0 PAD 0 13 1 0 (PAD is the primary address of your device that you verified in the last step)
ud0: (this new prompt is at the device level; ud is unit descriptor, increments as you open more devices)
ud0: ibwrt "*idn?"(*idn? is an identification command understood by many devices, but not all)
[0100] (status is returned after each call. Values less than 8000 indicate successful completion)
count: 5 (this is the number of bytes sent on the command, and indicates the device "handshook" that many times so it accepted the data)
ibrd 100 (reads from device, up to 100 characters)
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 it didn't understand the write command) or there is another problem with the board, device, or cables.

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

ud0: ibonl 0
(2) You can also have IBIC find all listeners. However, this is a 488.2 command so you must have a board (post-1990) which can support the commands.
: set 488.2 0(activates 488.2 commands; 0 is board index)
488.2 (0): SendIFC(clears the interface, makes gpib0 the Controller In Charge - CIC)
488.2 (0): FindLstn
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
listeners:    0 (controller's address)
                     2 (device's address)
This will help you determine if any devices are listening and what their addresses are. At this point you can use ibfind or ibdev to go back to regular commands.
ud0: quit(this quits ibic)
If IBIC fails, try a different cable or a different instrument. (Otherwise, call Nat Instr technical support)

Status registers ease IEEE 488.2 device control

  |   GPIB Troubleshooting Resources