필터 지우기
필터 지우기

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 CenterFile Exchange에서 Startup and Shutdown에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by