c# TekScope示波器编程 求大虾们给个例子程序参考学习一下

慕懿轩 .NET软件工程师  2015-08-11 04:46:01
最近一个项目需要用c#设置示波器并获取示波器的波形数据,使用了TekScope,文档看了一段时间,但是毫无起色,希望有大神们能给个实例程序 谢谢啦。
...全文
1718 2 收藏 20
写回复
20 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
Fury陈 2017-09-18
_Scope.WriteString("TRIG:A:EDGE:SOU CH2;SLO RIS;COUP DC") 'TRIG:A:EDGE:SOU Sets or returns the source for the A edge trigger. 'CH1–CH4 specifies an analog input channel as the A edge trigger source. 'SLO Sets or returns the slope for the A edge trigger. 'RISe specifies to trigger on the rising or positive edge of a signal. 'COUP Sets or returns the type of coupling for the A edge trigger. 'DC specifies DC trigger coupling, which passes all input signals to the trigger circuitry. _Scope.WriteString("TRIG:A:MOD NORM;TYP EDG") 'TRIG:A:MOD Sets or returns the A trigger mode. 'NORMal waits for a valid trigger event. 'Sets or returns the type of A trigger. Once you have set the trigger type, you may also need to identify the associated trigger class. For details on selecting Logic and Pulse trigger classes, see TRIGger:A:LOGIc:CLAss and TRIGger:A:PULse:CLAss respectively. 'EDGe is the default trigger. A trigger event occurs when a signal passes through a specified voltage level in a specified direction and is controlled by the TRIGger:A:EDGE? commands. _Scope.WriteString("TRIG:A:LEV 2.5") 'TRIG:A:LEV Sets or returns the trigger level for the A trigger. '2.5 specifies the trigger level in user units (usually volts) System.Threading.Thread.Sleep(1000) 'setup the acq mode _Scope.WriteString("ACQ:MOD AVE;NUMAV" + Str(2)) _Scope.WriteString("ACQ:STOPA RUNST") _Scope.WriteString("ACQ:STATE RUN")
回复
CYamazing 2016-08-17
@u012030603 @running_crazy
回复
CYamazing 2016-08-17
楼主,我最近也在做这个,新手完全不会啊,能求楼主给个例子吗
回复
hu1198791962 2016-03-19
求助楼主,遇到同样的问题,命令是可以发送成功的,但是想回读数据时就出错,用ReadNumber(IEEEASCIITPYe.ASCIITPYe_ANY)时,报错显示couldn't interrupt I/O data as single number,用ReadString时就显示 I/Q timeout error 。究竟是什么问题,示波器是泰克TDS3012B。
回复
su5303 2016-02-24
楼主,怎么把save image从网络盘I盘里保存到本地磁盘,谢谢,急求助
回复
su5303 2016-02-24
楼主,求助C#的实例,我现在想保存数据和保存图像,不知道怎么实现啊
回复
慕懿轩 2015-09-10
@running_crazy 已解决 谢谢啦。
回复
慕懿轩 2015-09-10
@running_crazy 在读取或查询示波器信息的时候需要设置什么吗 我设置示波器的时候就可以 但是查询的时候 就查询不到 会出错。
回复
慕懿轩 2015-09-07
@running_crazy 竟然有大神回复了。谢谢啦。 我在实际运用中,很多命令总是出现 I/Q timeout error 。 myScope.ReadWaveform((TekScopeSourceEnum)i, 1, ref wave, ref inix, ref xincre); readwaveform方法也是失败。但是有些命令是可以成功的,所以我不清楚是不是其他什么原因导致的。 示波器TDS 3014C 。
回复
SineMetu1 2015-09-07
引用 10 楼 u012030603 的回复:
@running_crazy 方便留个QQ或者联系方式么。
我的那个项目也是好久之前做的, 有些要看开发文档才行的, 我不知道ReadWaveform这个方法功能是什么
回复
慕懿轩 2015-09-07
@running_crazy 方便留个QQ或者联系方式么。
回复
慕懿轩 2015-09-07
方便留个QQ或者联系方式么。
回复
SineMetu1 2015-09-06
引用 6 楼 u012030603 的回复:
@running_crazy 请问还在关注吗 大神帮帮呀。
这是初始化的代码,其中包括所有的参数设置,包括采集的刻度,采集的记录长度,频率,采集通道这些的, 你可以对照着示波器开发文档看看. 这个是用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 DATA:STOP commands.

        'TRIGGER
        _Scope.WriteString("TRIG:A:EDGE:SOU CH2;SLO RIS;COUP DC")
        'TRIG:A:EDGE:SOU Sets or returns the source for the A edge trigger. 
        'CH1–CH4 specifies an analog input channel as the A edge trigger source.
        'SLO Sets or returns the slope for the A edge trigger.
        'RISe specifies to trigger on the rising or positive edge of a signal.
        'COUP Sets or returns the type of coupling for the A edge trigger. 
        'DC specifies DC trigger coupling, which passes all input signals to the trigger circuitry.

        _Scope.WriteString("TRIG:A:MOD NORM;TYP EDG")
        'TRIG:A:MOD Sets or returns the A trigger mode.
        'NORMal waits for a valid trigger event.
        'Sets or returns the type of A trigger.  Once you have set the trigger type, you may also need to identify the associated trigger class.  For details on selecting Logic and Pulse trigger classes, see TRIGger:A:LOGIc:CLAss and TRIGger:A:PULse:CLAss respectively.
        'EDGe is the default trigger. A trigger event occurs when a signal passes through a specified voltage level in a specified direction and is controlled by the TRIGger:A:EDGE? commands. 
        _Scope.WriteString("TRIG:A:LEV 2.5")
        'TRIG:A:LEV Sets or returns the trigger level for the A trigger.
        '2.5 specifies the trigger level in user units (usually volts)
        System.Threading.Thread.Sleep(1000)
        'setup the acq mode
        _Scope.WriteString("ACQ:MOD AVE;NUMAV" + Str(2))
        _Scope.WriteString("ACQ:STOPA RUNST")
        _Scope.WriteString("ACQ:STATE RUN")
    End Sub
回复
慕懿轩 2015-09-06
@running_crazy 请问还在关注吗 大神帮帮呀。
回复
慕懿轩 2015-09-06
@running_crazy 还需要 还没弄完善 中间很多问题 求指教一下。
回复
SineMetu1 2015-08-28
我刚做过的,楼主还需要吗
引用 3 楼 u012030603 的回复:
真没人了么。。。。求助呀。
回复
慕懿轩 2015-08-12
@91program 确实看文档没进展 想动手操作 确不知道咋弄 所以看看有大神能否给个实例学习学习呢
回复
慕懿轩 2015-08-12
真没人了么。。。。求助呀。
回复
91program 2015-08-11
只看文档是不会有什么进展 想要进展,你就要实际动手去实现
回复
相关推荐
发帖
嵌入开发(WinCE)
创建于2007-09-28

1.9w+

社区成员

硬件/嵌入开发 嵌入开发(WinCE)
申请成为版主
帖子事件
创建了帖子
2015-08-11 04:46
社区公告
暂无公告