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");
}
}
精彩评论