开发者

Change COM port speed

开发者 https://www.devze.com 2023-01-05 10:06 出处:网络
How can Ichange the spe开发者_C百科ed (bits per second) of the COM port on my machine using C# or the Win32 API via PInvoke?

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

精彩评论

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