A timeout occurred before the Terminator was reached

5 visualizzazioni (ultimi 30 giorni)
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 Commenti
Walter Roberson
Walter Roberson il 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.
samir
samir il 8 Apr 2012
well thx for commenting it . i alsoe found some similar thread but no soulution either
http://www.mathworks.com/matlabcentral/newsreader/view_thread/308157

Accedi per commentare.

Risposte (0)

Categorie

Scopri di più su Instrument Control Toolbox in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by