matlab的串口总是打不开啊?

来源:百度知道 编辑:UC知道 时间:2024/06/28 16:50:53
obj=serial('com1','baudrate',9600,'parity','none','databits',8,'stopbits',1);%初始化串口
fopen(obj);%打开串口对象
总是提示
??? Error using ==> serial.fopen at 71
Port: COM1 is not available. No ports are available.
Use INSTRFIND to determine if other instrument objects are connected to the requested device.

Error in ==> tiaoshi1 at 2
fopen(obj);%打开串口对象

如果你有太多的COM口正在使用,靠后的com口会不被matlab识别,最好把com清一清,把想用的端口号设置得靠前一点。

你确定 有 com1 串口!

他说的 很清楚

Use INSTRFIND to determine if other instrument objects are connected to the requested device.

祝你顺利