问题标签 [pyvisa]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
0 回答
10174 浏览

python - 安装VISA和PyVisa后,找不到VISA模块

我在Mac OS X v10.8.5 (Mountain Lion) 上。我已经安装了 NI-VISA 5.4 和 PyVisa 1.5。当我尝试“进口签证”时,我得到了这个回溯:

打印 sys.path 在清单中显示:

我也试过这个:

但我得到同样的错误。

为什么找不到模块?我错过了什么?

更新:我意识到 PyVisa 1.5 是一个开发版本,所以我安装了 PyVisa 1.4(我尝试了两个MacPorts,只是下载了 tarball 并手动安装)。我仍然遇到同样的错误。

0 投票
1 回答
3274 浏览

python - PyVISA SCPI 命令和查询(值更新问题)

更新:这似乎工作“OK”......虽然我不确定为什么某些回复最后有 /r/n 以及为什么某些没有。我已明确关闭握手功能...

下面发布了命令、查询和回复的示例。

PyVISA SCPI 命令输出

**我正在使用 PyVISA 前端与传感器进行通信。

在输出发生变化之前,我必须发送命令或进行三次查询...

在继续之前我必须添加等待命令吗?我认为 SCPI 命令是阻塞的(可以说是同步的)。如果我做错了什么,请告诉我。以下是我的一些命令:**

您可以在图像中找到其余的命令。

0 投票
0 回答
490 浏览

visa - PyVisa:从 GPIB 读取时出现损坏的字符

(这可能是论坛发错了,所以我在 GitHub 上发起了一个问题:https ://github.com/pyvisa/pyvisa/issues/254 )

我尝试通过在 python 中使用 GPIB 来控制 Keithley 仪器。基本上通信是有效的,但是当从仪器读取时,字符经常被破坏。例如:

National Instruments VISA 测试面板中的相同看起来是这样的:

当我签入 NI I/O Trace 时,这两个调用看起来很相似:

NI测试面板:

Python:

有人有想法吗?

python中的其他命令:

似乎是正确的,但这不是:

从 NI VISA 交互控制中进行比较:

0 投票
0 回答
556 浏览

python - RS232的pyVisa太慢了

简单的程序:

我得到:

在蟒蛇 3.4

“VI_ERROR_TMO (-1073807339):在操作完成之前超时。”

在蟒蛇 3.6

VI_ERROR_ASRL_OVERRUN "传输过程中发生溢出错误。在下一个字符到达之前未从硬件读取字符。

据我所知,与数据发送速度相比,pyVisa 的读取速度太慢了。当我使用 pyVisa/GPIB 或 pySerial/COM 时,相同的程序正在工作。

我怎样才能让它更快,或者我能做些什么来通过 pyVisa/COM 获取这些数据?

0 投票
1 回答
480 浏览

python - pyVISA GPIB GET(组执行触发器)

我想通过 GPIB 同时触发几个测量设备。有一个与LabVIEW一起使用的GPIB函数“GET”,我想与pyVISA一起使用。

我可以用 pyVISA 发送这个全局 GET 命令吗?

0 投票
1 回答
2432 浏览

python - 是 PyVISA 安装失败吗?或者,我做错了什么?

我想测试我的 PyVISA 安装并遇到了一定的失败:

我的问题可能是什么?

我尝试更新 VISA 路径:

没有任何成功

0 投票
2 回答
2667 浏览

python-3.x - PYVISA:如何传输二进制块数据,以便正确格式化图片并保存到我的 PC 上?

我正在尝试将屏幕截图从 Rhode & Schwarz - FSV 信号分析仪传输到我的 PC。

如何传输二进制块数据,以便将图片从仪器正确保存到我的 PC 上?我的代码如下。一个文件被保存到我的桌面,但我的计算机出现错误并且无法打开,因为该文件的格式不正确。

文件显示在桌面上

尝试在桌面上打开文件时出错

我确认屏幕截图已保存在仪器上。还用另一台仪器验证了 SCPI 语法是正确的。所以它必须是二进制块数据的传输方式。任何意见是极大的赞赏。

0 投票
1 回答
2974 浏览

python - 简单的 *IDN?查询导致“操作完成前超时已过期”

我尝试通过以下方式对我的 LAB 仪器进行简单查询:

结果是:

根据我到目前为止所学到的(从其他人的经验中)。此超时错误与线路终止(“\n”)有关。我怎么解决这个问题 ?

0 投票
1 回答
1245 浏览

python - Is there something unstable about 38400 baud?

I am writing a python project to control a device with PyVisa over a USB cable. I am having a lot of success. I noticed that the device datasheet supported 9600, 19200, 38400, 57600, 115200, 230400, 460800 baud rates so I created some functions for changing the baud rate.

But I wanted a nifty way to detect which baud rate the device is set to so I can automatically connect to it without magically knowing what baud the device is on. The device "remembers" the last baud you set it to - it does not reset to a default baud on power loss. The device seems like it doesn't respond at all if you have the wrong baud rate set. So, given a random baud rate, I cycle through all the supported ones and send a short command. If the device answers, THAT'S the baud rate currently set and I use that to talk to the device more.

However, during stress testing I noticed that when the device was randomly set on 38400 baud and I went to detect it, my program would fail to detect that baud rate. (The device wouldn't answer a call on this baud.) When I removed it from the list of supported bauds, the device worked fine.

Is there something about 38400 baud rate that makes it more unstable than other bauds?

I also thought that this use-case was interesting. If you are having problems like this, try dropping support for certain bauds and see if that fixes your errors. Hope it helps.

EDIT: The code really doesn't matter but there was a request for it so...

This code is abbreviated from the real code but the idea is the same. Just loop through, send a command, and listen for a response. The instrument will not send a response over the com port if a message is sent with the incorrect baud or the command is unintelligible. This detection method ALWAYS failed on 38400 and never fails on any other baud rate. The only way in which this method can fail is that it never receives a response on ANY baud, which is exactly what it was doing. This makes me think maybe there is a clock mismatch only at that baud rate or similar. I was curious to know if certain bauds have higher rate of errors than others.

0 投票
2 回答
2066 浏览

python - Keithley 2410 和 PyVISA - VI_ERROR_TMO:在操作完成前超时

我正在尝试在 x86_64 linux 机器(CentOS 7)上通过 python 控制 Keithley 2410。我正在使用 python 2.7.5、NI-VISA 16 和 PyVISA 1.8。吉时利通过一根 RS232 转 USB 电缆连接到计算机,并配置为 RS232 通信(参数为:波特 57600、位 8、奇偶校验无、终止符、流控制无)。当我尝试查询 Keithley 时,出现超时错误,如下所示: