フィルターのクリア

Serial Port Reading with matlab

2 ビュー (過去 30 日間)
yasin
yasin 2012 年 12 月 16 日
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

採用された回答

Walter Roberson
Walter Roberson 2012 年 12 月 16 日
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 件のコメント
yasin
yasin 2012 年 12 月 17 日
thank you for answer , I understand you word problem isn't my code right? device cause the problem or wrong properties
Michael
Michael 2013 年 2 月 10 日
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??

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeStartup and Shutdown についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by