A timeout occurred before the Terminator was reached
5 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Walter Roberson
am 7 Apr. 2012
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.
Antworten (0)
Siehe auch
Kategorien
Mehr zu Instrument Control Toolbox finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!