我已经使用下面的代码来读取 rfid 标签值。
try
{
if (serialPort1.IsOpen) serialPort1.Close();
serialPort1.PortName = "COM25";
serialPort1.BaudRate = 9600;
serialPort1.DataBits = 8;
serialPort1.ReceivedBytesThreshold = 5;
serialPort1.Handshake = Handshake.None;
serialPort1.Open();
lblStatus.Text = "Serial Port: Connected";
}
catch (Exception ex)
{
lblStatus.Text = "Serial Port: Unable to Connect";
}
上面的代码适用于 windows 应用程序,但是当我在 windows mobile 模拟器中使用相同的代码时,它说无法连接串口。有人可以帮我吗?