Difference between revisions of "Component: RFID (MFRC522) (Wireless)"
Line 80: | Line 80: | ||
{{Fcfile|MFRC522_Read_Write.fcfx|Read Write Test}} | {{Fcfile|MFRC522_Read_Write.fcfx|Read Write Test}} | ||
+ | |||
+ | |||
Line 85: | Line 87: | ||
==Macro reference== | ==Macro reference== | ||
+ | ===CompareUID=== | ||
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- | ||
Line 118: | Line 121: | ||
+ | ===IsNewCardPresent=== | ||
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- | ||
Line 131: | Line 135: | ||
+ | ===GetType=== | ||
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- | ||
Line 149: | Line 154: | ||
+ | ===AntennaOff=== | ||
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- | ||
Line 162: | Line 168: | ||
+ | ===ReadCardSerial=== | ||
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- | ||
Line 175: | Line 182: | ||
+ | ===MifareWrite=== | ||
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- | ||
Line 203: | Line 211: | ||
+ | ===Select=== | ||
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- | ||
Line 221: | Line 230: | ||
+ | ===StopCrypto=== | ||
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- | ||
Line 234: | Line 244: | ||
+ | ===MifareRead=== | ||
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- | ||
Line 262: | Line 273: | ||
+ | ===Authenticate=== | ||
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- | ||
Line 290: | Line 302: | ||
+ | ===HaltA=== | ||
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- | ||
Line 303: | Line 316: | ||
+ | ===ReadUIDByte=== | ||
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- | ||
Line 321: | Line 335: | ||
+ | ===AntennaOn=== | ||
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- | ||
Line 334: | Line 349: | ||
+ | ===Initialise=== | ||
{| class="wikitable" style="width:60%; background-color:#FFFFFF;" | {| class="wikitable" style="width:60%; background-color:#FFFFFF;" | ||
|- | |- |
Revision as of 11:51, 3 February 2023
Author | Ben Rowland and STibor |
Version | 3.0 |
Category | Wireless |
Contents
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
CompareUID
CompareUID | |
Compares the UID from the ReadCardSerial macro with 4 byte UID. Returns 0 if the addresses match. | |
- BYTE | Add0 |
- BYTE | Add1 |
- BYTE | Add2 |
- BYTE | Add3 |
- BYTE | Return |
IsNewCardPresent
IsNewCardPresent | |
Is there a card present for us to communicate with. Returns 0 for no card and 1 for valid card present. | |
- BYTE | Return |
GetType
GetType | |
Translates the SAK (Select Acknowledge) to a PICC type | |
- BYTE | sak |
The SAK byte returned from PICC_Select | |
- BYTE | Return |
AntennaOff
AntennaOff | |
Switches off the RFID antenna to save power. The antenna must be switched on again before communicating with an RFID tag. | |
- VOID | Return |
ReadCardSerial
MifareWrite
MifareWrite | |
Writes to a block of data on a MIFARE type tag | |
- BYTE | BlockAddress |
- BYTE | Buffer |
- BYTE | BufferSize |
- BYTE | Return |
Select
Select | |
- BYTE | ValidBits |
- BYTE | 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. | |
- VOID | Return |
MifareRead
MifareRead | |
Reads from a block of data on a MIFARE type tag | |
- BYTE | BlockAddress |
- BYTE | Buffer |
- BYTE | BufferSize |
- BYTE | Return |
Authenticate
HaltA
HaltA | |
Instructs a PICC in state ACTIVE(*) to go to state HALT | |
- BYTE | Return |
ReadUIDByte
ReadUIDByte | |
- BYTE | Index |
0-9 = UID Data Bytes, 10 = UID Length, 11 = UID SAK | |
- BYTE | Return |
AntennaOn
AntennaOn | |
Switches on the RFID antenna. Called as part of the Initialise macro. | |
- VOID | Return |
Initialise
Initialise | |
Initialises the RFID module ready for interaction with RFID tags. | |
- VOID | Return |