资源简介
用matlab的m语言编写的可从串口直接读取数据并显示为波形图的程序,仅供参考,数据传送格式请自行探索。
代码片段和文件信息
clc;
bufsize=6;
circle_times=2;
display_num=100;
doc=‘mydata1‘;
com=‘COM6‘;
baudrate=9600;
timeout=600;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
obj=serial(com);
m=zeros(1display_num);
n=zeros(1display_num);
l=zeros(1display_num);
d=zeros(circle_timesdisplay_num);
e=zeros(circle_timesdisplay_num);
f=zeros(circle_timesdisplay_num);
fopen(obj);
set(obj‘BaudRate‘baudrate‘timeout‘timeout‘DataBits‘8‘StopBits‘1‘Parity‘‘none‘‘FlowControl‘‘none‘);
wind_sum=0;
temp_sum=0;
humid_sum=0;
for i=1:circle_times
for j=1:display_num
data=fread(objbufsize)‘;
a=double(data(1)*2^8+data(2))/10;
b=double(data(3)*2^8+data(4))/10;
c=double(data(5)*2^8+data(6))/100;
m(j)=a;
n(j)=b;
l(j)=c;
相关资源
- 基于MATLAB_fsolve函数的四连杆机构运动
- 阵列信号处理MATLAB程序
- 数字信号处理高西全实验课matlab程序
- 运用MATLAB软件的海浪仿真,海浪仿真
- BCH纠错码 matlab
- IIR数字滤波器的Matlab和FPGA实现.pdf
- 国外编的干涉合成孔径雷达InSARMatla
- 血管检测程序手掌,手背
- 求解一元高次方程的matlab实现
- matlab eeg
- matlab读取地震数据sgy
- 经验模态分解MATLAB程序包emd
- 合成孔径雷达成像仿真的matlab程序,
- ARIMA预测MATLAB程序
- 消息传递算法 和积算法 因子图 matl
- MATLAB SPIN路由算法
- 遗传算法全局寻优代码
- PMSG单机Matlab模型
- MATLAB uigetdir的一个小bug
-
xm
l_io_tools - qc_ldpc矩阵构造
- 基于DCT变换的图像压缩算法
- 8QAM、QPSK误码率计算matlab程序
- 解释结构模型ISM的matlab实现代码
- BP网络训练MATLAB程序
- matlab坐标转换
- SVPWM MATLAB仿真
- matlab视日轨迹跟踪算法仿真程序
- cnn程序 matlab
- 排队论的matlab仿真(包括仿真代码)
评论
共有 条评论