RC522 Write a Card Demo Code
It is very easy and common to read the RFID card ID, which is the first 4 bytes of the data area, and used to identify the card holder. But also a lot of people ask if the RC522 can write a RFID card or not, the answer is yes, now we have a demo here. It tells how to write data after the first address block 0 from block 1, to store your data there.
Please read more data structure info about the RC522 card, there are 0-63 blocks, each 4 blocks (0,1,2,3) in a line of a sector, the key data are stored in the block 3 (called trailer), see the data structure here below:
I am using a ACR122U-A9 card reader to read and write data with the software tool called NFCGUIFreeVer.exe here.
It is very risky to overwrite the card ID or key, will permanent lock card, so be careful unless you really know how to do it.
Demo Code available for downloading after purchase.
Edit the block address from 1~63 to store data inside, we have set it to 1 default, which will write data just after the card ID (first block 0). and finally I use the tool to see how the data update inside:Tagged