MATLAB stops reading data
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
So, I want to read data of a STM32F103RBT6 development board. I am able to receive the data though the STM for 1-2 minutes after which the communication abrubtly ends and I need to restart MATLAB to reset the communication link before I can rerun the script. Please help
Matlab code:
clc
clear
try
s=serial('COM4','BAUD',115200);
fclose(s);
fopen(s);
l=256;
p=zeros(1,l);
q=ones(1,l);
tic;
for j=1:l
z=fgets(s);
string(z);
p(1,j)=hex2dec(strtrim(z));
end
toc;
plot([1:256l],p);xlim([0 l]);drawnow
while(1)
for i=l:-1:2
p(1,i)=p(1,i-1);
end
z=fgets(s);
string(z);
p(1,1)=hex2dec(strtrim(z));
plot([1:256l],p);xlim([0 l]);drawnow
end
catch me
fclose(s);
end
fclose(s);
0 comentarios
Respuestas (0)
Ver también
Categorías
Más información sobre STMicroelectronics Discovery Boards en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!