佚名通过本文主要向大家介绍了c#TekScope示波器编程求大虾们给个例子程序参考学习一下等相关知识,希望对您有所帮助,也希望大家支持linkedu.com www.linkedu.com
问题: c# TekScope示波器编程 求大虾们给个例子程序参考学习一下
描述:
解决方案1:
这是初始化的代码,其中包括所有的参数设置,包括采集的刻度,采集的记录长度,频率,采集通道这些的, 你可以对照着示波器开发文档看看. 这个是用VB写的, 跟C#差别不大.
描述:
c#示波器
最近一个项目需要用c#设置示波器并获取示波器的波形数据,使用了TekScope,文档看了一段时间,但是毫无起色,希望有大神们能给个实例程序 谢谢啦。解决方案1:
这是初始化的代码,其中包括所有的参数设置,包括采集的刻度,采集的记录长度,频率,采集通道这些的, 你可以对照着示波器开发文档看看. 这个是用VB写的, 跟C#差别不大.
Private Sub Initialize() Implements IScopeClass.Initialize
_Scope.Descriptor = _DevHandle
_Scope.YMult = 1 / 250
_Scope.YOffset = _Yoffset
_Scope.YZero = _Yzero
'Send RCL command
_Scope.WriteString("*RST") '将在示波器重置为出厂默认值
_Scope.WriteString("ACQ:MOD SAM") '设置采用模式,SAM默认模式,在示例模式下,所有波形数据有 8 位的精度
'scope.WriteString("HEAD ON")
_Scope.WriteString("HEAD OFF")
_Scope.YModelEnabled = False
'HOR record lenth
_Scope.WriteString("HOR:DEL:MOD ON")
_Scope.WriteString("HOR:DEL:TIM" + Str(OffsetTime)) '设置或返回用于延迟时的水平的延迟时间
_Scope.WriteString("HOR:SCA " + Str(_HScale)) '设置或返回时间基本水平缩放
_Scope.WriteString("HOR:RECO " + Str(_RecordLen)) '设置水平的记录长度。此命令的查询表返回,当前水平的记录长度。
'VER record lenth
Dim VScale As Single = _VScale / 1000
_Scope.WriteString("CH1:BAN FUL;COUP AC;TER MEG;OFFS 0;SCA " + Str(VScale))
'BANdwidth Sets or returns the bandwidth of the specified TWEnty sets the upper bandwidth limit of channel <x> to 20 MHz.
'COUPling Sets or returns the coupling setting for the specified(CHANNEL) AC sets channel <x> to AC coupling. DC sets channel <x> to DC coupling. GND sets channel<x> to ground. Only a flat, ground-level waveform will be displayed
'TERmination Sets the connected-disconnected status of a 50 ?resistor, which may be connected between the specified channel’s coupled input and oscilloscope ground.MEG sets the channel <x> input resistance to 1 M?
'OFFSet Sets or returns the vertical offset for channel
'Scale Sets or returns the vertical scale for the channel specified by <x>, where x is the channel number.
_Scope.WriteString("CH2:COUP DC;TER MEG;OFFS 1.5;SCA 5E-1")
'Set up data source and format
_Scope.WriteString("DAT:SOU CH1;ENC RIB;WIDTH 2")
'DATa:SOUrce Sets or returns the location of the waveform data transferred from the oscilloscope by the CURVe? query.
'DATa:ENCdg Sets or returns the format of outgoing waveform data. This command is equivalent to setting WFMOutpre:ENCdg, WFMOutpre:BN_Fmt, andWFMOutpre:BYT_Or.Setting the DATa:ENGdg value causes the corresponding WFMOutpre values to be updated and conversley. RIBINARY specifies signed integer data point representation with the most significant byte transferred first.
'WIDTH 2 When the byte width is two, the values range from -32768 to 32767. and positive integer values range from 0 to 65,535
'Set up data format
_Scope.WriteString("WFMO:ENCDG BIN")
'WFMO:ENCDG Sets and queries the type of encoding for outgoing waveforms.
'BINary specifies that outgoing data is to be in a binary format whose further specification is determined by WFMOutpre:BYT_Nr, WFMOutpre:BIT_Nr, WFMOutpre:BN_Fmt and WFMOutpre:BYT_Or.
_Scope.WriteString("WFMO:BN_FMT RI")
'Sets or returns the format of binary data for outgoing waveforms specified by the DATa:SOUrce command. Changing the value of WFMOutpre:BN_Fmt also changes the value of DATa:ENCdg.
'RI specifies signed integer data point representation.
'_Scope.WriteString("WFMOutpre:NR_Pt 100000")
'This query returns the number of data points in the waveform record that will
'be transmitted in response to a CURVe? query. This value is the adjusted
'range specified by DATA:START and