Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I make system board the controller in charge

Hi,  I am using visual Studio 2005 C++/CLI.  I have one machine at my desk that is a Windows 2000 machine with an Agilent GPIB board installed.  The Agilent board has been setup to accept NI-4882.NET commands.  I have written an application that, among other things, scan the GPIB bus for devices.  This works well on the machine at my desk.  I have another machine out in the lab that is running Windows XP and has an NI-488.2 GPIB board installed.  When run the application and try to scan the GPIB bus I get an National Instruments exception that "Method requires GPIB interface to be CIC".  I used Measurement and Automation Explorer  to see that the 'System Controller' checkbox was checked and I added a line of code "board->IsSystemController = true" after the board was instantiated with no change and also tried board->BecomeActiveController(true) with no change.  Any Idea on why this error is comming up only on the other platform?
 
Board^ board = gcnew Board(0);
AddressCollection^ addresses =  board->FindListeners(); //  This line is causing the error to occur
 
Thanks
0 Kudos
Message 1 of 6
(4,647 Views)

I have the exact same problem and I have tried the same solutions without success.

Why is there no answer to this question (posted in 2007)?

0 Kudos
Message 2 of 6
(3,988 Views)

I found something that forces the GPIB board to be CIC..."SendInterfaceClear()" method of 'Board'.

I don't like this though because this causes devices on the bus to change state.

All I want to do when my program starts is to begin controlling.  I don't want instruments to be clearing out their previous settings.

 

 

0 Kudos
Message 3 of 6
(3,985 Views)

Hi phmoore, 

 

Are you trying to have two controllers on the same GPIB bus?  There can only be one CIC at a time.  Try to get your setup working in MAX by sending basic commands in a VISA test panel, then incorporate your program.

0 Kudos
Message 4 of 6
(3,952 Views)

I have only one controller on the bus.  I can run my instruments through NiMax with no problems using "communicate with instrument".  Only when I run this simple code does the problem appear.  You can see where I had to add the "SendInterfaceClear()" to prevent a "not CIC" exception from the "FoundListeners" method. (VisualStudio C# on WindowsXP using NI488 DLL's)

 

namespace Scanner34970

{     public partial class Main : Form    

 {         public Main()        

           {        InitializeComponent();            

                    List<int> BoardNums = new List<int>();            

                    List<AddressCollection> FoundListeners = new List<AddressCollection>();

                    for(int i=0; i<10;i++)            

                    {                

                     try{

                         Board CommBoard = new Board(i);

                         CommBoard.SendInterfaceClear(); // must do this to become CIC                    

                         BoardNums.Add(i); // add to list of found boards

                         FoundListeners.Add( CommBoard.FindListeners()); // add devices to list of found devices.                    

                         CommBoard.Dispose(); // get rid of it.                

                         }

                    catch(Exception exc)

                    {

                         textBox_status.AppendText(exc.Message);                    

                         textBox_status.AppendText(string.Format(" for Board#{0}" + Environment.NewLine, i));                

                    }

              }

... // more code

          

0 Kudos
Message 5 of 6
(3,944 Views)

Hi phmoore, 

 

Have you referenced any examples?  NI-VISA and NI-488.2 include some pre-built examples that you can use as a template. Take a look in the directory....

 

C:\Users\Public\Public Documents\National Instruments\

 

In either the NI-VISA or the NI-488.2 directory there should be and Examples folder with some text based examples to follow.

 

Unfortunately, my C# knowledge is lackluster, but if I were you I would definitely look for some reference material.

0 Kudos
Message 6 of 6
(3,926 Views)