Breaking News
Home / How To / Arduino RC522 Basics

Arduino RC522 Basics



As in the PIC application, there are two versions of software. One is a demo of the basic read / write function for a tag and the other is an example of using a tag as an electronic wallet. For the most part, they are direct translations of the PIC assembly language. There are some subtle differences in implementation but nothing really changes the functionality.

The basic version uses an arbitrary data pattern that may be modified each loop by the code. The electronic wallet version has an initialized credit value of "0" and there are defined values ​​in front of the software for the amounts to increase or decrease the stored credits. Keep in mind that these values ​​are in packed BCD formats. This means that a value of "0x1

2" represents twelve.

Since everything is stored in packed BCD, the increment and reduction matrix must include correction of the results. This operation is called "Decimal Adjust" and some microcontrollers contain specific instructions for both DAA (Decimal Adjust Add) and DAS (Decimal Adjust Subtract). The PIC I used in the original implementation did not have that possibility so I wrote a couple of macros to handle it. I needed to calculate the corresponding software for Arduino and found a DAA function online but not a DAS function so I wrote my own.

That's it for this post. Check out my other instructors and also my website at: www.boomerrules.wordpress.com


Source link