A timeout occurred before the Terminator was reached

조회 수: 5 (최근 30일)
samir
samir 2012년 4월 6일
How to avoid this kind of error.I got this when receiving some data from a robot.I managed to avoid this problem with pause(2) before receiving data but now my algorithm is too slow.(This is just a part of my program)
s=serial('com5');
set(s,'BaudRate',9600,'DataBits', 8, 'Parity', 'none','StopBits', 1, 'FlowControl', 'none','Terminator','CR','Timeout',10);
fopen(s);
while(1)
pause(2);
fprintf(s,'0');
data=fscanf(s);
data=str2num(data);
if(data<=10)
display(data)
end
end
fclose(s);
Without the pause(2) i sometimes get this error: A timeout occurred before the Terminator was reached but with pause(2) it never happens.So why is this and how to avoid it without using pause.
this is what im sending form the roboter:
PULSIN 12, 1, time
distance = time ** 2251
SEROUT 1, 84, [DEC distance, CR]
puslin activates the sonar and mesaures time. serout 1-pin number ,84-baudrate(9600).
  댓글 수: 2
Walter Roberson
Walter Roberson 2012년 4월 7일
I _have_ been reading your message since you posted it, but I don't know the answer. It's a hardware issue. This is the sort of thing I would use our HP DataScope for.
samir
samir 2012년 4월 8일
well thx for commenting it . i alsoe found some similar thread but no soulution either
http://www.mathworks.com/matlabcentral/newsreader/view_thread/308157

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

답변 (0개)

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by