Design of RFID card reader based on STC11F32 single chip microcomputer

Publisher:数字小巨人Latest update time:2011-10-15 Keywords:STC11F32 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

introduction

Radio frequency identification technology (RFID) has been rapidly popularized and promoted for its high security and confidentiality, high-speed communication, ease of use, and low cost. It has been widely used in various access control systems, public transportation payment systems, medical insurance systems, parking management systems, warehouse management, vehicle anti-theft, etc., and has driven the development and promotion of readers and various application products. Based on the analysis of the composition and principle of the radio frequency identification system, this paper proposes a radio frequency reader design based on the STC11F32 high-speed microcontroller and the MFRC500 chip; at the same time, the dot matrix graphic LCD and serial memory W25X80, as well as USB chip CH340T and other peripheral devices are expanded on the card reader. The LCD can display various graphics and Chinese characters; the serial memory is used to store dot matrix fonts, graphic libraries, etc.; the USB chip enables the card reader to omit the serial port and power supply port, and can communicate with the PC management software through the USB interface. The card reader is easy to use, low cost, stable circuit operation, and can be applied to various occasions.

1 Composition and basic principles of RF reading and writing system

The most basic RFID system consists of 3 parts:

① Electronic tag (Tag, or RFID tag), composed of a chip and a built-in antenna. The chip stores electronic data in a certain format, which serves as the identification information of the item to be identified and is the real data carrier of the RFID system. The built-in antenna is used to communicate with the RFID antenna.

② Reader, a device that reads and writes electronic tag information. Its main task is to control the RF module to transmit a read signal to the tag and receive the tag's response; decode the tag's object identification information, and transmit the object identification information and other related information on the tag to the host for processing.

③Antenna: the transmitting and receiving device for transmitting data between the tag and the reader.

The basic principle of the radio frequency reading and writing system is as follows: the reader sends a set of electromagnetic waves of fixed frequency to the card. There is an LC series resonant circuit in the card, and its frequency is the same as the frequency emitted by the reader. Under the stimulation of the electromagnetic wave, the LC resonant circuit resonates, so that there is charge in the capacitor. A unidirectional electron pump is connected to the other end of this capacitor to send the charge in the capacitor to another capacitor for storage. When the accumulated charge reaches 2 V, this capacitor can be used as a power supply to provide working voltage for other circuits, transmit the data in the card or access the data of the reader.

2 Card Reader Hardware Design

STC11F32 is a single clock/machine cycle (1T) microcontroller produced by Hongjing Technology Co., Ltd. It is a new generation of 8051 microcontroller with high speed, low power consumption and super anti-interference ability. The instruction code is fully compatible with the traditional 8051, but the speed is 8 to 12 times faster. It has an internal integrated high-reliability reset circuit and can be used in high-speed communication, intelligent control, strong interference and other occasions; it has 32 KB Flash, 29KB EEPROM and 1 280 bytes of SRAM; EA, ALE, PSEN and RST pins can be defined as general I/O, that is, 4 P4 pins; programming supports ISP download function, which is convenient to use.

MFRC500 is a member of Philips' highly integrated card reader IC series for 13.56 MHz contactless communication. This card reader IC series uses advanced modulation and demodulation concepts to fully integrate all types of passive contactless communication methods and protocols at 13.56 MHz. MFRC500 supports all layers of ISO 14443A. The internal transmitter part can directly drive the antenna at a short operating distance (up to 10 cm) without adding active circuits; there are many ways to interface with the microcontroller, either using bus extension or analog bus.

In order to use the 1 KB extended SRAM inside STC11F32, the analog bus interface is used, that is, the P0 port of the microcontroller is connected to the D0~D7 of MFRC500, and EA, ALE, WR, RD, etc. are used as control lines to connect to the NCS, ALE, NWR, NRD, etc. of MFRC500 respectively. Because it is an analog bus method, a pull-up resistor must be added to the P0 port of the microcontroller. Using the analog bus method is a common method, especially for microcontrollers that do not support bus expansion. The use of the analog bus method in this design can prevent bus conflicts between MFRC500 and the RAM inside the microcontroller. Figure 1 is the system hardware schematic diagram of the card reader.

