有人熟悉 安捷伦 agilent 和 罗德与施瓦茨 Rohde & Schwarz 等测试设备的开发吗? (SCPI 如何入门?)

2018-06-04 21:38:44 +08:00
 wzw

问题:

  1. SCPI 感觉有点难理解, 如何入门?
  2. 我用用程序控制这些设备,进行测试. 那我应该如何完成最简单的一个测试步骤?(帮助理解 SCPI 流程)

1 目前看懂了 hello world 的例子, 连上了设备. 这个代码跑通

import visa

rm = visa.ResourceManager()
scope = rm.open_resource("TCPIP::192.168.2.2::5025::SOCKET")

# All these three settings are required for SOCKET and Serial connection
scope.write_termination = '\n'
scope.set_visa_attribute(visa.constants.VI_ATTR_TERMCHAR, 10)
scope.set_visa_attribute(visa.constants.VI_ATTR_TERMCHAR_EN, True)

scope.clear()  # Clear instrument io buffers and status
idn_response = scope.query('*IDN?')  # Query the Identification string

print 'Hello, I am ' + idn_response

2 但是开始测试的 SCPI 命令就有点难上手的感觉了. (这段卡不太懂了. 恶补中)

 RTO/RTE Oscilloscope example for Python using PyVISA

import visa
import VISAresourceExtentions

# -----------------------------------------------------------
# Initialization
# -----------------------------------------------------------
rm = visa.ResourceManager()
scope = rm.open_resource('TCPIP::10.85.0.119::INSTR')

# try block to catch any InstrumentErrorException() or InstrumentTimeoutException()
try:
    scope.write_termination = ''
    # Some instruments require LF at the end of each command. In that case, use:
    # scope.write_termination = '\n'
    scope.ext_clear_status()  # Clear instrument io buffers and status
    scope.write('*RST;*CLS;:SYST:DISP:UPD ON')  # Reset the instrument
    scope.write('*ESE 1')  # Event Status Enable OPC bit - one time setting after *RST
    scope.ext_error_checking()  # Error Checking

    # -----------------------------------------------------------
    # Settings all in one string:
    # -----------------------------------------------------------
    scope.write('ACQ:POIN:AUTO RECL;:TIM:RANG 2.0;:ACQ:POIN 1002;:CHAN1:STAT ON;:TRIG1:MODE AUTO')
    scope.ext_error_checking()  # Error Checking

    # -----------------------------------------------------------
    # Acquisition:
    # -----------------------------------------------------------
    print '\nAcquisition started...'
    scope.ext_write_with_srq_sync('SING', 6000)
    print 'Acquisition finished'
    # -----------------------------------------------------------
    # Selftest:
    # -----------------------------------------------------------
    print '\nSelftest started...'
    scope.ext_query_with_srq_sync('*TST?', 120000)
    scope.ext_error_checking()  # Error Checking
    print 'Selftest finished...'

    print 'Finished'

except VISAresourceExtentions.InstrumentErrorException, e:
    # Catching instrument error exception and showing its content
    print 'Instrument error(s) occurred:\n' + e.message

except VISAresourceExtentions.InstrumentTimeoutException, e:
    # Catching instrument error exception and showing its content
    print 'Timeout error(s) occurred:\n' + e.message

有没有这方面入门经验的分享一下, 感觉 SCPI 命令好难懂.

谢谢

1734 次点击
所在节点    问与答
4 条回复
v2byy
2018-06-04 22:52:58 +08:00
看开发手册啊,做自动化测试吗
wzw
2018-06-04 23:02:10 +08:00
@v2byy #1 很多测试只能半自动吧. 正在看手册... 感觉有点怪怪的. 不如 python node js php .net C 好理解. 也可能我刚开始
wzw
2018-06-05 07:01:28 +08:00
一个回复,三个收藏+++
fsdafsag
2018-06-05 14:42:58 +08:00
只会用 labview 控制,一般都有范例可以改或者 DLL 可以调用, 再不济也可以根据通讯协议通过 scpi 模块来通讯。

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/460364

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX