开发者

Change COM port speed

How can I change the spe开发者_C百科ed (bits per second) of the COM port on my machine using C# or the Win32 API via PInvoke?

I would like to do this instead of going into the properties of the COM port in device manager.


Why not use the SerialPort class?


as SB said, using the C# SerialPort class:

class Run
{
  public static void main(string[] args)
  {
    SerialPort port = new SerialPort("COM2", 115200);
    port.BaudRate = 115200; // set it elsewhere.
    port.Open();
    port.Write("ABCDE");
  }
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