1. Introduction
IC card is the abbreviation of Integrated Circuit Card. Some countries and regions call it Microchip Card or Microcircuit Card. The size of IC card is the same as that of magnetic card. It embeds integrated circuit on plastic card. The chip is generally a memory (ROM, EPROM.EPROM) that is not easy to lose data, a protection logic circuit, or a CPU. IC card was originally designed to solve the security problem in financial transactions. It brings a new transaction concept and huge advantages. Soon, this advantage was also noticed by other application departments, making it widely used in telephone, health care, road control and door lock control systems. As time goes by, the scope of application is still expanding, and the number of IC cards in use is growing exponentially. At the same time, in order to meet the needs of different application occasions, IC card manufacturers are still constantly launching new IC cards to the market. The price of IC cards will decrease year by year as the usage increases. All of these will undoubtedly greatly promote the popularization of IC cards in various fields. Wireless SOC development platform 499 yuan S3C44B0 ARM7 development board 378 yuan S3C2410 ARM9 development board 780 yuan AT91SAM7S64 ARM7
According to the data exchange method between IC card and reading and writing equipment, IC card can be divided into contact IC card and contactless IC card. Contact IC card is an IC card that exchanges data by directly contacting and connecting the integrated circuit of the card with the external interface device through tangible electrode contacts when in use. Contactless IC card communicates the data in the integrated circuit of the card with the external device interface device through radio waves or electromagnetic field induction. The card can read and write data without directly contacting the electrodes of the interface device. According to the function and structure of IC card, IC card can be divided into storage IC card and smart IC card. Storage IC card is passive and can only realize various input/output of data. The internal circuit of this type of IC card can be divided into two major functional parts, data storage part and data encryption operation control part. And not all IC cards must have these two functions. We call IC card with only data storage function as non-encrypted memory card (Memory Card). IC card with data storage function and data encryption operation control is called encrypted memory card (Memory Card with Security Logic). They have temporary or permanent data storage capacity, and their content can be used for processing or judgment. Smart IC card is an IC card with a microprocessor circuit in the integrated circuit of the IC card. It is an active IC card that can not only manage the I/O operations of various data and verify the personal password from the interface device, but also actively identify the interface device connected to it according to the requirements of the application system. Therefore, in the smart IC card, it is possible to establish authorization for various application systems, store relevant data of multiple application systems, and achieve high reliability and high security control of data information storage, and can perform complex information processing and calculation.
2. IC card international standards and reading and writing requirements
Since IC cards are mobile and global in use, it is particularly important to establish corresponding international and national standards. In the field of information technology, ISO (International Organization for Standardization) and IEC (International Electrotechnical Commission) jointly established a technical committee ISO/IEC JTC1 to formulate corresponding international standards. In the design of IC card application systems, every link of the reading and writing control of IC cards by the reading and writing equipment should comply with the corresponding international standards to ensure the correct reading of data. This is the basis for the design of IC card reader terminals.
Among these standards, the definition of chip and electrical characteristics and the requirements for operation timing are particularly important. Here, the electrical characteristics and timing of the synchronous card are used as an example for introduction. When using this card, the interface device puts all lines in state L, then VCC is powered on, Vpp is in idle state, CLK, RST and FCB are in state L, and the I/O of the interface device is placed in receive mode. The clock pulse is provided after t20 after the rising edge of VCC, and the duration of the clock pulse is t25. FCB remains in state L for at least t22 after the rising edge of the clock pulse. The first bit of data obtained on the I/O line can be regarded as a response, at which time CLK is in state L and is valid after t27, the falling edge of CLK. When FCB is in state H, each clock pulse is used to read the next data bit on the I/O line. In the reset response, the first clock pulse is given t24 after the rising edge of FCB. The duration of the clock pulse state H is t25, and the duration of state L is 1us (t26). The second and subsequent data bits are given at t27 after the clock is low and the CLK falling edge. The data bits are sampled sequentially with the rising edge of the clock pulse.
Figure 1
3. Design of SLEE4442 interface circuit
SLE4442 is a logic encryption memory card designed by Siemens of Germany. It has a storage capacity of 2K bits and a completely independent programmable encryption code memory. The internal voltage boost circuit ensures that the chip can be powered by a single 5V voltage, and the large memory capacity can meet various requirements in the application field. It is a kind of IC card chip that is currently widely used in China. The characteristics of this chip are that it adopts a multi-memory structure; 2-wire connection protocol, the serial interface meets the ISO7816 synchronous transmission protocol; the chip adopts NMOS process technology, and the erase/write programming time per byte is 2.5ms; the memory adopts at least 10 4 erase/write cycles, and the data retention time is at least 10 years.
The main control chip of the reader is the 89C51 microcontroller. The 89C51 microcontroller is an 8-bit serial processing chip developed by Intel. It has an 8-bit CPU, 256 bytes of RAM, 21 special function registers (SFRs), 2 16-bit timers/counters, 4 8-bit parallel interfaces, a full-duplex serial interface, 5 interrupt sources and an on-chip clock oscillator. Since this is a very mature microcontroller, this article will not go into more detail.
The core module of the reader is how to achieve effective control and read-write operations on the IC chip. The design of the interface circuit directly reflects the specific operation idea of the chip. Since the logic interface circuit of the IC card generally adopts an open collector (OC) output and a non-protected input structure, the source end of the pull-up resistor R is connected to the power supply of the IC card. When the IC card is in the power supply state, the entire interface circuit is connected, and a logical path is formed between the interface device and the IC card; when the IC card is in the power-off state, the source end of the pull-up resistor R loses power supply, and the entire circuit with the card interface is in a non-powered state. All IC card interface parts are added with protection diodes, which can strictly limit the voltage on each pin between -V D ~ VCC + V D (V D is the forward voltage drop of the protection diode, usually about 0.6). In this way, the instantaneous overvoltage caused by line interference and jitter on the edge of the logic level change can be suppressed, providing further protection measures for the IC card. The designed interface circuit diagram is shown in Figure 2.
Figure 2 IC card control and read-write circuit
The insertion and removal of the IC card is identified by the induction switch on the IC card adapter socket. For a simple manually inserted and unplugged IC card adapter socket, this identification process is quite simple, with only one switch to indicate whether the card has been inserted. If the card has been inserted into the correct position, the IC card adapter socket will give a switch on (or off) signal, and once the card leaves this position, the signal will immediately flip. The adapter used in the design has a normally closed switch when no card is inserted, and a switch off when the card is inserted in place. For a manual IC card adapter socket, this signal is sufficient. In order to ensure that the IC card has been inserted accurately, the insertion identification process must include a de-jitter process, which is mainly implemented by software.
The address counter of most synchronous IC cards that comply with the ISO7816 standard is closely related to the clock. When the card is reset, the address counter is set to 0. Each subsequent clock beat sent to the card will add '1' to the address counter of the IC card. The upper limit of this clock frequency is 50kHz or 280kHz. The first 32 clock cycles after the reset are the reset response process of the card. During this process, the manufacturer's product code is sent one by one on the data line in a bit-coded manner, and the subsequent fields are different according to the different meanings defined by the manufacturer and the user. If a field is defined as readable, the clock can be run to the field and then read out clock by clock. The data reading process can be divided into three basic processes: reset, positioning of the data field and data reading.
4. 89C51 software module design
Since 89C51 is the main control chip, 89C51 needs to complete the reset, read and write operations of the IC chip. First of all, for the reset response operation, the reset response is carried out according to the ISO7816 standard. It can be reset at any time during the operation, and only after the reset can other operations be performed on the IC card. At the beginning, the address counter is set to 0 with a clock pulse. When the RST line is set from the H state to the L state, the content of the first data bit is sent to the I/O line. If 32 clock pulses are input continuously, the contents of the first 4 bytes of address units in the main memory are read out. At the falling edge of the 33rd clock pulse, the I/O line is set to the H state and closed. During the reset response, the "start" and "stop" states are ignored. The program design on the microcontroller is as follows:
CARD_RST:
CLR RST
CLR CLK
LCALL DELAY_20US
SETB RST
LCALL DELAY_20US
SET CLK
LCALL DELAY_20US
CLR CLK
LCALL DELAY_20US
CLR RST
LCALL DELAY_20US
MOV B,#32
RESET1:
SETB CLK
LCALL DELAY_20US
CLR CLK
LCALL DELAY_20US
DJNZ B,RESET1
RET
在命令模式下,复位响应之后,芯片等待着命令。每条命令都以一个“启动状态”开始。整个命令包括三个字节。随后紧跟着一个附加脉冲并用一个“停止状态”来结束操作。当CLK为H状态期间,I/O线的下降沿为启动状态;当CLK为H状态期间,I/O线的上升沿为停止状态;限于篇幅,此处不再列出整个读写操作的程序代码。需要注意的是:脉冲的下降沿之后,I/O线上的第一位数据变为有效。随后每增加一个时钟脉冲,芯片内部的一位数据被送到I/O线上。其输出的顺序是从侮个字节的最低位开始。当所需要的最后一个数据送出以后,需要再附加一个时钟脉冲来把I/O线置成H状态,以便准备接受新的命令。在输出数据期间,任何“启动状态”和“停止状态”均被屏蔽掉。
5、结束语
本文的创新点是提出了一种新型的IC卡读写器设计方案,在串口通讯的设计中,除了要对单片机的异步通讯口进行操作,还要对PC 机的串口进行底层实时控制,并通过调用系统的API 函数的方法成功的解决了这一问题。由于西门子公司的SLE4442型逻辑加密IC卡是一种比较通用的IC卡芯片,因此通过更新读写器软件也可以操作其他类型的接触式同步IC一卡,使得这种接触式IC卡读写器成为一种通用的读写器。
Previous article:Application of commutation controller based on AT89C51 in periodic commutation power supply
Next article:Design of LED Color Light Controller Based on AT89C51 Single Chip Microcomputer
Recommended ReadingLatest update time:2024-11-17 00:17
- Popular Resources
- Popular amplifiers
- 西门子S7-12001500 PLC SCL语言编程从入门到精通 (北岛李工)
- Siemens Motion Control Technology and Engineering Applications (Tongxue, edited by Wu Xiaojun)
- How to read electrical control circuit diagrams (Classic best-selling books on electronics and electrical engineering) (Zheng Fengyi)
- MCU C language programming and Proteus simulation technology (Xu Aijun)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- Principles of peripheral expansion of single-chip microcomputer hardware system
- [Last few days] Free to get | Espressif ESP32-S3-Korvo-2, Raspberry Pi 400 and other good boards
- [ESK32-360 Review] + RTC Timer
- [N32L43x Review] Create a DEMO routine to test the SHT20 temperature and humidity sensor
- Several suggestions on how to do a good job in tax control bidding
- LED flashing program, can't enter interrupt
- How to output full load of power module
- Qinheng MCU CH55X — USB application example source code sharing
- AC-DC adapters and USB PD chargers will be 50% smaller
- Questions about CC8530