Clear Filters
Clear Filters

Serial Port Reading with matlab

2 views (last 30 days)
yasin
yasin on 16 Dec 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

Accepted Answer

Walter Roberson
Walter Roberson on 16 Dec 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 Comments
yasin
yasin on 17 Dec 2012
thank you for answer , I understand you word problem isn't my code right? device cause the problem or wrong properties
Michael
Michael on 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??

Sign in to comment.

More Answers (0)

Categories

Find more on Startup and Shutdown in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!