<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Retrieving GPIB Instrument error as c# exception in Measurement Studio for .NET Languages</title>
    <link>https://forums.ni.com/t5/Measurement-Studio-for-NET/Retrieving-GPIB-Instrument-error-as-c-exception/m-p/3235743#M17455</link>
    <description>A syntax error in the instrument command did not ever cause an EARG error. You always had to and always will have to query the instrument itself to see if the command was properly parsed. No GPIB or VISA driver could possibly contain each and every command set for each and every instrument made. Your expectations are very unreasonable. You will have to set your own error after querying the instrument. It's that simple.</description>
    <pubDate>Thu, 07 Jan 2016 03:45:46 GMT</pubDate>
    <dc:creator>Dennis_Knutson</dc:creator>
    <dc:date>2016-01-07T03:45:46Z</dc:date>
    <item>
      <title>Retrieving GPIB Instrument error as c# exception</title>
      <link>https://forums.ni.com/t5/Measurement-Studio-for-NET/Retrieving-GPIB-Instrument-error-as-c-exception/m-p/3231759#M17403</link>
      <description>&lt;P&gt;&lt;STRONG&gt;Goal&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Get any&amp;nbsp;errors from the GPIB card or Agilent DMM.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;For example, if a command string has a syntax error, say " &lt;SPAN&gt;TRIG:COUNT,1" instead of the correct " &lt;SPAN&gt;TRIG:COUNT 1", I want to capture that error.&lt;/SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Setup&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Windows 7 Pro 64 bit&lt;/P&gt;
