整理时间:2020-05-19
目录:
1.matlab可以 进行串口通信?
2.怎么搞
3.总结
正文:
1.matlab可以 进行串口通信
matlab的toolbox很强大。其中Instrument Control Toolbox,The toolbox provides built-in support for TCP/IP, UDP, I2C, SPI, and Bluetooth® serial protocols for remote communication with other computers and printed circuit boards (PCBs) from MATLAB.
其中,我们就只关注本文话题 串口通信。
注:用好matlab自带的帮助文档。

2.怎么搞
2.1 环境准备
准备好食材工具再做饭。包括:
(1)matlab软件(我使用的是R2019a)
(2)虚拟串口工具Configure Virtual Serial Port Driver
(3)串口工具hercules_3-2-8


2.1 开搞
step1:
使用虚拟串口工具生成一对虚拟串口,它们俩是“我发你收”的关系。

比如我创建虚拟串口是COM1 和 COM2.

step2:
打开串口工具,设置串口信息。

step3:
上面串口工具软件hercules_3-2-8 使用的是COM2,那我们matlab中就使用COM1.

查看详细信息

step4:
matlab 发送消息,在hercules_3-2-8 中接收查看。

step5:
hercules_3-2-8发送消息,在matlab中接收查看。

step6:
打扫战场,保持好习惯,关闭句柄,清除占用。
fclose(sObject);
delete(instrfind);

3.总结
实现了一个简单 的串口收发,重在理解。从易到难,循序渐进,加油吧,曾经那个少年!
THE END~






















![[桜井宁宁]COS和泉纱雾超可爱写真福利集-一一网](https://www.proyy.com/skycj/data/images/2020-12-13/4d3cf227a85d7e79f5d6b4efb6bde3e8.jpg)

![[桜井宁宁] 爆乳奶牛少女cos写真-一一网](https://www.proyy.com/skycj/data/images/2020-12-13/d40483e126fcf567894e89c65eaca655.jpg)