我正在嘗試通過(guò)串行端口向 RFID 閱讀器發(fā)送命令(它的作用類似于鍵盤,KKMOON 制造的 M302)。我有這段代碼是為了發(fā)送指令:SerialPort sp = new SerialPort();sp.PortName = "COM3";sp.BaudRate = 9600;sp.Parity = Parity.None;sp.DataBits = 8;sp.StopBits = StopBits.One;sp.DataReceived += myRecieved;sp.Open();byte[] bytestosend = { 0x03, 0x0a, 0x00, 0x0d };sp.Write(bytestosend, 0, bytestosend.Length);bytestosend = new byte[]{ 0x04, 0x05, 0x00, 0x00, 0x09 };sp.Write(bytestosend, 0, bytestosend.Length);bytestosend = new byte[] { 0x03, 0x06, 0x00, 0x09 };sp.Write(bytestosend, 0, bytestosend.Length);if (beep){ running = false; bytestosend = new byte[] { 0x02, 0x13, 0x15 }; sp.Write(bytestosend, 0, bytestosend.Length);}sp.Close();sp.Dispose();sp = null;我從串口監(jiān)聽(tīng)器得到這個(gè)輸出:為了讀取數(shù)據(jù)我需要獲得的輸出是
- 1 回答
- 0 關(guān)注
- 203 瀏覽
添加回答
舉報(bào)
0/150
提交
取消