简体   繁体   English

Mifare 1K 分两块写入数据

[英]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.

相关问题 如何使用 QtNfc 从 Android 上的 Mifare 1k 获取 SAK? - How to get SAK from Mifare 1k on Android with QtNfc? 无法检索添加到 1k Mifare Classic 标签的 390 个字符的文本记录 - Can't retrieve the 390-characters text record added to 1k Mifare Classic tag c ++-处理大型数据集-算法结果与1k项测试匹配,但在100万项测试中失败-相同算法 - c++ - working with large data set - algorithm results match for 1k entries test but fail at 1million entries test - same algorithm c++ 将 1K 转换为 1000,将 1M 转换为 1000000, - c++ converting 1K to 1000, 1M to 1000000, 在一条UDP消息中发送两个数据块而不复制这些块? - Sending two data blocks in one UDP message without copying the blocks? 当我使用new运算符分配大小为1k字节的内存时,操作系统在Windows中会做什么? - what will OS do in Windows when I use the operator new to allocate memory with the size of 1k bytes? 将两个相关类的数据写入文件 - Writing data from two related classes into a file MPI_File_write_at:两次写入相同的结构会导致二进制文件中的数据块略有不同 - MPI_File_write_at : Writing the same struct twice results in slightly different data blocks in binary file lpcxpresso与Cortex-M3:什么是libc.a(lib_a-impure.o)为什么它使用1k的ram? - lpcxpresso with Cortex-M3: what is libc.a(lib_a-impure.o) any why is it using 1k of ram? Code::Blocks 用其他语言编写代码 - Code::Blocks writing code in other language
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM