简体   繁体   English

C++ 中的串口怎么办?

[英]Serial port in C++ How do I?

I want help to write in Serial Port.我想帮助写串行端口。 I use a FTDI cable to 'see' the usb as a serial port.我使用 FTDI 电缆将 USB 视为串行端口。

I gone through the example given in msdn but I don't understand it.我浏览了 msdn 中给出的示例,但我不明白。 https://msdn.microsoft.com/en-us/library/system.io.ports.serialport(v=vs.110).aspx . https://msdn.microsoft.com/en-us/library/system.io.ports.serialport(v=vs.110).aspx Is this written in C++/CLI mode?这是用 C++/CLI 模式编写的吗? what does the symbol ^ means?符号^是什么意思?

I get error when I use #using and lots of errors.当我使用 #using 和很多错误时出现错误。 If someone can go through a simple code for start only writing to the serial port that would be great!如果有人可以通过一个简单的代码开始只写入串行端口,那就太好了!

You can open a handle to a serial port using CreateFile function https://msdn.microsoft.com/en-us/library/windows/desktop/aa363858(v=vs.85).aspx您可以使用 CreateFile 函数打开串行端口的句柄https://msdn.microsoft.com/en-us/library/windows/desktop/aa363858(v=vs.85).aspx

use the name "\\.\\COMx" where x is the com port number使用名称“\\.\\COMx”,其中 x 是 com 端口号

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM