在向其写入命令后尝试读取 RFID reader 的响应,但得到空响应
Trying to read RFID reader's response after writing a command to it, but getting an empty response
RFID名称:YHY502CTG 13.56MHz RFID Mifare Read/Write模块
我正在尝试将此命令 "AA BB 02 20 22" 写入 RFID,作为响应我将得到
1) if no card is swiped == "AA BB 02 DF DD" .
Where "AA BB" == Head of this DATA ,
02 == Length of this DATA,
"DF" == One's complement of COMMAND,
02⊕DF(XOR) == "DD"
2) if there is card swipe == "AA BB 06 20 A0 8C 92 54 CC"
where "AA BB" == Head of this DATA ,
06 == Length of this DATA,
20 == COMMAND,
"A0 8C 92 54" == Card Serial Number,
06⊕20⊕A0⊕8C⊕92⊕54(XOR) == "CC".
CODE:-
byte[] bytesToSend = new byte[10] { 0x41, 0x41, 0x42, 0x42, 0x30, 0x32, 0x32, 0x30, 0x32, 0x32 };
_comport.Write(bytesToSend,0,10);// dont know whether ----correct way to write , but working properly//
System.Threading.Thread.Sleep(1000);
var data1 = _comport.ReadExisting();//getting an empty response
MessageBox.Show(data1);
我也遇到了同样的问题。我假设你通过串行端口与你的 reader 通信?
尝试安装free serial analyzer工具,通过这个工具可以查看发送的数据和接收的数据,排除编码错误。
reader 是否有任何软件可以访问它?对我来说,它首先帮助通过附带的软件连接和断开连接到我的 reader,然后当我通过我自己的代码发送命令时,我得到了 reader 的响应。不幸的是,我不知道为什么,我仍在寻找更好的方法。
RFID名称:YHY502CTG 13.56MHz RFID Mifare Read/Write模块
我正在尝试将此命令 "AA BB 02 20 22" 写入 RFID,作为响应我将得到
1) if no card is swiped == "AA BB 02 DF DD" .
Where "AA BB" == Head of this DATA ,
02 == Length of this DATA,
"DF" == One's complement of COMMAND,
02⊕DF(XOR) == "DD"
2) if there is card swipe == "AA BB 06 20 A0 8C 92 54 CC"
where "AA BB" == Head of this DATA ,
06 == Length of this DATA,
20 == COMMAND,
"A0 8C 92 54" == Card Serial Number,
06⊕20⊕A0⊕8C⊕92⊕54(XOR) == "CC".
CODE:-
byte[] bytesToSend = new byte[10] { 0x41, 0x41, 0x42, 0x42, 0x30, 0x32, 0x32, 0x30, 0x32, 0x32 };
_comport.Write(bytesToSend,0,10);// dont know whether ----correct way to write , but working properly//
System.Threading.Thread.Sleep(1000);
var data1 = _comport.ReadExisting();//getting an empty response
MessageBox.Show(data1);
我也遇到了同样的问题。我假设你通过串行端口与你的 reader 通信?
尝试安装free serial analyzer工具,通过这个工具可以查看发送的数据和接收的数据,排除编码错误。
reader 是否有任何软件可以访问它?对我来说,它首先帮助通过附带的软件连接和断开连接到我的 reader,然后当我通过我自己的代码发送命令时,我得到了 reader 的响应。不幸的是,我不知道为什么,我仍在寻找更好的方法。