<p>访问<strong>VISA资源的最简单方法(IMHO)仍然是使用<strong>VISA设备检测功能,该功能将通过:</p>
<ul>
<li><code>visa.ResourceManager().list_resources()</code>,如果您使用<code>pyVisa</code></li>
<li>或者<code>viFindRsrc()</code>和<code>viFindNext()</code>如果您使用<code>visa32.dll</code>库。</li>
</ul>
<p>现在默认情况下,使用这两种方法都不会检测到LAN连接。这让您有两个选择:</p>
<ul>
<li>如果您已经安装了<strong>NI-MAX</strong>(来自<em>National Instruments</em>的<em>Measurement&Automation Explorer</em>是一个<strong>免费下载),请在<em>“设备和接口”</em>下,右键单击<em>“网络设备”</em>,选择“创建新的VISA TCP/IP资源…”</em>,然后按照说明操作。<strong>NI-MAX</strong>将自动检测您的仪器并提供其<strong>VISA</strong>资源名称。<strong>注意</strong>现在这个资源将同时由<code>list_resources()</code>和<code>viFindRsrc()</code>/<code>viFindNext()</code>列出</li>
<li>如果没有,您必须提供<strong>VISA</strong>和<strong>右边的资源名。如果您使用VISA passport(例如,对于LeCroy示波器,<em>VICP</em>),则应适当更改<strong>VISA标题</strong>(用<em>VICP</em>替换<em>TCPIP</em>)。然后,语法如下:<strong>[visa header]::[instrument ip]::INSTR</strong>或<strong>[visa header]::[instrument ip]:[instrument port]::INSTR</strong></li>
</ul>
<p>实际上,它并不总是<strong>INSTR</strong>,这取决于资源类(请参见<a href="http://zone.ni.com/reference/en-XX/help/371361J-01/lvinstio/visa_resource_name_generic/" rel="nofollow">http://zone.ni.com/reference/en-XX/help/371361J-01/lvinstio/visa_resource_name_generic/</a>)。</p>
<p>请确保将<strong>字节</strong>字符串发送到仪器(特别是使用<strong>Python 3+</strong>时),否则将出现以下错误:</p>
<blockquote>
<p>VI_ERROR_RSRC_NFOUND: Insufficient location information or the requested device or resource is not present in the system</p>
</blockquote>
<p>也可以通过<code>0xBFFF0011</code>或返回值<code>-1073807343</code>来标识。</p>