返回打印的pt_off每两次都不同 #554
tstrws6gf5-prog
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
如下程序
import pyvisa
1. 初始化连接
rm = pyvisa.ResourceManager()
替换为你的示波器实际地址
scope = rm.open_resource('TCPIP::192.168.48.86::INSTR')
2. 设置数据源和格式
scope.write(f'DATA:SOURCE CH1')
scope.write('DATA:ENCDG SRIBINARY') # 使用带符号二进制格式,方便PC处理span_1
scope.write('WFMOUTPRE:BYT_NR 2') # 设置为每点2字节(16位精度)span_2
3. 获取触发点在记录中的位置索引
span_3PT_Off 返回的是触发点相对于记录开始处的样点数span_3
scope.clear()
pt_off = int(scope.query('WFMOutpre:PT_Off?'))
print(pt_off)
start_point = pt_off + 1
cmd = f"DATA:START {start_point};STOP {start_point};*OPC?"
scope.query(cmd) # 执行并等待返回 '1'
scope.query('*OPC?')
scope.clear()
scope.close()
示波器没有重新采集,连续多次运行该程序,但是返回的pt_off每两次值都不同,奇数次至一致,偶数次值一致,但奇偶次数值不一样,求解
Beta Was this translation helpful? Give feedback.
All reactions