Browse Source

刷卡机修改

Lishi
xxe 2 years ago
parent
commit
69f386d457
2 changed files with 13 additions and 2 deletions
  1. +1
    -0
      HKControl/Main.cs
  2. +12
    -2
      UHFHelper/UHF_RS485_Helper.cs

+ 1
- 0
HKControl/Main.cs View File

@@ -146,6 +146,7 @@ namespace HKControl

private void Control(int num, string add)
{
Debug.WriteLine($"{num} 号出餐口控制");
SiemensDicitonary[num].Write(add, true);
Thread.Sleep(1000);
SiemensDicitonary[num].Write(add, false);


+ 12
- 2
UHFHelper/UHF_RS485_Helper.cs View File

@@ -258,8 +258,18 @@ namespace UHFHelper
/// </summary>
public void OpenBeep(int addr)
{
byte[] sendData = new byte[] { 0x07, (byte)addr, 0x33, 0x08, 0x02, 0x03, 0x33, 0xB1 };

//byte[] sendData = new byte[] { 0x07, (byte)addr, 0x33, 0x08, 0x02, 0x03, 0x33, 0xB1 };
byte[] data1 = new byte[6] { 0x07, (byte)addr, 0x33, 0x08, 0x02, 0x03 };
//生成crc校验码
byte[] data2 = CRC16.ToCRC16(data1);
byte[] data3 = new byte[data1.Length + data2.Length];
data1.CopyTo(data3, 0);
data2.CopyTo(data3, data1.Length);
if (_serialPort != null)
{
_serialPort.DiscardInBuffer();
_serialPort.Write(data3, 0, data3.Length);
}
}
}



Loading…
Cancel
Save