System hardware schematic diagram of the card reader

Click to see the original image


CH340T is a USB bus adapter chip produced by Nanjing Qinheng Company. It can realize USB to serial port conversion and is used to expand asynchronous serial ports for computers, or directly upgrade ordinary serial port devices to USB bus. CH340T is a full-speed USB device interface, compatible with USB V2.0. Peripheral components only require crystals and capacitors. The hardware is a full-duplex serial port with a built-in transceiver buffer, supporting communication baud rates of 50 bps to 2 Mbps. It supports commonly used Modem communication signals RTS, DTR, DCD, RI, DSR, etc. CH340T eliminates the serial port and power supply port for the card reader, and can communicate with PC management software through the USB interface.

The LCD uses a dot matrix graphic LCD module FG12864E without a character library. In order to make the card reader applicable to occasions such as library book management that require Chinese character display, the GB2312 Chinese character library and other picture libraries are designed by using the serial memory W25X80. Serial memory is popular for its small size, high density, low power consumption, low price and simple operation. The W25X80 produced by Winbond is an 8 Mb serial memory, divided into 4 096 pages, each page is a 256-byte storage unit, and has a 256-byte buffer and SPI interface. Using Flash to design a Chinese character library is not only very simple to operate, but also can be flexibly applied to multiple design schemes.

3 Card Reader Software Design

The simulation communication between STC11F32 and MFRC500 is the most critical step in software design, because only by opening up the key link of the underlying communication can STC11F32 further realize the basic operation of reading and writing cards by controlling MFRC500. In order to achieve this step, we must first figure out the read and write timing of MFRC500. This design adopts the method of independent read/write strobe and multiplexed address bus. In this way, the read and write timing of MFRC500 is shown in Figure 2.

MFRC500 read and write timing

Based on this timing diagram, the C language implementation code for the STC11F32 microcontroller to read and write one byte from MFRC500 can be written.

(1) Read a data from an address

program

STC11F32 mainly implements complex read and write control of MFRC500 by calling these two most basic functions. The biggest advantage of using analog bus communication is that the code written in C language can be easily transplanted to various microcontrollers that do not support bus expansion, which enhances the reusability and portability of software modules. After opening up the key links of the underlying communication, each software module can be written and debugged. The overall software process is shown in Figure 3.

The overall software process is shown in the figure

program

After the system is powered on, the I/O pins and serial port of STC11F32 must be initialized first. The I/O setting mainly defines the special pins of STC11F32 (such as EA, ALE, PSEN, etc.) as general I/O to facilitate analog communication with MFRC500. After that, the reset of MFRCS00 must be delayed long enough to ensure that MFRC500 is reset reliably. During the reset process, some register bits of MFRC500 are preset by hardware; after the reset is successful, the necessary configuration of each register of MFRC500 is required.

After the LCD initialization is completed, the LCD will display the relevant prompt information of the system, and then wait for the user to enter the command from the serial port or key, perform the corresponding operation according to the command entered by the user, and return the result of the execution operation to the user and display it on the LCD.

Conclusion

This paper uses the high-speed, low-cost single-chip microcomputer STC11F32 of Hongjing Technology and the MFRC500 chip of Philips to design a contactless radio frequency card reader; according to the standard of ISO/IEC 14443, the design of system hardware and software is completed. It has been proved in actual use that the card reader has stable operation, strong anti-interference ability, high cost performance, flexible operation, and strong market competitiveness.

Keywords:STC11F32 Reference address:Design of RFID card reader based on STC11F32 single chip microcomputer

Previous article:Application of MSP430 MCU in Micro Low Power Data Broadcast Receiver
Next article:Design of colored lights based on single chip microcomputer

Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号