Component: RFID (MFRC522) (Wireless)

From Flowcode Help
Jump to navigationJump to search
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.

FC6 Icon.png Display UID


Here is a basic example program to read and modify data stored on a Mifare RFID tag.

FC6 Icon.png Read Write Test






Macro reference

AntennaOff

Fc9-comp-macro.png AntennaOff
Switches off the RFID antenna to save power. The antenna must be switched on again before communicating with an RFID tag. 
Fc9-void-icon.png - VOID Return


AntennaOn

Fc9-comp-macro.png AntennaOn
Switches on the RFID antenna. Called as part of the Initialise macro. 
Fc9-void-icon.png - VOID Return


Authenticate

Fc9-comp-macro.png Authenticate
This command manages MIFARE authentication to enable a secure communication to any MIFARE Mini, MIFARE 1K and MIFARE 4K card. All keys are set to FFFFFFFFFFFFh at chip delivery. The authentication is described in the MFRC522 datasheet section 10.3.1.9. 
Fc9-u8-icon.png - BYTE Command
PICC_CMD_MF_AUTH_KEY_A or PICC_CMD_MF_AUTH_KEY_B 
Fc9-u8-icon.png - BYTE BlockAddress
The block number 
Fc9-u8-icon.png - BYTE Key
Crypteo key to use 
Fc9-u8-icon.png - BYTE Return


CompareUID

Fc9-comp-macro.png CompareUID
Compares the UID from the ReadCardSerial macro with 4 byte UID. Returns 0 if the addresses match. 
Fc9-u8-icon.png - BYTE Add0
 
Fc9-u8-icon.png - BYTE Add1
 
Fc9-u8-icon.png - BYTE Add2
 
Fc9-u8-icon.png - BYTE Add3
 
Fc9-u8-icon.png - BYTE Return


GetType

Fc9-comp-macro.png GetType
Translates the SAK (Select Acknowledge) to a PICC type 
Fc9-u8-icon.png - BYTE sak
The SAK byte returned from PICC_Select 
Fc9-u8-icon.png - BYTE Return


HaltA

Fc9-comp-macro.png HaltA
Instructs a PICC in state ACTIVE(*) to go to state HALT 
Fc9-u8-icon.png - BYTE Return


Initialise

Fc9-comp-macro.png Initialise
Initialises the RFID module ready for interaction with RFID tags. 
Fc9-void-icon.png - VOID Return


IsNewCardPresent

Fc9-comp-macro.png IsNewCardPresent
Is there a card present for us to communicate with. Returns 0 for no card and 1 for valid card present. 
Fc9-u8-icon.png - BYTE Return


MifareRead

Fc9-comp-macro.png MifareRead
Reads from a block of data on a MIFARE type tag 
Fc9-u8-icon.png - BYTE BlockAddress
 
Fc9-u8-icon.png - BYTE Buffer
 
Fc9-u8-icon.png - BYTE BufferSize
 
Fc9-u8-icon.png - BYTE Return


MifareWrite

Fc9-comp-macro.png MifareWrite
Writes to a block of data on a MIFARE type tag 
Fc9-u8-icon.png - BYTE BlockAddress
 
Fc9-u8-icon.png - BYTE Buffer
 
Fc9-u8-icon.png - BYTE BufferSize
 
Fc9-u8-icon.png - BYTE Return


ReadCardSerial

Fc9-comp-macro.png ReadCardSerial
Simple wrapper around PICC_Select. Returns true if a UID could be read. Remember to call PICC_IsNewCardPresent(), PICC_RequestA() or PICC_WakeupA() first. The read UID is available in the class variable uid. 
Fc9-u8-icon.png - BYTE Return


ReadUIDByte

Fc9-comp-macro.png ReadUIDByte
 
Fc9-u8-icon.png - BYTE Index
0-9 = UID Data Bytes, 10 = UID Length, 11 = UID SAK 
Fc9-u8-icon.png - BYTE Return


Select

Fc9-comp-macro.png Select
 
Fc9-u8-icon.png - BYTE ValidBits
 
Fc9-u8-icon.png - BYTE Return


StopCrypto

Fc9-comp-macro.png 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. 
Fc9-void-icon.png - VOID Return


Property reference

Fc9-prop-icon.png Properties
Fc9-conn-icon.png Connections
Fc9-type-16-icon.png Channel
SPI Channel selector 
Fc9-type-16-icon.png Prescale
Prescale option selector 
Fc9-type-5-icon.png MOSI
SPI Data Out Pin SDO - Also Known as Master Out Slave In (MOSI) when used in Master mode. 
Fc9-type-5-icon.png MISO
SPI Data In Pin SDI - Also Known as Master In Slave Out (MISO) when used in Master mode. 
Fc9-type-5-icon.png CLK
SPI Clock Pin CLK - The Clock signal is driven by the SPI master. 
Fc9-type-5-icon.png CS / SS
Chip Select / Slave Select Pin Master Mode: General purpose output pin used to select the remote SPI device. Slave Mode: Hardware chip select pin input used to select the SPI device.  
Fc9-type-5-icon.png Reset
MFRC522 Reset Pin  
Fc9-conn-icon.png Simulation
Fc9-type-10-icon.png Label
 
Fc9-type-7-icon.png Scope Traces
Selects if the scope traces are automatically generated or not 
Fc9-type-7-icon.png Console Data
Selects if the console data is automatically generated or not 
Fc9-type-16-icon.png API