Effacer les filtres
Effacer les filtres

Serial Port Reading with matlab

2 vues (au cours des 30 derniers jours)
yasin
yasin le 16 Déc 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

Réponse acceptée

Walter Roberson
Walter Roberson le 16 Déc 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 commentaires
yasin
yasin le 17 Déc 2012
thank you for answer , I understand you word problem isn't my code right? device cause the problem or wrong properties
Michael
Michael le 10 Fév 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??

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Startup and Shutdown dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by