Filter löschen
Filter löschen

Serial Port Reading with matlab

2 Ansichten (letzte 30 Tage)
yasin
yasin am 16 Dez. 2012
clear all;
p=serial('COM2','BaudRate',9600,'DataBits',8);
set(p,'Parity','none');
set(p,'Terminator','LF');
fopen(p);
son=100;
figure
xlabel('zaman')
ylabel('veri')
title('veri okuma')
grid on;
hold on;
for t=1:1:son
ylim([0 50])
xlim([1 100])
veri=fscanf(p,'%f');
plot(t,veri);
drawnow
end
fclose(p);
delete(p);
clear all
I want to read volue from seria port and with plot I wanna see graphic but there is a warning
Unsuccessful read: A timeout occurred before the Terminator was reached.
I dont solve problem.Help

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 16 Dez. 2012
Either the remote device is not active, or it is not using 9600 baud, or it is not using LF as its line terminator, or it is not responding to you (such as if it is waiting for you to say something to it first.) Or there could be a cabling problem.
  2 Kommentare
yasin
yasin am 17 Dez. 2012
thank you for answer , I understand you word problem isn't my code right? device cause the problem or wrong properties
Michael
Michael am 10 Feb. 2013
I also have the same problem here.. at first, it didn't show any warning and worked completely fine.. but then after around 5hours, I got this problem : warning Unsuccessful read: A timeout occurred before the Terminator was reached. Can someone help please??

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Startup and Shutdown 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!

Translated by