Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

Ivi.Visa.IOTimeoutException

Use "SimpleReadWrite.2015" combine "Micosoft Visual Studio 2017".

Sometimes it will get error message at random part (Write part).

Error Message:

Ivi.Visa.IOTimeoutException:'Exception of type'Ivi.Visa.IOTimeoutException' was thrown'.

How can I do to let it fix this issue?

 

0 Kudos
Message 1 of 8
(5,565 Views)

Timeout often occurs on read because it can take time to prepare the data (especially when the measurement itself is triggered by the read command) but if it occurs on write then check your connections first. Or maybe the device is still busy with processing previous commands if you send many commands too fast.

First you can set a longer timeout delay in the visa settings.

Otherwise there is a simple way to make the program handle such exception: first call the Visa "Clear" function (to flush the device IO buffers so that the faulty command won't  interfere and the device will be ready to receive a new command) and then repeat the whole sequence after some time. I'm not using ivi (I mean I use Visa without the ivi layer) so I can't give you the exact syntax but the scheme might be something like (here in a vb-like pseudocode):

 

repeat=false 

do

try

  write command

  read data

catch IOTimeoutException

  repeat=true  //set repeat flag

end try 

if repeat then

.   device.clear

    wait a short delay (say 10ms)

endif

until not repeat (you may add "or userabort")

 

This code should recover gracefully from intermittent timeout errors, whether on write or read. 

0 Kudos
Message 2 of 8
(5,498 Views)

Hello Sir,

 

Thanks for your sharing and we can use repeat mechanism to reduce timeout issue. Any configuration VISA session to fix it ?

0 Kudos
Message 3 of 8
(4,528 Views)

gjx_0-1673246457583.png

can you help me

 

0 Kudos
Message 4 of 8
(3,550 Views)

Can you query the instrument in NIMAX without any issue?

one assumption is that you might need to enable termination character if instrument is not connected through GPIB

0 Kudos
Message 5 of 8
(2,597 Views)

thank you,i have solved it by enable termination character 

0 Kudos
Message 6 of 8
(2,590 Views)

兄弟你这个情况可能是因为你的仪表厂家没有内置结束符,你需要手动给一个“\n”的结束符,然后记得转义。

 

然后需要在写入读取命令之前加上一个使结束符标识为true的语句:

 

mbSession.TerminationCharacterEnabled = true;

 

就可以了,记得每一句读取命令之前都要加这一句

 

这个问题确实很坑,我之前也是折腾了很久,还是问了仪器公司的人才知道。

0 Kudos
Message 7 of 8
(1,721 Views)

感谢回复,之前自己偶然发现有个终止符使能,确实使能了终止符后就没那个报错了,虽然偶尔还有这个报错,但我没管,反正已经和我没关了

0 Kudos
Message 8 of 8
(1,715 Views)