完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
嗨我在visual studio 2010中用c ++编写了一个函数,它根据定义的采样间隔计算定义数量os样本的平均电流消耗。
问题是我偶尔得到-420查询未终止错误并且通信挂起。 需要重新连接USB电缆才能恢复通信。 首次打开设备后尤其会出现问题。 我认为这可能是一个计时错误,所以我添加一些* WAI和* OPC? 命令但没有效果。 我在下面添加我的函数(并附加cpp文件)。 任何帮助将不胜感激。 float MeasureAverageCurrentDC_mA(int sample_number,float sample_interval){float result; if(sample_interval 600)sample_interval = 600; if(sample_number 50000)sample_number = 50000; char samp_num [10]; char samp_int [10]; char table [90]; char var1 [45] =“CONF:CURR:DC 0.1,DEF;:SAMP:COUN”; char var2 [45] =“:SAMP:SOUR tiM;:SAMP:TIM”; _itoa(sample_number,samp_num,10); for(int i = 0; i 47&amp;&amp; tab [count] {licznik_kropka = licznik_kropka + 1; myvector [j] = tab [count] - '0'; j ++;} else {licznik_znakow = licznik_znakow + 1;}} if(czyE == 1){for(int i = j + 2 + licznik_znakow; i {EE = EE +(tab [count] - '0');}} arraysize = j - 1; for(int i = 0; i {lolek = lolek +(myvector )*(pow(10.0,(arraysize-i)));} lolek = lolek + myvector [arraysize]; if(czy_kropka == 1)result =(double)lolek / pow(10.0,licznik_kropka);否则result =(double)lolek; if(czyE == 1)result = result / pow(10.0,EE); delete [] myvector; res_table [count] = result;} for(int count = 0; count {sum = sum + res_table [count];} delete [] res_table; for(int i(0); i delete [] tab ; delete [ ] tab; tab = NULL; return sum / result_counter;}编辑者:white-star于2015年11月5日上午1:52 以上来自于谷歌翻译 以下为原文 Hi I wrote a function in visual studio 2010 in c++, which calculates the average current consumption from defined number os samples with defined sample interval. Problem is that i sporadically get -420 query unterminated error and communication hangs. Need to reconnect u*** cable to resume communication. Problem especially occurs after first switch on of device. I thought it can be a timing error, so I add some *WAI and *OPC? commands but with no effect. I add my functions below (and attach cpp file). Any help would be greatly appreciated. float MeasureAverageCurrentDC_mA(int sample_number, float sample_interval) { float result; if(sample_interval 600) sample_interval = 600; if(sample_number 50000) sample_number = 50000; char samp_num[10]; char samp_int[10]; char table[90]; char var1[45] = "CONF:CURR:DC 0.1, DEF;:SAMP:COUN "; char var2[45] = ":SAMP:SOUR TIM;:SAMP:TIM "; _itoa(sample_number,samp_num,10); for(int i = 0; i 47 && tab[count] < 58) { licznik_kropka = licznik_kropka + 1; myvector[j] = tab[count] - '0'; j++; } else { licznik_znakow = licznik_znakow + 1; } } if(czyE == 1) { for(int i = j + 2 + licznik_znakow; i < arraysize; i++) { EE = EE + (tab[count] - '0'); } } arraysize = j - 1; for(int i = 0; i < arraysize; i++) { lolek = lolek + (myvector) * (pow(10.0, (arraysize-i))); } lolek = lolek + myvector[arraysize]; if(czy_kropka == 1) result = (double)lolek / pow(10.0, licznik_kropka); else result = (double)lolek; if(czyE == 1) result = result / pow(10.0, EE); delete [] myvector; res_table[count] = result; } for(int count = 0; count < result_counter; count++) { sum = sum + res_table[count]; } delete [] res_table; for ( int i(0); i < result_counter; ++i ) delete [] tab; delete [] tab; tab = NULL; return sum/result_counter; } Edited by: white-star on Nov 5, 2015 1:52 AM 附件
|
|
相关推荐
1个回答
|
|
对于任何有类似问题的人。
打开后问题在于适当的供电设备。 打开后,设备并不总是自动检测到。 有效的解决方案是关闭设备管理器中的u***省电选项,如下所述:http://helpdeskgeek.com/windows-xp-tips/prevent-windows-from-powering-off-u***-device/ It 安装最新的Keysight IO库也很不错。 我认为这个话题可以关闭。 以上来自于谷歌翻译 以下为原文 For anyone who has similar issue. Problem lies in proper powering device after it is switched on. The device is not always auto-detected after it is switched on. The solution that worked is to switch off u*** power saving option in device manager in windows like described here: http://helpdeskgeek.com/windows-xp-tips/prevent-windows-from-powering-off-u***-device/ It is also good to have newest Keysight IO Libraries installed. I think the topic can be closed. |
|
|
|
只有小组成员才能发言,加入小组>>
1187 浏览 0 评论
2334 浏览 1 评论
2131 浏览 1 评论
2001 浏览 5 评论
2879 浏览 3 评论
918浏览 1评论
关于Keysight x1149 Boundary Scan Analyzer
681浏览 0评论
N5230C用“CALC:MARK:BWID?”获取Bwid,Cent,Q,Loss失败,请问大佬们怎么解决呀
783浏览 0评论
1187浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-11-5 22:29 , Processed in 1.427016 second(s), Total 75, Slave 58 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号