Handling time out warning

조회 수: 11 (최근 30일)
Marcelo Del Fiore
Marcelo Del Fiore 2014년 8월 12일
답변: Kaushik Budheliya 2020년 9월 1일
I´m getting warning message " Warning: VISA: Timeout expired before operation completed." when acquiring data from a oscilloscope using visa() function.
How can I extend the time out period of USB port.
Thanks,
Marcelo

답변 (2개)

Salaheddin Hosseinzadeh
Salaheddin Hosseinzadeh 2014년 8월 12일
Hello Marcelo,
lets assume you're creating your visa device as such
mydevice = visa(...);
Now you can see the device properties as follows
get(mydevice); % this shows you timeout and ...
Then you can change the device timeout by using set command
set(mydevice,'Timeout',20);
Be aware, if you allocate a huge number, then you have to wait till the end of time out in case of an error in communication!
That's as far as I can remember! Hope that helps.
Good Luck!
  댓글 수: 1
Salaheddin Hosseinzadeh
Salaheddin Hosseinzadeh 2014년 8월 12일
Oh! BTW if you want to handle the error, which is what you said in the question title but then you asked a different question in your explanations, you have to define a callback function for the 'TimeoutFcn' or 'TimeoutErrorFcn' or a similar property of your device, which you can find it just as I explained, and you can set it using the set command explained above.
It's good to have look at the MATLAB documentation (doc) to find more about how to set the callback function ;)

댓글을 달려면 로그인하십시오.


Kaushik Budheliya
Kaushik Budheliya 2020년 9월 1일
Hello Marcelo,
You should add pause(1); between each write and read command, it will help the instrument to read and write exact data.
I hope it will solve your problem.
Best of Luck!
fwrite(obj,...);
pause(1); % unit is second(s)
fread(obj,...);

카테고리

Help CenterFile Exchange에서 Instrument Control Toolbox Supported Hardware에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by