[英]Mifare 1K writing data in two blocks
hello i'm working with APDU command for writting and reading a RFID card.您好,我正在使用 APDU 命令来读写 RFID 卡。 I can read from the block num 2 and write a data of 16 bytes.
我可以从块 num 2 中读取并写入 16 个字节的数据。 but i have a problem in writting a longer data so how can i mange i have tried to write in two blocks but it doesnt work.
但是我在写入更长的数据时遇到了问题,所以我该如何管理我试图在两个块中写入但它不起作用。 this the way that i have implemented my code in the operation of writing
这就是我在编写操作中实现代码的方式
// write...
//
if (nres == SM_SUCCESS)// &&
//bAPDURes )
{
nlenrcv = sizeof(btRcv);
nlencmd = 0;
btCmd[nlencmd++] = 0xFF; // CLA
btCmd[nlencmd++] = 0xD6; // INS
btCmd[nlencmd++] = 0x00; // P1, Mifare Block Number MSB, for mifare it is always 0x00
btCmd[nlencmd++] = 0x04; // P2, Mifare Block Number LSB
btCmd[nlencmd++] = 32; // Lc, Data Length
memcpy(btCmd + nlencmd, btWrite, 32);
nlencmd += 32;
nres = m_Smart.RFTransmit(DEV_INTERNALRF, nlencmd, btCmd, (DWORD*)&nlenrcv, btRcv);
You need to send each block separately.您需要分别发送每个块。 The Mifare Classic
Write
command will only write one block at once. Mifare Classic
Write
命令一次只能写入一个块。
See Section 12.3 of the Card's Data sheet请参阅卡数据表的第 12.3 节
So RFTransmit the write command for the first 16 bytes to the first block and RFTransmit the write command for the second 16 bytes to the next block.所以 RFTransmit 前 16 个字节的写命令到第一个块,RFTransmit 后 16 个字节的写命令到下一个块。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.