Instrument Control (GPIB, Serial, VISA, IVI)

取消
显示结果 
搜索替代 
您的意思是: 

VISA Read function problem

VISA Read function  replys slowely if the string does not consists "end of line constant". How it can be improved?
0 项奖励
1 条消息(共 4 条)
3,849 次查看
0 项奖励
2 条消息(共 4 条)
3,839 次查看

What hardware interface are you using? GPIB, Serial, or any others?  GPIB has a special termination condition - EOI, which does not exist in Serial interface, therefore there is some difference between them.

VISA Read function (viRead, viScanf) can successfully and rapidly return only when:

(1) Explicit termination character (0x0A default) is encountered on viRead/viScanf call, or
(2) Number of bytes specified on viRead() call has been transfered.

In your case, it seems like the response string does not contain the CR(0x0D) or LF(0x0A) as a termination character, therefore the VISA Read call is timed out.  If any other character byte is constantly expected as string termination, you can avoid the timeout problem by changing VI_ATTR_TERMCHAR attribute using viSetAttribute() function.  Otherwise, you must use viRead function explicitly specifying number of bytes expected.

0 项奖励
3 条消息(共 4 条)
3,836 次查看

Thank you.

Definiton of number of bytes expected solves the problem.

Thanks a lot.

 

0 项奖励
4 条消息(共 4 条)
3,808 次查看