完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
大家好,使用探戈设备服务器通过网络从示波器获取信息我可以在使用ASCII格式时获取波形。
调用:+:WAVeform:SOURce CHANnel1;:WAVeform:FORMat ascii;:WAVeform:DATA?+我得到一个字符串:+ 8E-03,4E-03,1E-03,1E-03,1E-03,0.0E + 00,1E-03,3E-03,8E-03,1.2E-02,1.1E-02,6E-03,2E-03,3E-03,7E-03,... +这包含40000点 情节:http://www.cells.es/Members/***lanch/Ellipsis/Visa-instruments/waveform-data/at_download! 但是当我尝试相同但二进制格式时:+:WAVeform:SOURce CHANnel1;:WAVeform:FORMat word;:WAVeform:DATA?+答案不包含所有波形:+'#580004 xe4 xfd xe1 xfd, xfe xaa xfe xf3 xfe xbf xfeI ... +标题后面没有80004个元素。 最糟糕的是,字数在几十分之一到一千之间变化,但从不是完整的波形。 我试图使用命令的+ [start [,size]] +参数并尝试更频繁地读取波形的一部分,但是信号的触发频率比我检查的频率更高。 如何获得完整的波形,就像我使用ascii格式一样? 以上来自于谷歌翻译 以下为原文 Hi all, Using a tango device server to get information from an oscilloscope by the network I can get the waveform when I use ASCII format. Calling: +:WAVeform:SOURce CHANnel1;:WAVeform:FORMat ascii;:WAVeform:DATA?+ I get an string: +8E-03,4E-03,1E-03,1E-03,1E-03,0.0E+00,1E-03,3E-03,8E-03,1.2E-02,1.1E-02,6E-03,2E-03,3E-03,7E-03,...+ This contains the 40000 points of the plot: !https://www.cells.es/Members/***lanch/Ellipsis/Visa-instruments/waveform-data/at_download! But when I try the same but in binary format: +:WAVeform:SOURce CHANnel1;:WAVeform:FORMat word;:WAVeform:DATA?+ The answer doesn't contain all the waveform: +'#580004xe4xfdxe1xfd,xfexaaxfexf3xfexbfxfeI...+ Not 80004 elements follows the header. Worst than that the number of words varies between a few tenths to a thousand, but never the complete waveform. I have tried to use the +[start[,size]]+ parameters of the command and try to read more often parts of the waveform, but the signal is triggered more often than what I can check it. How can I get the complete waveform, like I have with ascii format? |
|
相关推荐
5个回答
|
|
Well I have some improvement on that binary readings. This may help to understanding what I am doing (wrong). Because the script (device server) is written in python, I can use the library 'struct'.
Well, to day I can only get noise from the scope signalling, and with the way it works, the ASCII format I get data similar to the scope: !https://www.cells.es/Members/***lanch/Ellipsis/Visa-instruments/scodisr0201_WfFormat_ascii/at_download! The code to get it is simple. I am formatting the output trace as: DEBUG sr02/di/sco-01 In sr02/di/sco-01::ask_for_values() query= :WAVeform:SOURce CHANnel1;:WAVeform:DATA? DEBUG sr02/di/sco-01 In sr02/di/sco-01::ask_for_values() answer= "[ 0.005 0.009 0.011 0.008 0.003 0.001 0.003 0.005 0.004 0. -0.001 -0.001 -0.001 -0.002 -0.001 0. 0.001 0. -0.003 -0.006 -0.005 -0.001 0.006 0.01 0.01 0.006 0.001 0. 0.004 0.009 0.011 0.009 0.005 0.001 0.001 0.002 0.002 0.001 0. 0. -0.001 -0.001 0.002 0.007 0.011 0.011 0.006 0. -0.003 0. 0.003 0.004 0.004 0.003 0.002 0.002 0.003 0.006 0.006 0.004 -0.001 -0.004 -0.002 0.005 0.009 0.007 0.003 0.001 0.004 0.008 0.009 0.007 0.006 0.006 0.007 0.008 0.008 0.009 0.011 0.011 0.012 0.014 0.018 0.018 0.012 0.003 -0.003 -0.001 0.005 0.008 0.007 0.004 0.004 0.005 0.005 0.004 0.004 0.006 0.007 0.004]... +39902)" *DEBUG sr02/di/sco-01 In sr02/di/sco-01::read_ChannelN() waveform= "[ 0.003 0.007 0.007 ..., 0.009 0.005 -0.001]"* This is what has been already check and compared with a real oscilloscope signal. But when try to get this data using binary this doesn't works this good. Reading the data using BYTE or WORD formats, the date is being processed this way: if not _waveform[0] == '#': raise AttributeError,"Wrong data receiver from channel %d"%chNum nBytesLengthBlock = int(_waveform[1]) nBytesWaveBlock = int(_waveform[2:nBytesLengthBlock+2]) waveBytes = _waveform[nBytesLengthBlock+2:nBytesWaveBlock] if WaveformDataFormat == 'BYTE': format = 'B'#unsigned char, 1byte divisor = 1 elif WaveformDataFormat == 'WORD': format = 'H'#unsigned short, 2byte divisor = 2 else: raise AttributeError,"Cannot decodify data receiver from channel %d"%chNum nCompletBytes = len(waveBytes)-(len(waveBytes)%divisor) if not len(waveBytes)%4 == 0: print("nIncompleteBytes = %d"%(len(waveBytes)%divisor)) if not WaveformDataFormat == 'LONG': #expand the input when each float is codified in less than 4 bytes h = struct.unpack(format*(nCompletBytes/divisor),waveBytes[:nCompletBytes]) i = struct.pack('I'*len(h),*h[:len(h)]) else: i = waveBytes f = struct.unpack('f'*(len(i)/4),i[:len(i)]) With this code, what I am trying is to "expand" the byte/word data to be possible to unpack it in floats. But the signals doesn't look equivalent (with precision differences): In the case of the BYTE format: !https://www.cells.es/Members/***lanch/Ellipsis/Visa-instruments/scodisr0201_WfFormat_byte/at_download! With the output trace: DEBUG sr02/di/sco-01 In sr02/di/sco-01::ask() query=:WAVeform:SOURce CHANnel1;:WAVeform:DATA? DEBUG sr02/di/sco-01 In sr02/di/sco-01::ask() answer= '#540002x00x00x00xffxffxffx00x00x00x00x01x01x00x00x00x01x01x00xffxffxffxffxffxffxffx00x00x00x00x00x00xffxffxffxffxffxffxffx00x01x01x01x00xffxffx00x01x01x00x00x00x00xffxffx00x00x00xffxfexfexffx00x00xffxffxffx00xffxffxffx00x00x00x00x01x01x00x00xffxffx00x00x00x00x00xffxffxffxffx00x00x00x00'...(+39909) *DEBUG sr02/di/sco-01 In sr02/di/sco-01::read_ChannelN() waveform= "'(0.0, 0.0, 0.0, 3.5733110840282835e-43, 3.5733110840282835e-43, 3.5733110840282835e-43, 0.0, 0.0, 0.'...(+578754)"* In case of the WORD format: !https://www.cells.es/Members/***lanch/Ellipsis/Visa-instruments/scodisr0201_WfFormat_word/at_download! With the output trace: DEBUG sr02/di/sco-01 In sr02/di/sco-01::ask() query=:WAVeform:SOURce CHANnel1;:WAVeform:DATA? DEBUG sr02/di/sco-01 In sr02/di/sco-01::ask() answer= '#580004x1exfc(xfcxb2xfcx11xfd*xfd_xfdxd8xfd7xfex13xfex9exfd{xfdxfcxfdxb0xfexdfxfegxfexdfxfdxd8xfd'xfe+xfexbdxfdx7fxfdx12xfe4xffxe5xffrxff-xfex05xfdxb0xfc&xfdxdexfdAxfex17xfexa3xfdgxfdxacxfd0xfeixfex1exfexa9xfdx93xfdxf9xfdyxfexa2xfebxfexf1xfdyxfdx05"...(+79911) *DEBUG sr02/di/sco-01 In sr02/di/sco-01::read_ChannelN() waveform= "'(9.0442605484452343e-41, 9.0456618469095592e-41, 9.0649997657172416e-41, 9.0783121011283274e-41, 9.0'...(+955613)"* My questions now are: *a)* Is this conversion/expansion correct? I think I am doing something wrong because BYTE/WORD are too different than ASCII formats. At least those binary formats are not soo different, but the WORD have some "glitch"s that neither I understand. *b)* Now it looks that I am getting the 40000 points for the plot. Would be possible that previous data read that looks shorter, where because some 'x00' or termination characters becomes in the stream? I am not sure about that, but by now I didn't see them again using str.__repr__() Thanks |
|
|
|
希望我不打扰你,我在那个帖子上有一些新闻。
在范围内具有相同的噪声信号,在+ word +中具有读取格式,我已经改变了通道的垂直标度。 在它达到200mV / div之前,当我减小到5mV / div时,我看到了不同之处:在* word *格式中,波形变为:!https://www.cells.es/Members/***lanch/Ellipsis/Visa- 仪器/ scodisr0201_WfFormat_word_scale_5mV / at_download! 在* byte *格式中,变为:!https://www.cells.es/Members/***lanch/Ellipsis/Visa-instruments/scodisr0201_WfFormat_byte_scale_5mV/at_download! 它清楚地表明精确度的差异,但颇为相似的噪声信号与* ASCII格式*!HTTPS://www.cells.es/Members/***lanch/Ellipsis/Visa-instruments/scodisr0201_WfFormat_ascii_scale_5mV/at_download! 除此之外,我仍然不明白为什么这些值在+ ascii +和10 ^ -40 in + binary +中的大小为10 ^ -3。 这意味着转换/扩展不正确,并且是产生这种差异的原因。 另外,我仍然不明白为什么我+ +几乎总是+ +字+格式中的一个多余字节(+字节+永远不会有多余的)。 以上来自于谷歌翻译 以下为原文 Hoping that I am not bothering you, I have some news on that thread. Having the same noise signal in the scope and the reading format in +word+, I have changed the vertical scale of the channel. Before it was 200mV/div and when I have reduced to 5mV/div, I saw the difference: In *word* format, the waveform becomes: !https://www.cells.es/Members/***lanch/Ellipsis/Visa-instruments/scodisr0201_WfFormat_word_scale_5mV/at_download! In *byte* format, becomes: !https://www.cells.es/Members/***lanch/Ellipsis/Visa-instruments/scodisr0201_WfFormat_byte_scale_5mV/at_download! It shows clearly a difference of precision, but is quite similar to the noise signal with *ascii* format: !https://www.cells.es/Members/***lanch/Ellipsis/Visa-instruments/scodisr0201_WfFormat_ascii_scale_5mV/at_download! Apart of that, I still don't understand why the values are in the order of 10^-3 in +ascii+ and 10^-40 in +binary+. This would mean that the conversion/expansion is not correct and is what gives this difference. Also, I still not understand why I have +almost always+ one excess byte in +word+ format (in +byte+ never can have an excess). |
|
|
|
今天我有一个信号来区分+噪音+和+漂亮+信号,并避免认为某些东西在没有被很好地解释时。
首先,我使用我所知道的方法查看信号,我确信它有效:*:WAVeform:FORMat ASCii *!http://www.cells.es/Members/***lanch/Ellipsis/Visa-instruments/ scodisr0201_wBeam_WfFormat_ascii / at_download! 对代码的第一次修改已在+ struct.unpack +中设置为整数列表,因为在我将它作为无符号值进行签名之前。 第二个修改是我没有重新打包到4字节整数来重新打包到浮点数(32位)。 然后是时候检查二进制模式了。 首先是最简单的字节:*:WAVeform:FORMat BYTe *!http://www.cells.es/Members/***lanch/Ellipsis/Visa-instruments/scodisr0201_wBeam_WfFormat_byte/at_download! 波形看起来不错,但我的尺度有问题。 根据手册,我已经了解到我正在接收ADC转换。 我正在使用* Programmers reference * with Publication Number + D8104-97013 + from * August 2008 *,而在28-26页(846)中有一节+“了解WORD和BYTE格式”+嗯,我明白了, 也许我错了,我收到了8位ADC,但我不知道如何+问+ + + + + + + + + + + + + + + + + 更改为* word *格式,为了更准确地接收到的数字,我必须将其设置为小端:*:WAVeform:FORMat WORD;:WAVeform:BYTeorder LSBFirst *!http://www.cells.es/Members / ***lanch /省略号/签证的仪器/ scodisr0201_wBeam_WfFormat_word / at_download! 在这种情况下,我有与+ byte +相同的疑问,最终有相当于+ ascii *格式,我不知道+ + + 32768+到+ -32768 +之间的浮动比例。 * Ps *:仍然不知道为什么我在+ word +格式中有1个字节过剩。 以上来自于谷歌翻译 以下为原文 Today I have a signal to distinguish +noise+ and +nice+ signal and avoid to think that something is well interpreted when it isn't. First of all I look on the signal using the method I know and I'm sure that it works: *:WAVeform:FORMat ASCii* !http://www.cells.es/Members/***lanch/Ellipsis/Visa-instruments/scodisr0201_wBeam_WfFormat_ascii/at_download! The first modification to the code has been set in the +struct.unpack+ to integer lists, because before I did it as unsigned values, when they are signed. The second modification is that I'm not repacking to 4 byte integers to reunpack to floats (32bit). Then it's time to check in the binary modes. first the easiest, the byte: *:WAVeform:FORMat BYTe* !http://www.cells.es/Members/***lanch/Ellipsis/Visa-instruments/scodisr0201_wBeam_WfFormat_byte/at_download! The waveform looks nice but I have an issue with the scale. Following the manual I have understood that what I'm receiving a ADC conversion. I'm using the *Programmers reference* with Publication Number +D8104-97013+ from *August 2008*, and in page 28-26 (846) there is a section +"Understanding WORD and BYTE Formats"+ Well, I understand, maybe I'm wrong, that I receive and 8 bit ADC, but I don't know how to +ask+ what means ++127+ and +-127+. Changing to *word* format, to have more accuracy in the number received, I have to set it to little endian: *:WAVeform:FORMat WORD;:WAVeform:BYTeorder LSBFirst* !http://www.cells.es/Members/***lanch/Ellipsis/Visa-instruments/scodisr0201_wBeam_WfFormat_word/at_download! In this case I have the same doubt than with +byte+, to finally have the equivalent to +ascii* format, I don't know to which float scale between ++32768+ to +-32768+. *Ps*: Still not knowing why I have 1 byte excess in +word+ format. |
|
|
|
yzmalysys 发表于 2019-5-17 09:52 看起来你已经想出如何从作用域获取数据,并且你得到了BYTE或WORD数据。 接下来,你需要弄清楚缩放。 关键命令是YINCrement和YORIgin。 从手册: - :WAVeform:YORIGin? :WAVeform:YORigin? 查询返回当前指定源的y-原点电压值。 返回的电压值是波形数据数字代码00000所代表的电压值。对于BYTE和WORD数据以及电压波形,它是数字代码零处的电压。 - :WAVeform:YINCrement? :WAVeform:YINCrement? query返回当前指定源的y-增量电压值。 该电压值是两个相邻波形数据数字码之间的电压差。 相邻的数字代码是相差一个最低有效位的代码。 例如,数字代码24680和24681变化一个最低有效位。 对于BYTE和WORD数据以及电压波形,它是对应于一个最低有效位变化的电压。 通常,转换由YOrigin +(RAW DATA BYTE / WORD)完成。* YIncrement您应该查看手册中的编程示例。 他们有很好的记录。 人 以上来自于谷歌翻译 以下为原文 It looks like you have figured out how to get the data from the scope, and you are getting BYTE or WORD data. Next you need to figure out the scaling. The key commands are YINCrement and YORIgin. From the manual: - :WAVeform:YORigin? The :WAVeform:YORigin? query returns the y- origin voltage value for thecurrently specified source. The voltage value returned is the voltage valuerepresented by the waveform data digital code 00000. For BYTE and WORD data, and voltage waveforms, it is the voltage at digital code zero. - :WAVeform:YINCrement? The :WAVeform:YINCrement? query returns the y- increment voltage value for the currently specified source. This voltage value is the voltage difference between two adjacent waveform data digital codes. Adjacent digital codes are codes that differ by one least significant bit. For example, the digital codes 24680 and 24681 vary by one least significant bit. For BYTE and WORD data, and voltage waveforms, it is the voltage corresponding to one least significant bit change. In general, the conversion is done by YOrigin + (RAW DATA BYTE/WORD) * YIncrement You should look at the programming examples in the manual. They are pretty well documented. Al |
|
|
|
大!
非常感谢! 它的工作原理和图中40k点的视图,3个选项(字节,字,ascii)几乎无法区分。 但二进制方式的传输速度要短得多。 提交到探戈设备服务器的svn 以上来自于谷歌翻译 以下为原文 Great! Many thanks! It works and with a view of 40kpoints in the plot, the 3 options (byte,word,ascii) are almost indistinguishable between them. But binary ways have much shorter transmission. commited to the svn of the tango device server |
|
|
|
只有小组成员才能发言,加入小组>>
1279 浏览 0 评论
2371 浏览 1 评论
2187 浏览 1 评论
2061 浏览 5 评论
2945 浏览 3 评论
1099浏览 1评论
关于Keysight x1149 Boundary Scan Analyzer
748浏览 0评论
N5230C用“CALC:MARK:BWID?”获取Bwid,Cent,Q,Loss失败,请问大佬们怎么解决呀
917浏览 0评论
1279浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-12-21 15:05 , Processed in 1.455462 second(s), Total 86, Slave 70 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号