是德科技
直播中

李刚

7年用户 1338经验值
私信 关注
[问答]

E3631电源SCPI收到“查询中断”错误

大家好,我正在用VISA编程,使用E3631的RS232端口进行仪器控制。
当我向电源发送查询时,有时我会收到“查询中断”错误,这种情况大约发生在50%的时间。
以下是我对错误队列的查询示例:char buf [256] = {0}; / *错误状态* / ViStatus errstat; / *初始化VISA系统* / viOpenDefaultRM(& defaultRM); / * open DC Power
在RS-232端口上提供会话* / viOpen(defaultRM,“ASRLInstrument”,VI_NULL,VI_NULL和& vi_pwr); viPrintf(vi_pwr,“SYST:REMOTE  n”);
//设置远程模式//检查错误队列是否为clearederrstat = viPrintf(vi_pwr,“SYST:ERR? n”); if(errstat!= VI_SUCCESS)printf(“send SYST:ERR?error:%x  n”
,errstat); errstat = viScanf(vi_pwr,“%t  n”,& buf); if(errstat!= VI_SUCCESS)printf(“接收SYST:ERR?错误:%x  n”,errstat); printf(
“SYST:ERR?=%s  n”,buf);任何建议都将受到赞赏。
SCPI描述并没有真正帮助我,它说明在查询之前缓冲区中可能有数据,但我没有请求任何数据。

以上来自于谷歌翻译


     以下为原文

  Hello All,
I'm programming in VISA using the RS232 port of the E3631 for instrument control. When i send a query to the power supply sometimes i get the "Query INTERRUPTED" error, this happens about 50% of the time. Here is a sample of my query of the error queue:

     char buf [256] = {0};
     /* error status */
     ViStatus errstat;
     /* Initialize VISA system */
     viOpenDefaultRM (&defaultRM);
     /* open DC Power Supply session on RS-232 port */
     viOpen (defaultRM, "ASRLInstrument", VI_NULL,VI_NULL, &vi_pwr);

     viPrintf(vi_pwr, "SYST:REMOTEn"); //set remote mode
     // Check that error queue is cleared
     errstat = viPrintf (vi_pwr, "SYST:ERR?n");
     if (errstat != VI_SUCCESS)
          printf ("send SYST:ERR? error: %xn", errstat);

     errstat = viScanf (vi_pwr, "%tn", &buf);
     if (errstat != VI_SUCCESS)
          printf ("receive SYST:ERR? error: %xn", errstat);
     
     printf ("SYST:ERR? = %sn", buf);


Any suggestion will be appreciated. The SCPI description did not really help me out, it states that there might be data previously in the buffer before the query but i have not requested any data.  

回帖(6)

卜文月

2019-7-23 07:38:16
尝试没有 n的viScanf。另外,为了安全起见,你应该将读取的数据限制为bufviScanf(vi_pwr,“%255t”,& buf)的大小

以上来自于谷歌翻译


     以下为原文

  Try viScanf without the n.
Also, to be safe you should limit the data read to the size of buf
viScanf (vi_pwr, "%255t", &buf)
举报

李刚

2019-7-23 07:46:05
你好丹尼尔,谢谢你的快速反应。
我尝试了你推荐的更改,它仍然没有解决问题,我也尝试在每次scanf后添加一个viFlush但我仍然得到Query INTERRUPTED错误。
这个错误也阻止我使用* OPC?
查询命令以检查编程指令是否完成,它强制我使用盲循环将我的应用程序与仪器同步,这不是非常有效。
你认为它与使用串口与仪器通信有什么关系吗?
谢谢。

以上来自于谷歌翻译


     以下为原文

  Hello Daniel,
Thanks for the quick response. I tried the changes you recommended and it still did not solve the problem, i also tried adding a viFlush after every scanf but i still get the Query INTERRUPTED error. This error also prevents me from using the *OPC? query command to check for the completion of a programming instruction and it forces me to use a blind loop to synchronize my application with the instrument which is not very efficient. Do you think it has anything to do with using the serial port to communicate with the instrument?. Thanks.
举报

李刚

2019-7-23 08:03:36
嘿dgun,谢谢你查一下。
我怀疑可能是因为使用RS232,因为我在USB端口上有一个34411A数字万用表,我没有遇到过这个问题。
知道这个问题是否有E3631固件路径?
我正在努力从安捷伦购买USB-to-GPIB模块,但在那之前我需要使用RS232开发我的应用程序。另一个问题:如果我使用的话,你推荐的是将我的应用程序与仪器同步的最佳方法
* OPC?
查询命令。
例如,当我编程电压并希望确保在使用DMM执行测量之前设置电压。谢谢

以上来自于谷歌翻译


     以下为原文

  Hey dgun,
Thanks for checking this out. I had suspected that maybe it was due to using the RS232 because i have a 34411A DMM on the USB port and i have not experienced this problem with it. Any idea if there is a E3631 firmware path for this issue? I'm working on purchasing a USB-to-GPIB module from Agilent but until then i need to develop my application using the RS232.

Another question: What do you recommend is the best way to synchronize my application with the instrument, should i use the *OPC? query command. For example when i program a voltage and want to make sure it is set before performing a measurement with the DMM.

Thanks
举报

卜文月

2019-7-23 08:18:11
“另一个问题:如果我使用* OPC?查询命令,你建议将我的应用程序与仪器同步的最佳方法。例如,当我编程电压并希望确保在执行测量之前设置电压
DMM。“是的。
使用* OPC?
如果要将控制程序执行与仪器同步。
如果您只是希望仪器在转到下一个命令之前等待完成,请使用* OPC(不带?)。
希望有道理。

以上来自于谷歌翻译


     以下为原文

  
"
Another question: What do you recommend is the best way to synchronize my application with the instrument, should i use the *OPC? query command. For example when i program a voltage and want to make sure it is set before performing a measurement with the DMM.
"

Yes. Use *OPC? if you want to synchronize controlling program execution with the instrument. Use *OPC (without ?) if you just want the instrument to wait for completion before going to the next command. Hope that makes sense.
举报

更多回帖

发帖
×
20
完善资料,
赚取积分