<?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: How do I read from a gpib device in Visual Basic in Instrument Control (GPIB, Serial, VISA, IVI)</title>
    <link>https://ni.lithium.com/t5/Instrument-Control-GPIB-Serial/How-do-I-read-from-a-gpib-device-in-Visual-Basic/m-p/1074669#M40586</link>
    <description>&lt;P style="margin: 0in 0in 0pt" class="MsoNormal"&gt;&lt;FONT face="Times New Roman" size="3" color="#000000"&gt;Thanks for your help, I have been working with this some more. The device is a Hewlett Packard model 431B microwave power meter. The signal source is the reference (calibration) oscillator which is turned on by “OC1”. At this time the device is in remote-&lt;STRONG&gt;LISTEN&lt;/STRONG&gt;. As soon as the PowerMeter.ReadString (PowerLevel) cmd is sent the device switches to &lt;STRONG&gt;TALK&lt;/STRONG&gt; but when the MsgBox comes up the power level string is not displayed. I have been through the manual and reviewed the command set. There is no actual “READ” command that I can discover. If I try to send PowerMeter.Write (“READ”) the device thinks it’s the &lt;STRONG&gt;RE&lt;/STRONG&gt;solution command and responds accordingly. &lt;/FONT&gt;&lt;/P&gt;&lt;FONT face="Times New Roman" size="3" color="#000000"&gt;&amp;nbsp;&lt;/FONT&gt; &lt;P style="margin: 0in 0in 0pt" class="MsoNormal"&gt;&lt;FONT face="Times New Roman" size="3" color="#000000"&gt;I have addressed the device in the Interactive Control mode of the NI488.2 with the&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;STRONG&gt;ibrd 11&lt;/STRONG&gt; command&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;and the display string is returned perfectly, so that works. I just don’t know what is different.&lt;/FONT&gt;&lt;/P&gt;&lt;FONT face="Times New Roman" size="3" color="#000000"&gt;&amp;nbsp;&lt;/FONT&gt; &lt;P style="margin: 0in 0in 0pt" class="MsoNormal"&gt;&lt;FONT face="Times New Roman" size="3" color="#000000"&gt;The PowerMeter.Wait command causes problems. I can’t get the syntax right so I left it out. Please see example.&lt;IMG src="http://forums.ni.com/t5/image/serverpage/image-id/10933i6098ABAC84DF6163/image-size/original?v=mpbl-1&amp;amp;px=-1" border="0" alt="POWER METER READ-2.jpg" title="POWER METER READ-2.jpg" align="center" /&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 18 Feb 2010 16:28:28 GMT</pubDate>
    <dc:creator>TesTech</dc:creator>
    <dc:date>2010-02-18T16:28:28Z</dc:date>
    <item>
      <title>How do I read from a gpib device in Visual Basic</title>
      <link>https://ni.lithium.com/t5/Instrument-Control-GPIB-Serial/How-do-I-read-from-a-gpib-device-in-Visual-Basic/m-p/1073146#M40559</link>
      <description>&lt;P&gt;I'm having trouble reading from my device. Can anyone give me an example so I can correct my code?&lt;IMG src="http://forums.ni.com/t5/image/serverpage/image-id/10829i238A199CEE996C5D/image-size/original?v=mpbl-1&amp;amp;px=-1" border="0" alt="POWER METER READ.jpg" title="POWER METER READ.jpg" align="center" /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Feb 2010 16:53:49 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/Instrument-Control-GPIB-Serial/How-do-I-read-from-a-gpib-device-in-Visual-Basic/m-p/1073146#M40559</guid>
      <dc:creator>TesTech</dc:creator>
      <dc:date>2010-02-16T16:53:49Z</dc:date>
    </item>
    <item>
      <title>Re: How do I read from a gpib device in Visual Basic</title>
      <link>https://ni.lithium.com/t5/Instrument-Control-GPIB-Serial/How-do-I-read-from-a-gpib-device-in-Visual-Basic/m-p/1073155#M40560</link>
      <description>I think that all you have to do is write a command to the instrument to perform a measurement before you do a read. You do not mention the make and model of the instrument so you will have to study the manual. If the instrument uses SCPI, then the command will terminate with a '?'. This tells the instrument to read and place the results in the output buffer. Until you do something like that, the output buffer is empty.</description>
      <pubDate>Tue, 16 Feb 2010 17:05:40 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/Instrument-Control-GPIB-Serial/How-do-I-read-from-a-gpib-device-in-Visual-Basic/m-p/1073155#M40560</guid>
      <dc:creator>Dennis_Knutson</dc:creator>
      <dc:date>2010-02-16T17:05:40Z</dc:date>
    </item>
    <item>
      <title>Re: How do I read from a gpib device in Visual Basic</title>
      <link>https://ni.lithium.com/t5/Instrument-Control-GPIB-Serial/How-do-I-read-from-a-gpib-device-in-Visual-Basic/m-p/1073156#M40561</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I don't know what type of instrument you're using, but you probably need to send it a read or measure command, then wait for the command to to be processed and then get the data.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;maybe something like...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;PowerMeter.Write("Read?")&lt;/P&gt;&lt;P&gt;PowerMeter.WaitForCommandComplete&lt;/P&gt;&lt;P&gt;PowerMeter.ReadString(strData)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Try that&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Curt&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Feb 2010 17:08:42 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/Instrument-Control-GPIB-Serial/How-do-I-read-from-a-gpib-device-in-Visual-Basic/m-p/1073156#M40561</guid>
      <dc:creator>Curt_C</dc:creator>
      <dc:date>2010-02-16T17:08:42Z</dc:date>
    </item>
    <item>
      <title>Re: How do I read from a gpib device in Visual Basic</title>
      <link>https://ni.lithium.com/t5/Instrument-Control-GPIB-Serial/How-do-I-read-from-a-gpib-device-in-Visual-Basic/m-p/1074669#M40586</link>
      <description>&lt;P style="margin: 0in 0in 0pt" class="MsoNormal"&gt;&lt;FONT face="Times New Roman" size="3" color="#000000"&gt;Thanks for your help, I have been working with this some more. The device is a Hewlett Packard model 431B microwave power meter. The signal source is the reference (calibration) oscillator which is turned on by “OC1”. At this time the device is in remote-&lt;STRONG&gt;LISTEN&lt;/STRONG&gt;. As soon as the PowerMeter.ReadString (PowerLevel) cmd is sent the device switches to &lt;STRONG&gt;TALK&lt;/STRONG&gt; but when the MsgBox comes up the power level string is not displayed. I have been through the manual and reviewed the command set. There is no actual “READ” command that I can discover. If I try to send PowerMeter.Write (“READ”) the device thinks it’s the &lt;STRONG&gt;RE&lt;/STRONG&gt;solution command and responds accordingly. &lt;/FONT&gt;&lt;/P&gt;&lt;FONT face="Times New Roman" size="3" color="#000000"&gt;&amp;nbsp;&lt;/FONT&gt; &lt;P style="margin: 0in 0in 0pt" class="MsoNormal"&gt;&lt;FONT face="Times New Roman" size="3" color="#000000"&gt;I have addressed the device in the Interactive Control mode of the NI488.2 with the&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;STRONG&gt;ibrd 11&lt;/STRONG&gt; command&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;and the display string is returned perfectly, so that works. I just don’t know what is different.&lt;/FONT&gt;&lt;/P&gt;&lt;FONT face="Times New Roman" size="3" color="#000000"&gt;&amp;nbsp;&lt;/FONT&gt; &lt;P style="margin: 0in 0in 0pt" class="MsoNormal"&gt;&lt;FONT face="Times New Roman" size="3" color="#000000"&gt;The PowerMeter.Wait command causes problems. I can’t get the syntax right so I left it out. Please see example.&lt;IMG src="http://forums.ni.com/t5/image/serverpage/image-id/10933i6098ABAC84DF6163/image-size/original?v=mpbl-1&amp;amp;px=-1" border="0" alt="POWER METER READ-2.jpg" title="POWER METER READ-2.jpg" align="center" /&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Feb 2010 16:28:28 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/Instrument-Control-GPIB-Serial/How-do-I-read-from-a-gpib-device-in-Visual-Basic/m-p/1074669#M40586</guid>
      <dc:creator>TesTech</dc:creator>
      <dc:date>2010-02-18T16:28:28Z</dc:date>
    </item>
    <item>
      <title>Re: How do I read from a gpib device in Visual Basic</title>
      <link>https://ni.lithium.com/t5/Instrument-Control-GPIB-Serial/How-do-I-read-from-a-gpib-device-in-Visual-Basic/m-p/1074728#M40588</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You need to send some sort of trigger command to the device to start a measurement and load data into the output buffer so you can then read it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Try writing one of these commands before you use the ReadString method...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;"GET"&lt;/P&gt;&lt;P&gt;"GT1"&lt;/P&gt;&lt;P&gt;"GT2"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;or &lt;/P&gt;&lt;P&gt;"TR1"&lt;/P&gt;&lt;P&gt;"TR2"&lt;/P&gt;&lt;P&gt;"TR3"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope this helps&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Curt&lt;/P&gt;</description>
      <pubDate>Thu, 18 Feb 2010 17:28:31 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/Instrument-Control-GPIB-Serial/How-do-I-read-from-a-gpib-device-in-Visual-Basic/m-p/1074728#M40588</guid>
      <dc:creator>Curt_C</dc:creator>
      <dc:date>2010-02-18T17:28:31Z</dc:date>
    </item>
    <item>
      <title>Re: How do I read from a gpib device in Visual Basic</title>
      <link>https://ni.lithium.com/t5/Instrument-Control-GPIB-Serial/How-do-I-read-from-a-gpib-device-in-Visual-Basic/m-p/1074733#M40589</link>
      <description>What you could also do is perform NI-Spy captures of your interactive session and the VB code. You can attach them here.</description>
      <pubDate>Thu, 18 Feb 2010 17:34:43 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/Instrument-Control-GPIB-Serial/How-do-I-read-from-a-gpib-device-in-Visual-Basic/m-p/1074733#M40589</guid>
      <dc:creator>Dennis_Knutson</dc:creator>
      <dc:date>2010-02-18T17:34:43Z</dc:date>
    </item>
    <item>
      <title>Re: How do I read from a gpib device in Visual Basic</title>
      <link>https://ni.lithium.com/t5/Instrument-Control-GPIB-Serial/How-do-I-read-from-a-gpib-device-in-Visual-Basic/m-p/1075691#M40629</link>
      <description>&lt;P style="margin: 0in 0in 0pt" class="MsoNormal"&gt;&lt;FONT face="Times New Roman" size="3" color="#000000"&gt;Hi – I have followed your advice.&lt;/FONT&gt;&lt;/P&gt;&lt;P style="margin: 0in 0in 0pt" class="MsoNormal"&gt;&lt;FONT face="Times New Roman" size="3" color="#000000"&gt;The power meter does have trigger commands. TR0 is standby, TR1 is trigger immediate, TR2 is trigger with delay and TR3 is trigger free run.&lt;SPAN&gt;&amp;nbsp; &lt;/SPAN&gt;According to the manual when TR1 or TR2 is called a measurement is taken and the display and the HP-IB bus data are updated. When TR3 is called the power meter makes continuous measurements and updates the display until placed back in standby. I placed the trigger command in the line before the PowerMeter.ReadString(PowerLevel) is called and tried each one (including GET) but the string is still not returned in the MsgBox. I also ran a short version through NI-SPY (attached) but am unable to understand why the VB version doesn’t work. Do you have any other suggestions?&lt;/FONT&gt;&lt;/P&gt;&lt;P style="margin: 0in 0in 0pt" class="MsoNormal"&gt;&lt;FONT face="Times New Roman" size="3" color="#000000"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;P style="margin: 0in 0in 0pt" class="MsoNormal"&gt;&lt;IMG src="http://forums.ni.com/t5/image/serverpage/image-id/11012i262063D99F35ABCC/image-size/original?v=mpbl-1&amp;amp;px=-1" border="0" alt="POWER METER READ SPY.jpg" title="POWER METER READ SPY.jpg" align="center" /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 19 Feb 2010 20:33:03 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/Instrument-Control-GPIB-Serial/How-do-I-read-from-a-gpib-device-in-Visual-Basic/m-p/1075691#M40629</guid>
      <dc:creator>TesTech</dc:creator>
      <dc:date>2010-02-19T20:33:03Z</dc:date>
    </item>
    <item>
      <title>Re: How do I read from a gpib device in Visual Basic</title>
      <link>https://ni.lithium.com/t5/Instrument-Control-GPIB-Serial/How-do-I-read-from-a-gpib-device-in-Visual-Basic/m-p/1075701#M40630</link>
      <description>All you did was attach some images. Please attach the actual NI-Spy files like I originally said (both of them).</description>
      <pubDate>Fri, 19 Feb 2010 20:46:00 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/Instrument-Control-GPIB-Serial/How-do-I-read-from-a-gpib-device-in-Visual-Basic/m-p/1075701#M40630</guid>
      <dc:creator>Dennis_Knutson</dc:creator>
      <dc:date>2010-02-19T20:46:00Z</dc:date>
    </item>
    <item>
      <title>Re: How do I read from a gpib device in Visual Basic</title>
      <link>https://ni.lithium.com/t5/Instrument-Control-GPIB-Serial/How-do-I-read-from-a-gpib-device-in-Visual-Basic/m-p/1075737#M40631</link>
      <description>&lt;P&gt;Sorry. &lt;/P&gt;&lt;P&gt;I have the files of course but&amp;nbsp;being new to the forum concept I don't know how to attach them.&lt;/P&gt;&lt;P&gt;Can you tell me how?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 19 Feb 2010 21:21:49 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/Instrument-Control-GPIB-Serial/How-do-I-read-from-a-gpib-device-in-Visual-Basic/m-p/1075737#M40631</guid>
      <dc:creator>TesTech</dc:creator>
      <dc:date>2010-02-19T21:21:49Z</dc:date>
    </item>
    <item>
      <title>Re: How do I read from a gpib device in Visual Basic</title>
      <link>https://ni.lithium.com/t5/Instrument-Control-GPIB-Serial/How-do-I-read-from-a-gpib-device-in-Visual-Basic/m-p/1075754#M40633</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I should have caught this on your first post&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Try&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Dim strRead as String&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;strRead = PowerMeter.ReadString()&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;MessageBox.Show(strRead)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;or&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;MessageBox.Show(PowerMeter.ReadString())&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Curt&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 19 Feb 2010 21:34:12 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/Instrument-Control-GPIB-Serial/How-do-I-read-from-a-gpib-device-in-Visual-Basic/m-p/1075754#M40633</guid>
      <dc:creator>Curt_C</dc:creator>
      <dc:date>2010-02-19T21:34:12Z</dc:date>
    </item>
    <item>
      <title>Re: How do I read from a gpib device in Visual Basic</title>
      <link>https://ni.lithium.com/t5/Instrument-Control-GPIB-Serial/How-do-I-read-from-a-gpib-device-in-Visual-Basic/m-p/1075757#M40634</link>
      <description>Clicking on the 'Add Attachments' usually works.&lt;img id="smileywink" class="emoticon emoticon-smileywink" src="https://ni.lithium.com/i/smilies/16x16_smiley-wink.gif" alt="Smiley Wink" title="Smiley Wink" /&gt; (right below)</description>
      <pubDate>Fri, 19 Feb 2010 21:37:06 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/Instrument-Control-GPIB-Serial/How-do-I-read-from-a-gpib-device-in-Visual-Basic/m-p/1075757#M40634</guid>
      <dc:creator>Dennis_Knutson</dc:creator>
      <dc:date>2010-02-19T21:37:06Z</dc:date>
    </item>
    <item>
      <title>Re: How do I read from a gpib device in Visual Basic</title>
      <link>https://ni.lithium.com/t5/Instrument-Control-GPIB-Serial/How-do-I-read-from-a-gpib-device-in-Visual-Basic/m-p/1076736#M40656</link>
      <description>Thanks Curt. That seems to work.&lt;DIV class="message-edit-history"&gt;&lt;SPAN class="edit-author"&gt;Message Edited by TesTech on &lt;/SPAN&gt;&lt;SPAN class="local-date"&gt; 02-22-2010&lt;/SPAN&gt;&lt;SPAN class="local-time"&gt; 02:22 PM&lt;/SPAN&gt;&lt;/DIV&gt;</description>
      <pubDate>Mon, 22 Feb 2010 20:22:27 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/Instrument-Control-GPIB-Serial/How-do-I-read-from-a-gpib-device-in-Visual-Basic/m-p/1076736#M40656</guid>
      <dc:creator>TesTech</dc:creator>
      <dc:date>2010-02-22T20:22:27Z</dc:date>
    </item>
    <item>
      <title>Re: How do I read from a gpib device in Visual Basic</title>
      <link>https://ni.lithium.com/t5/Instrument-Control-GPIB-Serial/How-do-I-read-from-a-gpib-device-in-Visual-Basic/m-p/1076749#M40657</link>
      <description>Thanks Curt. That seems to work.</description>
      <pubDate>Mon, 22 Feb 2010 20:25:03 GMT</pubDate>
      <guid>https://ni.lithium.com/t5/Instrument-Control-GPIB-Serial/How-do-I-read-from-a-gpib-device-in-Visual-Basic/m-p/1076749#M40657</guid>
      <dc:creator>TesTech</dc:creator>
      <dc:date>2010-02-22T20:25:03Z</dc:date>
    </item>
  </channel>
</rss>

