10-03-2007 04:24 PM
05-19-2013 07:40 AM
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)?
05-19-2013 08:32 AM
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.
05-20-2013 06:36 PM
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.
05-21-2013 06:38 AM
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
05-22-2013 06:46 PM
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.