完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
嗨,起初,为了一个糟糕的英语而忘了我:-)而且我很喜欢编程示波器,VISA和编程通用。
问题如下:我需要在这台示波器上进行多次测量。 我将测量数据保存到2D阵列。 在第一次测量完成后,我可以从示波器下载数据并将其保存,但是在第二次测量时,下载数组为空。 它给出了错误:err = viScanf(vi,“%#hb n”,&amp; num_values,data_byte)的无效参数或格式无效; Infiinium应用程序中的指令和QUERY INTERRUPTED。 我正在使用C中的Agilent DSO9000程序员手册(示例程序)中的说明。这是简化代码,用于2次测量:signed short data_byte [2] [25000]; //数组保存测量数据int num_values; //测量数据量//示波器初始化:复位,设置触发,比例,时基... // main(){for(j = 0; j {viPrintf(vi,“:SINGLE n”); / /我的代码(没有VISA指令)// * / * ================================= * *下载波形 data。* * ================================== * / * * / *设置波形源。* / * * viPrintf(vi,“:WAVeform:SOURce CHANnel1 n”); * * / *选择返回数据的格式:* / * * viPrintf(vi,“:WAVeform:FORMat word n”); * * viPrintf(vi,“:WAVeform:DATA? n”); * * / *读取波形数据。* / * * err = viScanf(vi,“%#hb n”,&amp; num_values,data_byte [j] ); * * if(err!= VI_SUCCESS)printf(“ERROR:”); * * char err_msg [1024] = {0}; * * viStatusDesc(vi,err,err_msg); * * printf(“VISAError:% s n“,err_msg); * *} //循环结束* *} //结束主*我在Visual Studio中工作。当我使用而不是粗体指令时:DISK:SAVE:WAVEFORM CHANNEL1,”D :\ ...它适用于许多测量。我尝试了更多的格式,如BYTE,ASCii,但是同样的行为,没有成功。可以som 请给个意见吗? 我知道,我的代码可能是灾难性的,没有最佳。 当我写错了主题时,请删除或删除此主题,谢谢。 如果您想了解有关代码的更多信息,我将编写它。 MarkEdited:elemaro于2013年1月30日下午1:52 以上来自于谷歌翻译 以下为原文 Hi, at first, exuse me for a bad english :-) and i am begginer in programming oscilloscope, VISA and programing general. The problem is following: i need make many measurements on this oscilloscope. I am saving measured data to 2D array. After first measurements is all ok, i can download data from oscilloscope and save it, but at second measurement is downloaded array empty. It is giving errors: invalid parameter or invalid format at err=viScanf(vi,"%#hbn",&num_values, data_byte); instruction and QUERY INTERRUPTED in Infiinium Application. I am using instructions from Agilent DSO9000 programmers manual (sample programs) in C. Here is simplified code, for 2 measurements: signed short data_byte [2][25000]; // array to save measured data int num_values; // quantity of measured data // initialization of oscilloscope: reset, set trigger, scales, timebase... // main() { for(j=0;j<2;j++) { viPrintf (vi, ":SINGLEn"); // my code (without VISA instructions) // */*=================================* *Download waveform data.* *==================================*/* */* Set the waveform source. */* *viPrintf(vi,":WAVeform:SOURce CHANnel1n");* */* Choose the format of the data returned: */* *viPrintf(vi,":WAVeform:FORMat wordn");* *viPrintf(vi,":WAVeform:DATA?n");* */* Read waveform data. */* *err=viScanf(vi,"%#hbn",&num_values, data_byte[ j ]);* *if(err != VI_SUCCESS) printf("ERROR: ");* *char err_msg[1024]={0};* *viStatusDesc(vi,err,err_msg);* *printf("VISAError:%sn",err_msg);* *} // end of loop* *} // end of main* I am working in Visual Studio. When i use instead of bold instructions :DISK:SAVE:WAVEFORM CHANNEL1,"D:\... it is working good for many measurements. I tried more formats like BYTE, ASCii, but the same behavior,no success. Can someone give some advice please? i know, that my code is probably catastrophic and no optimal. When i am write to bad topic, please remove or delete this topic, thank you. If you want more information about code, i will write it. Mark Edited by: elemaro on Jan 30, 2013 1:52 PM |
|
相关推荐
1个回答
|
|
谢谢Algoss的回复,我认为你的想法很好。
没有可下载的数据。 在询问数据之前我曾尝试过睡眠循环,甚至8秒。 我也尝试逐步调试steb。 在询问数据之前,我会尝试检查范围的状态。 但我不明白,为什么在数据直接保存到光盘的情况下效果很好。 谢谢 以上来自于谷歌翻译 以下为原文 thank you Algoss for responding, i think that your idea is good. There is no data to download. I had tried sleep loop before asking data, even 8 seconds. I also tried debugging steb by step. I will try to check status of scope before asking for data. But i dont understand, why it works great where data is saving to disc directly. Thank you |
|
|
|
只有小组成员才能发言,加入小组>>
1294 浏览 0 评论
2377 浏览 1 评论
2199 浏览 1 评论
2068 浏览 5 评论
2955 浏览 3 评论
1131浏览 1评论
关于Keysight x1149 Boundary Scan Analyzer
759浏览 0评论
N5230C用“CALC:MARK:BWID?”获取Bwid,Cent,Q,Loss失败,请问大佬们怎么解决呀
939浏览 0评论
1296浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-12-27 04:27 , Processed in 1.489856 second(s), Total 77, Slave 61 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号