大家好,我正在用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 some
times 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.