RFID Reader Programming Instruction
RFID Reader Programming Instruction
Sample:
The first card’s UID is “9A08AA71”,so the RFID reader send response of the
command and insert “00” behind the “AA” of the UID, but the length byte is
still 06. So, if you find the is “AA” in the data, then remove one byte of “00” next
to the “AA”. If there are 2 bytes of “00”, just remove the first byte of “00”. For
example, the received data includes “AA0000”, then you just need to remove
one “00”, and save the next “00”, finally the result is “AA00”.
The second card’s UID is “028FA90B”, it has no “AA” inside, so it needs not to
add “00” behind “AA”.
---------------------------------------------------------------------
Send command code example:
void UartSend(unsigned char *cSendBuffer)
unsigned char i;
unsigned char cCheckSum;
TXC = 1;
g_bReceCommandOk = 0;
UDR = 0xAA;
while (!TXC);
TXC = 1;
UDR = 0xBB; // send header AABB
while (!TXC);
cCheckSum = 0;
for (i=0; i<cSendBuffer[0]; i++)
{
cCheckSum ^= cSendBuffer[i];
TXC = 1;
UDR = cSendBuffer[i];
while (!TXC);
if (cSendBuffer[i] == 0xAA)
// if there is a "0xAA" in the data field but not the command header,
// add a "0x00" follow the "0xAA", CL (command length) will not changed.
{
TXC = 1;
UDR = 0; // insert “00” next to the “AA”
while (!TXC);
}
}
TXC = 1;
UDR = cCheckSum; // Send check sum byte
while (!TXC);
TXC = 1;
}
-------------------------------------------------------------------------------------------
Contact Information:
Ehuoyan Co.,Ltd.
Tel: +86-010-80128328
email: [email protected]
Web Site : http://www.ehuoyan.com/english/default.asp
----------------------------------------------------------------------------------------