(求助)串口 winform 调用目标发生异常
sp.DataBits = Form2.DataBits;
sp.PortName = Form2.PortName;
if (Form2.StopBits == "1 ")
{
sp.StopBits = StopBits.One;
}
if (Form2.StopBits == "1.5 ")
{
sp.StopBits = StopBits.OnePointFive;
}
if (Form2.StopBits == "2 ")
{
sp.StopBits = StopBits.Two;
}
int[] BaudRate = new int[6];
BaudRate[0] = 4800;
BaudRate[1] = 9600;
BaudRate[2] = 38400;
BaudRate[3] = 57600;
BaudRate[4] = 19200;
BaudRate[5] = 115200;
for (int i = 0; i < 6; i++)
{
sp.BaudRate = BaudRate[i];
for (int n = 0; n < 3; n++)
{
if (n == 0)