Non-contact IC card reader module experiment
First, the purpose of the experiment
1. Master the application of 8255 programmable parallel port 2. Master the principle and programming method of non-contact IC card reader and M1 card 3. Master the interface between LCD module and MCU and programming method
Second, the experimental equipment
EL-MUT-III type single-chip experimental box, 8051CPU module, non-contact IC card module.
Third, the experimental content
The M1 card is read/written with a non-contact IC card reader module.
Fourth, the experimental principle
After power-on, first use the program to initialize the register of the card reader chip (hereinafter referred to as PCD), and then enter the card-seeking state after completion, and issue a card-seeking signal through the antenna. When there is an IC card (hereinafter referred to as PICC, the card used in the experimental program is the MF1 S50 card) enters the effective operation area of ​​the antenna, and after receiving energy, it returns to the PCD card type value. Next, the PCD performs anti-collision operation on the card. After the PICC obtains the anti-collision operation signal, it returns to the PCD card serial number. After the PCD receives the serial number, the program determines the validity of the serial number. After confirming that the PICC serial number is valid, the PCD sends a card selection command, and the card selection includes sending the selected card serial number, so that the card for the next operation is unique. The PCD loads the key. The key is the same as the PICC sector key to be operated. The same fan has two sets of keys, keys A and B. If the A key is authenticated, the key is the A key. For the B key authentication, the B key is required. After the key is successfully loaded, the authentication operation is started three times.
The following figure shows the block diagram of the token for three-pass authentication:
The certification process is carried out like this:
(A) ring: a random data RB is sent to the reader by the Mifare 1 card;
(B) ring: after receiving the RB by the reader, send a token data TOKEN AB to the Mifare 1 card, which contains a random data RA sent by the reader;
(C) Ring: After receiving the TOKEN AB, the Mifare 1 card decrypts the encrypted portion of TOKEN AB and verifies whether the random number RB sent by the Mifare 1 card in the (A) ring is the first time (B) The RBs in the TOKEN AB received in the ring are consistent;
(D) Ring: If the (C) ring check is correct, the Mifare 1 card sends the token TOKEN BA to the reader to the reader;
(E) Ring: After the reader receives the token TOKEN BA, the reader will decrypt the RB (random number) in the token TOKEN BA; and verify the first time by the (B) ring reader Whether the outgoing random number RA is consistent with the RA in the TOKEN BA received in the (D) ring;
If each of the above rings is "true" and can pass the verification correctly, the entire authentication process will succeed.
The reader will be able to proceed to the next step (READ/WRITE, etc.) for this sector on the card that has just been authenticated. Other sectors in the card cannot be further manipulated because they have their own passwords. If you want to operate on other sectors, you must complete the above certification process.
Any part of the certification process will be wrong and the entire certification will fail. Must start from scratch. If the password on the card is not known in advance, the change in the password can be extremely complicated, so the possibility of opening a sector on the card by guessing the password is almost zero.
Here to remind programmers and card users, you must keep in mind every password in the 16 sectors of the card, otherwise, forgetting the password of a certain sector will make the data in the sector unreadable. There is no way to save this low-level mistake. However, other sectors on the card can be used as they are.
The above description can fully explain the high security, confidentiality, and card application diversity of the Mifare 1 card, and one card multi-purpose (one card).
For detailed operation, refer to the FM1702 manual, MF1 S50 manual, and 14443 protocol.
Fifth, the experimental schematic:
1. Experimental connection:
The chip select CS8255 of 8255 is connected to CS2; PA0~PA7 are connected to DB0~DB7 respectively; PC0 is connected with REQ; PC7 is connected with BUSY. The card reader module selects CS500 to connect to CS0, or uses jumper to short-circuit the module on CS0, EST to connect to the CPU board's TXD, the CPU board's RXD to the experimental box K1, K1 to control the card, and the low level to control the card. P0.0~P0.7 are connected to LED1~LED8 respectively to dynamically observe the specific position where the program is executed. These 8 lines can not be connected. LED1 card search success, LED2 anti-collision success, LED3 card selection success, LED4 load key success, LED5 verification AUTHENT1 success, LED6 verification AUTHENT2 success, LED7 card reading success, LED8 card success.
2. Run the experiment program at full speed: OK_STD.ASM
3. The M1 card is gradually lowered horizontally closer to the card reading module above the antenna of the card reading module, and the LCD display content is observed.
4. Change the K1 state and repeat step 3 again.
Seven, the experimental results
When K1 goes high, the first line on the LCD displays: CARD_SN: + M1 card serial number, the second line shows read operation: READ_CARD: The third and fourth lines show 16 8-bit 16-inputs read from the M1 card. Data. When K1 goes low, the first line on the LCD displays: CARD_SN: + M1 card serial number, the second line shows read operation: WRITE_CARD: The third and fourth lines show 16 8-bit hexadecimals written to the M1 card. data.
Eight, the block diagram
Kids Like and Creative Toys are divided into 1, wooden simulation toy model 2, building block toys 3, intelligence assembling toys 4, remote control toys 5, puzzle toys 6, Rubik's cube, etc. People who often play Educational Toys have higher open thinking ability.
Kids Toys in addition to developing intelligence, it also have more functions. For example, the design of bright colors, attractive lines of educational toys can stimulate children's vision; And a grip on the ring "ring", a press issued a variety of animal sounds of the "small piano" can stimulate children's hearing; Rolling colored balls develop a child's sense of touch. Therefore, different educational toys are effective tools to assist children to understand the world, to help them with the body of various sensory responses, to contact and cognition of novel everything. Children play Baby Toys at the same time, language ability, emotional release, hands-on ability and so on have been improved.
Kids Toys,Educational Toys,Baby Toys,Children'S Toys
NINGBO MACEY EDUCATION PRODUCT CO.,LTD , https://www.maceycreative.com