10-24-2018 03:24 AM
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
10-24-2018 11:00 PM
您的错误显示的应该表示 VISA长时间读不到数据就会显示超时
query就是查询,是发出写操作后的自动读操作。read和write就是单独的读写操作。可以简单的理解为 一个query相当于先write后read.
你在NI VISA中可以成功完成query操作,但是先write后read就会超时,很可能是在读操作的wait timeout, 您看一下您是否对图片上的wait timeout
设置了足够传输和读取操作的时间。
在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