Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

Method requires GPIB interface to be CIC

I have a C# app that is using the USB GPIB interface to a device. When I try and execute the following code I get the error contained in the subject of this message. If I use the ethernet interface, then this code runs properly without error.

using NationalInstruments.NI4882;
Board GpibBoard = new Board();

Address addr = new Address((byte)address);
val = GpibBoard.FindListener(addr);

Any help would be greatly appreciated.
0 Kudos
Message 1 of 9
(7,262 Views)
Hi PJ,
I'd like to get a little more information from you so we can determine the source of your problem. First off, you mentioned using both a GPIB-USB connection and an Ethernet connection - do you have a GPIB-ENET device connected to the same computer as the GPIB USB device? Second, is the code you posted below exactly the code that you run for both the USB and ENET device, or are you qualifying the construction of the board object with a board index to differentiate between them? Note that calling the default Board constructor always gives you a Board object connected to Board 0 - which is fine if you only have one controller on your computer, and a little confusing if you have more than one. And finally, are both your USB and ENET controller hooked to the same set of instruments (effectively connecting the two controllers?) Having two controllers connected together can cause problems because they both try to assert network control. In your case, the GPIB-ENET device could already have asserted Controller in Charge (CIC), and so the USB device get CIC, which is needed to look for listeners. If both devices are connected, try disconnecting the GPIB-ENET controller from the network and check that the USB device is able to perform a FindListener operation.

And if my assumptions about your GPIB network are off base, let me know and we'll see what else we can do.

Glenn Burnside
0 Kudos
Message 2 of 9
(7,242 Views)
Glen, thanks for the response.

The GPIB-ENET device is not connected to the same computer as the GPIB-USB device.

The posted code is exactly the same for both devices. We are using the default board constructor since we only have one controller per computer.

The USB and ENET controllers are not connected to the same equipment.

PJ
0 Kudos
Message 3 of 9
(7,232 Views)
Ok, I have the fix but I do believe it to be a bug at the same time. This code works as required without error, but I am trying to determine if a device exists on a board before I try and instantiate it by searching for a listener. It dosen't make sense to me that I am required to create a device, when I don't know if it exists or not, just to search an address to find a listener.

using NationalInstruments.NI4882;
Board GpibBoard = new Board();

*** Added Line of Code ***
Device Dev = new Device(0,0);
***

Address addr = new Address((byte)address);
val = GpibBoard.FindListener(addr);
0 Kudos
Message 4 of 9
(7,230 Views)
Are you sure you have all your software installed correctly? The zip file attached below includes a C# .NET project that I built, based around the code in your original post using a GPIB-USB-A. I was able to run my application without any errors. Check out my application, and see if it runs for you.

Logan S.
0 Kudos
Message 5 of 9
(7,197 Views)
Your example works only if device address is 0, that returns a listener. But if I chose 18 which is where my device is located, I get the same error as stated above.
0 Kudos
Message 6 of 9
(7,189 Views)
I am sorry this example did not work for you. Did you follow the following considerations:

Board GpibBoard = new Board(a); /*where 'a' is the GPIB Device. If you look in MAX, and see that your GPIB-USB device is listed as GPIB0, then 'a' must be '0' in order for anything to work. If your device is listed as GPIB1, 'a' must be '1' in order for anything else to work, etc...*/

Address addr = new Address(b); /*where 'b' is any value between 0 and 127. If you have multiple devices with the same address, it may only find one instrument, and "Scan for instruments" in MAX will fail. If the all devices are configured to have different addresses, then this application will find listeners at the addresses specified if there is a device configured with that address.*/

val = GpibBoard.FindListener(addr);

I was able to run this with multiple different GPIB interfaces, with multiple configurations of connected devices, and never got an error.

A few things to try:
Have you verified that you can communicate with your devices in MAX? If everything is installed correctly, you should be able to find your device in MAX, Scan for instruments, and find all the instruments attached to your GPIB-USB. If your instrument is successfully found, then you should be able to right click on the instrument, and choose communicate with instrument, and do so. If all this is successfully working, we then need to double check your installation of software such as NI 488.2, or other application software.
0 Kudos
Message 7 of 9
(7,169 Views)
I ran into the same problem as the original poster. This thread is still the #1 google hit for "method requires gpib interface to be cic", but it doesn't really have a satisfying answer.

It seems that the following code fixes the problem for me:

Board board = new Board(i); // i is whatever board number you want

board.SendInterfaceClear(); // this line makes the board in the the CIC ("Controller in charge"). I got a hint that this was the case from http://www.ni.com/pdf/manuals/370428a.pdf

AddressCollection listeners = board.FindListeners(); // this line should now work as advertised.
Message 8 of 9
(6,595 Views)

I had the same error. I found mine was caused by the unit I was connecting to being set as the system controller in the GPIB settings. I set it to addressable only and it works now.

0 Kudos
Message 9 of 9
(2,806 Views)