AnsweredAssumed Answered

VISA COM Interop Example returning "Unexpected I/O data termination" except

Question asked by tgoodhew on Mar 5, 2016
Latest reply on Mar 25, 2016 by tgoodhew
Hi there,

My apologies if this isn't the best forum - Please point me to the right place if that is the case.

I'm trying to talk to a 53131A which has the GPIB address "GPIB0::8::INSTR". I'm using the sample code from the "Using VISA COM I/O API in .NET" App Note:

        private void DoInstrumentIO()
        {
            Ivi.Visa.Interop.ResourceManagerClass rm = new Ivi.Visa.Interop.ResourceManagerClass();
            Ivi.Visa.Interop.FormattedIO488Class ioobj = new Ivi.Visa.Interop.FormattedIO488Class();

            try
            {
                object[] idnItems;
                ioobj.IO = (Ivi.Visa.Interop.IMessage)rm.Open("GPIB0::8::INSTR", Ivi.Visa.Interop.AccessMode.NO_LOCK, 0, "");
                ioobj.WriteString("*IDN ?", true);
                idnItems = (object[])ioobj.ReadList(Ivi.Visa.Interop.IEEEASCIIType.ASCIIType_Any, ",");
                foreach (object idnItem in idnItems)
                {
                    System.Console.Out.WriteLine("IDN Item of type " + idnItem.GetType().ToString());
                    System.Console.Out.WriteLine("\tValue of item is " + idnItem.ToString());
                }
            }
            catch (Exception e)
            {
                System.Console.Out.WriteLine("An error occurred: " + e.Message);
            }
            finally
            {
                try { ioobj.IO.Close(); } catch { }
                try { System.Runtime.InteropServices.Marshal.ReleaseComObject(ioobj); } catch { }
                try { System.Runtime.InteropServices.Marshal.ReleaseComObject(rm); } catch { }
            }
        }

On the ReadList call it's throwing an exception saying "Unexpected I/O data termination".

I'm a complete NOOB in terms of using this API and I can't find any documentation or comments on this exception so any guidance appreciated.

Environment is:

Windows 10 Pro
Visual Studio 2015 Update 1
IO Suite 17.2
Agilent 82357B GPIB to USB Adapter
Windows Form App targeting .NET Framework 4.5.2

Thanks,

TonyG  

Outcomes