Component: RFID (MFRC522) (Wireless): Difference between revisions
m Text replacement - "class="wikitable" style="width:60%; background-color:#FFFFFF;"" to "class="mtx-class-macrotable wikitable"" |
m Text replacement - "width="10%" align="center" style="background-color:#D8C9D8;" align="center"" to "width="10%" align="center" class="mtx-class-macrohead"" |
||
| Line 96: | Line 96: | ||
{| class="mtx-class-macrotable wikitable" | {| class="mtx-class-macrotable wikitable" | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''AntennaOff''' | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''AntennaOff''' | ||
|- | |- | ||
| Line 110: | Line 110: | ||
{| class="mtx-class-macrotable wikitable" | {| class="mtx-class-macrotable wikitable" | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''AntennaOn''' | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''AntennaOn''' | ||
|- | |- | ||
| Line 124: | Line 124: | ||
{| class="mtx-class-macrotable wikitable" | {| class="mtx-class-macrotable wikitable" | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Authenticate''' | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Authenticate''' | ||
|- | |- | ||
| Line 153: | Line 153: | ||
{| class="mtx-class-macrotable wikitable" | {| class="mtx-class-macrotable wikitable" | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''CompareUID''' | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''CompareUID''' | ||
|- | |- | ||
| Line 187: | Line 187: | ||
{| class="mtx-class-macrotable wikitable" | {| class="mtx-class-macrotable wikitable" | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetType''' | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''GetType''' | ||
|- | |- | ||
| Line 206: | Line 206: | ||
{| class="mtx-class-macrotable wikitable" | {| class="mtx-class-macrotable wikitable" | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''HaltA''' | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''HaltA''' | ||
|- | |- | ||
| Line 220: | Line 220: | ||
{| class="mtx-class-macrotable wikitable" | {| class="mtx-class-macrotable wikitable" | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Initialise''' | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Initialise''' | ||
|- | |- | ||
| Line 234: | Line 234: | ||
{| class="mtx-class-macrotable wikitable" | {| class="mtx-class-macrotable wikitable" | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''IsNewCardPresent''' | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''IsNewCardPresent''' | ||
|- | |- | ||
| Line 248: | Line 248: | ||
{| class="mtx-class-macrotable wikitable" | {| class="mtx-class-macrotable wikitable" | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''MifareRead''' | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''MifareRead''' | ||
|- | |- | ||
| Line 277: | Line 277: | ||
{| class="mtx-class-macrotable wikitable" | {| class="mtx-class-macrotable wikitable" | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''MifareWrite''' | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''MifareWrite''' | ||
|- | |- | ||
| Line 306: | Line 306: | ||
{| class="mtx-class-macrotable wikitable" | {| class="mtx-class-macrotable wikitable" | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ReadCardSerial''' | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ReadCardSerial''' | ||
|- | |- | ||
| Line 320: | Line 320: | ||
{| class="mtx-class-macrotable wikitable" | {| class="mtx-class-macrotable wikitable" | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ReadUIDByte''' | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''ReadUIDByte''' | ||
|- | |- | ||
| Line 339: | Line 339: | ||
{| class="mtx-class-macrotable wikitable" | {| class="mtx-class-macrotable wikitable" | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Select''' | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''Select''' | ||
|- | |- | ||
| Line 358: | Line 358: | ||
{| class="mtx-class-macrotable wikitable" | {| class="mtx-class-macrotable wikitable" | ||
|- | |- | ||
| width="10%" align="center" | | width="10%" align="center" class="mtx-class-macrohead" | [[File:Fc9-comp-macro.png]] | ||
| width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''StopCrypto''' | | width="90%" style="background-color:#D8C9D8; color:#4B008D;" | '''StopCrypto''' | ||
|- | |- | ||
Revision as of 14:17, 13 July 2026
| Author | Ben Rowland and STibor |
| Version | 3.0 |
| Category | Wireless |
RFID (MFRC522) component
Functions designed to work with the MFRC522 contactless reader IC. The MFRC522 supports all variants of the MIFARE Mini, MIFARE 1K, MIFARE 4K, MIFARE Ultralight, MIFARE DESFire EV1 and MIFARE Plus RF identification protocols.
Component Source Code
Please click here to download the component source project: FC_Comp_Source_MFRC522.fcfx
Please click here to view the component source code (Beta): FC_Comp_Source_MFRC522.fcfx
Detailed description
No detailed description exists yet for this component
Examples
Here is a basic example program that reads the UID from a Mifare RFID tag and displays on an LCD. If the UID matches the UID stored in memory then a solenoid will fire allowing a door to be unlocked etc.
Here is a basic example program to read and modify data stored on a Mifare RFID tag.
Macro reference
AntennaOff
| AntennaOff | |
| Switches off the RFID antenna to save power. The antenna must be switched on again before communicating with an RFID tag. | |
| Return | |
AntennaOn
| AntennaOn | |
| Switches on the RFID antenna. Called as part of the Initialise macro. | |
| Return | |
Authenticate
CompareUID
| CompareUID | |
| Compares the UID from the ReadCardSerial macro with 4 byte UID. Returns 0 if the addresses match. | |
| Add0 | |
| Add1 | |
| Add2 | |
| Add3 | |
| Return | |
GetType
| GetType | |
| Translates the SAK (Select Acknowledge) to a PICC type | |
| sak | |
| The SAK byte returned from PICC_Select | |
| Return | |
HaltA
| HaltA | |
| Instructs a PICC in state ACTIVE(*) to go to state HALT | |
| Return | |
Initialise
| Initialise | |
| Initialises the RFID module ready for interaction with RFID tags. | |
| Return | |
IsNewCardPresent
| IsNewCardPresent | |
| Is there a card present for us to communicate with. Returns 0 for no card and 1 for valid card present. | |
| Return | |
MifareRead
| MifareRead | |
| Reads from a block of data on a MIFARE type tag | |
| BlockAddress | |
| Buffer | |
| BufferSize | |
| Return | |
MifareWrite
| MifareWrite | |
| Writes to a block of data on a MIFARE type tag | |
| BlockAddress | |
| Buffer | |
| BufferSize | |
| Return | |
ReadCardSerial
ReadUIDByte
| ReadUIDByte | |
| Index | |
| 0-9 = UID Data Bytes, 10 = UID Length, 11 = UID SAK | |
| Return | |
Select
| Select | |
| ValidBits | |
| Return | |
StopCrypto
| StopCrypto | |
| Used to exit the PCD from its authenticated state. Remember to call this function after communicating with an authenticated PICC - otherwise no new communications can start. | |
| Return | |