From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

in NI max, VISA query can work, but write /read not

I am using VISA test panel in NI max to send "*IDN?\n" to a Handler. when  click "query" button, i can get response string "Hontek". but instead if i first click "write" then click "read", there is an error shows( 0xBFFF0015 Timeout expired before operation completed). through IO trace, i saw that "query" also send "write/read" command, so what's the different?

in my VB code, i am using write/read function to communication with instrument and it not work. how could i fix it?

 

Thanks again

Peter

0 Kudos
Message 1 of 2
(2,361 Views)

您的错误显示的应该表示 VISA长时间读不到数据就会显示超时

 

query就是查询,是发出写操作后的自动读操作。read和write就是单独的读写操作。可以简单的理解为 一个query相当于先write后read.

你在NI VISA中可以成功完成query操作,但是先write后read就会超时,很可能是在读操作的wait timeout, 您看一下您是否对图片上的wait timeout 

设置了足够传输和读取操作的时间。

Capture8.PNG

 

在VB中也是要对读写操作设置合适的buffer

ViChar buffer[MAX_CNT]; /* Buffer for string I/O */

/* Ask the device for identification */

status = viWrite(instr, "*IDN?\n", 6, &retCount);

status = viRead(instr, buffer, MAX_CNT, &retCount);

 

此外,超时的报错下面的链接有比较详细的故障排查的步骤 您可以参考一下

https://knowledge.ni.com/KnowledgeArticleDetails?id=kA00Z0000019L3mSAE

0 Kudos
Message 2 of 2
(2,332 Views)