&lt;P&gt;Visual Studio 2015, creating a Windows executable in c#.&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;NI-488.2 14.0&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;NI-488.2 Runtime 14.0.1&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;NI-488.2 Support for .NET 4.5&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;NI PCI-GPIB card, using driver&amp;nbsp;14.0.0.49152&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Agilent 34970A DMM/Switch Unit, GPIB address 10&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Current State&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;&lt;SPAN&gt;I can successfully run the SimpleReadWrite.2012 example that is included with the NI-488.2 Driver:&lt;/SPAN&gt;&lt;/LI&gt;
&lt;OL&gt;
&lt;LI&gt;[broken link removed]&lt;/LI&gt;
&lt;LI&gt;Driver installs these examples in:&amp;nbsp;C:\Users\Public\Documents\National Instruments\NI-488.2\Examples\DotNET4.5&lt;/LI&gt;
&lt;/OL&gt;
&lt;LI&gt;GPIB card (interface) errors are captured and show up in my MessageBox&lt;/LI&gt;
&lt;LI&gt;&lt;FONT color="#FF0000"&gt;GPIB instrument (device) errors are not seen by the&amp;nbsp;&lt;SPAN&gt;SimpleReadWrite.2012 example.&lt;/SPAN&gt;&lt;/FONT&gt;&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;&lt;SPAN&gt;Testing&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;&lt;SPAN&gt;To test for GPIB card (interface) errors, I disconnected the cable or used the wrong GPIB address. These errors were seen as exceptions by the&amp;nbsp;&lt;SPAN&gt;SimpleReadWrite.2012&lt;/SPAN&gt;.&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;SPAN&gt;To test for GPIB instrument (device) errors, I malformed the SCPI command (example:&amp;nbsp;&amp;nbsp;"&lt;SPAN&gt;ROUT:CHAN: DELAY 1" , with a space between the ":" and "DELAY"). This malformed command does show an error on the front panel of the Agilent DMM/Switch, but the software does not see it.&lt;BR /&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am not very experienced with OO/.NET, so this is hopefully a simple oversight on my part.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am used to using the "classic" ibfind and ibdev commands and returning and checking the value of ibsta to get the error conditions. I have attached a screenshot of the Intellisense of the device.write command, showing the Exceptions for this call:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;GpibException&lt;/LI&gt;
&lt;LI&gt;ObjectDisposedException&lt;/LI&gt;
&lt;LI&gt;DllNotFound&lt;SPAN&gt;Exception&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;EntryPointNotFound&lt;SPAN&gt;Exception&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;Argument&lt;SPAN&gt;Exception&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI&gt;InvalidOperation&lt;SPAN&gt;Exception&lt;/SPAN&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;I thought the last two items above would pass thru any GPIB instrument command issues, but maybe I misunderstand the purpose.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If more information is required, I will supply.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Pete_SDI&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 17 Oct 2025 18:18:47 GMT</pubDate>
      <guid>https://forums.ni.com/t5/Measurement-Studio-for-NET/Retrieving-GPIB-Instrument-error-as-c-exception/m-p/3231759#M17403</guid>
      <dc:creator>Pete_SDI</dc:creator>
      <dc:date>2025-10-17T18:18:47Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieving GPIB Instrument error as c# exception</title>
      <link>https://forums.ni.com/t5/Measurement-Studio-for-NET/Retrieving-GPIB-Instrument-error-as-c-exception/m-p/3231887#M17406</link>
      <description>You have not read the instrument's programming manual, apparently or not studied standard GPIB communication. You need to just issue the ERR? command to the instrument and read the results. The sending software has absolutely no way to tell if your command is not correct.</description>
      <pubDate>Mon, 21 Dec 2015 21:38:43 GMT</pubDate>
      <guid>https://forums.ni.com/t5/Measurement-Studio-for-NET/Retrieving-GPIB-Instrument-error-as-c-exception/m-p/3231887#M17406</guid>
      <dc:creator>Dennis_Knutson</dc:creator>
      <dc:date>2015-12-21T21:38:43Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieving GPIB Instrument error as c# exception</title>
      <link>https://forums.ni.com/t5/Measurement-Studio-for-NET/Retrieving-GPIB-Instrument-error-as-c-exception/m-p/3232099#M17409</link>
      <description>Additionally, if you don't want to use any of the existing drivers for the 34970, you should at least look at them. You should also use VISA and not the low level ib* commands. You would have something portable to all other physical connections.</description>
      <pubDate>Tue, 22 Dec 2015 14:26:18 GMT</pubDate>
      <guid>https://forums.ni.com/t5/Measurement-Studio-for-NET/Retrieving-GPIB-Instrument-error-as-c-exception/m-p/3232099#M17409</guid>
      <dc:creator>Dennis_Knutson</dc:creator>
      <dc:date>2015-12-22T14:26:18Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieving GPIB Instrument error as c# exception</title>
      <link>https://forums.ni.com/t5/Measurement-Studio-for-NET/Retrieving-GPIB-Instrument-error-as-c-exception/m-p/3232346#M17411</link>
      <description>&lt;P&gt;Mr. Knutson,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for the information; I apologize for my ignorance with these newer approaches.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I may not be an expert in the instrument manual, but I am trying to determine if the error lines on the GPIB have been set, which I thought would happen if there was a syntax error on the command sent to the instrument (I thought the instrument would set an the 2-byte status (ibsta?), then I could send the ERR? query).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I wasn't intending to use the low level ib* commands, but the serialPort class from the&amp;nbsp;System.IO.Ports &amp;amp;&amp;nbsp;NationalInstruments.NI4882. I am not clear if these are using VISA or not.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Pete&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 23 Dec 2015 00:30:39 GMT</pubDate>
      <guid>https://forums.ni.com/t5/Measurement-Studio-for-NET/Retrieving-GPIB-Instrument-error-as-c-exception/m-p/3232346#M17411</guid>
      <dc:creator>Pete_SDI</dc:creator>
      <dc:date>2015-12-23T00:30:39Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieving GPIB Instrument error as c# exception</title>
      <link>https://forums.ni.com/t5/Measurement-Studio-for-NET/Retrieving-GPIB-Instrument-error-as-c-exception/m-p/3232400#M17412</link>
      <description>VISA is not exactly new. It has been around for about 25 years. Is your experience really older than that? The code for the 34970 drivers from both NI and Keysight are based on the VISA standard. Calls to NI4882 just tired you to one vendor and to one physical connection type.</description>
      <pubDate>Wed, 23 Dec 2015 08:31:38 GMT</pubDate>
      <guid>https://forums.ni.com/t5/Measurement-Studio-for-NET/Retrieving-GPIB-Instrument-error-as-c-exception/m-p/3232400#M17412</guid>
      <dc:creator>Dennis_Knutson</dc:creator>
      <dc:date>2015-12-23T08:31:38Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieving GPIB Instrument error as c# exception</title>
      <link>https://forums.ni.com/t5/Measurement-Studio-for-NET/Retrieving-GPIB-Instrument-error-as-c-exception/m-p/3232632#M17413</link>
      <description>&lt;P&gt;No arguments about VISA being new.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have had problems with vendor-specific instrument drivers in the early 2000s (and the vendor specific versions of VISA, NI vs Tek, vs Agilent), but I am willing to try the NI 34970 VISA driver.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If I do, should I be using the VisaNS interface (the .NET approach)?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Or do you have another suggestion for using the VISA driver within a c# project?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Pete_SDI&lt;/P&gt;</description>
      <pubDate>Wed, 23 Dec 2015 19:06:27 GMT</pubDate>
      <guid>https://forums.ni.com/t5/Measurement-Studio-for-NET/Retrieving-GPIB-Instrument-error-as-c-exception/m-p/3232632#M17413</guid>
      <dc:creator>Pete_SDI</dc:creator>
      <dc:date>2015-12-23T19:06:27Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieving GPIB Instrument error as c# exception</title>
      <link>https://forums.ni.com/t5/Measurement-Studio-for-NET/Retrieving-GPIB-Instrument-error-as-c-exception/m-p/3232799#M17415</link>
      <description>&lt;P&gt;There is a tutorial at &lt;A href="https://knowledge.ni.com/KnowledgeArticleDetails?id=kA03q000000x2jLCAQ&amp;amp;l=en-US" target="_blank" rel="noopener"&gt;https://knowledge.ni.com/KnowledgeArticleDetails?id=kA03q000000x2jLCAQ&amp;amp;l=en-US&lt;/A&gt; that might help you. I have not checked to see if Keysight has an IVI-C, IVI-COM, or IVI-NET driver.&lt;/P&gt;</description>
      <pubDate>Fri, 17 Oct 2025 18:19:16 GMT</pubDate>
      <guid>https://forums.ni.com/t5/Measurement-Studio-for-NET/Retrieving-GPIB-Instrument-error-as-c-exception/m-p/3232799#M17415</guid>
      <dc:creator>Dennis_Knutson</dc:creator>
      <dc:date>2025-10-17T18:19:16Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieving GPIB Instrument error as c# exception</title>
      <link>https://forums.ni.com/t5/Measurement-Studio-for-NET/Retrieving-GPIB-Instrument-error-as-c-exception/m-p/3234872#M17430</link>
      <description>&lt;P&gt;Dennis,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for your help.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm working to increase my understanding of the returned status when sending a GPIB command in the new VS Classes for GPIB (NationalInstruments.NI4882, System.IO.Ports.SerialPort) versus the old way (ibwrt). &amp;nbsp;This newer way is using VISA underneath, I believe.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm pretty sure that the old way would show an argument error (for example, EARG (4), as shown in&amp;nbsp;&lt;A href="http://digital.ni.com/public.nsf/allkb/2FA525A8585A92E9862566EE002A3755)," target="_blank"&gt;http://digital.ni.com/public.nsf/allkb/2FA525A8585A92E9862566EE002A3755),&lt;/A&gt; but I'm having a problem seeing the error (exception?)&amp;nbsp;when using device.Write.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I will update this thread as a figure things out.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Jan 2016 16:16:02 GMT</pubDate>
      <guid>https://forums.ni.com/t5/Measurement-Studio-for-NET/Retrieving-GPIB-Instrument-error-as-c-exception/m-p/3234872#M17430</guid>
      <dc:creator>Pete_SDI</dc:creator>
      <dc:date>2016-01-05T16:16:02Z</dc:date>
    </item>
    <item>
      <title>Re: Retrieving GPIB Instrument error as c# exception</title>
      <link>https://forums.ni.com/t5/Measurement-Studio-for-NET/Retrieving-GPIB-Instrument-error-as-c-exception/m-p/3235743#M17455</link>
      <description>A syntax error in the instrument command did not ever cause an EARG error. You always had to and always will have to query the instrument itself to see if the command was properly parsed. No GPIB or VISA driver could possibly contain each and every command set for each and every instrument made. Your expectations are very unreasonable. You will have to set your own error after querying the instrument. It's that simple.</description>
      <pubDate>Thu, 07 Jan 2016 03:45:46 GMT</pubDate>
      <guid>https://forums.ni.com/t5/Measurement-Studio-for-NET/Retrieving-GPIB-Instrument-error-as-c-exception/m-p/3235743#M17455</guid>
      <dc:creator>Dennis_Knutson</dc:creator>
      <dc:date>2016-01-07T03:45:46Z</dc:date>
    </item>
  </channel>
</rss>

