我遇到串口端口ReceiveData处理程序的问题。它不止一次被触发,它会分割数据。以下是串行端口的设置:
RadioDeviceObject = new RadioDevice();
RadioDeviceObject.BaudRate = RadioPortBaudRate;
RadioDeviceObject.PortName = RadioPortName;
RadioDeviceObject.Parity = System.IO.Ports.Parity.None;
RadioDeviceObject.DataBits = 8;
RadioDeviceObject.StopBits = System.IO.Ports.StopBits.One;
RadioDeviceObject.Handshake = System.IO.Ports.Handshake.None;
RadioDeviceObject.ReadTimeout = 1000;
RadioDeviceObject.WriteTimeout = 100;
RadioDeviceObject.ReceivedBytesThreshold = 1;
RadioDeviceObject.DataReceived += RadioDeviceObject_DataReceived;
RadioDeviceObject.Open();
我不知道发生了什么,它阻止我分析收到的数据。我在其他软件上检查过,比如白蚁和Docklight,没有问题。
以下是我发送/接收的内容:
2017-05-22 03:24:56: Sent: 0 0 0 2 236 6 246 5 0 0 0 0 0 0 0 0 11 0
2017-05-22 03:24:56: Received: 0 0 0 0 0 0 0 11
2017-05-22 03:24:56: Received: 16 236 6 246 5 54 54 54 54 63 63 63