将单位的设备、程序拿回家,准备十一再调试一下,不成想设备放到笔记本上不能正确读数了,貌似找不到串口,找了一段程序测试打印出我的笔记本上的所有串口:
CommPortIdentifier portId;
Enumeration en = CommPortIdentifier.getPortIdentifiers();
System.out.println("列出所有串口名称");
while (en.hasMoreElements()) {
portId = (CommPortIdentifier) en.nextElement();
if (portId.getPortType() == CommPortIdentifier.PORT_SERIAL) {
System.out.println(portId.getName());
}
}
本文介绍了一次在家调试单位设备时遇到的问题——笔记本无法正确识别串口设备,并提供了一段Java代码来帮助检测并列出笔记本上的所有串口名称。
1268

被折叠的 条评论
为什么被折叠?



