A non-contact IC card reading and writing program using Mann code modulation

Publisher:脑电狂徒Latest update time:2006-05-07 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere


  Introduction Contactless IC card technology has very good application prospects. This article introduces a low-frequency non-contact IC card system composed of the e5550/U2270B device group from an application perspective, and makes a detailed analysis of the read and write operations when using Manchester code modulation for information exchange. Finally, the corresponding code written in C language is given source program.

  Keywords Contactless IC Kaman code modulation Non-contact IC card reading and writing operations

                    Introduction

  Contactless IC card technology has been widely used in electronic transactions, medical care vouchers, driving authorization vouchers, vehicle refueling management systems, home and company office channels, Access control for various restricted access places, prepayment systems for various electricity, water, heat and gas meters, and even pet identification, etc. Because of its convenience and safety, it has attracted increasing attention from engineers in relevant technical fields.

  Figure 1 Schematic diagram of the contactless card reading and writing system using e5550/U2270B. The contactless IC card is an interface circuit. It obtains energy through the coupling of the transponder oscillation coil configured on the card and the base station oscillation coil. Through the cooperation of necessary communication software, it ensures two-way data exchange between the card and the base station, as shown in Figure 1. Many well-known manufacturers, such as Simens, Philips, Temic and other semiconductor companies, have products with unique characteristics and excellent performance.

   

            Figure 1 Schematic diagram of contactless card reading and writing system using e5550/U2270B

  The full name of e5550 is Standard Read/Write Identification IC, which is actually a low-frequency transmitter transponder. It matches the base station read/write integrated circuit (Read/Write Base Station IC) U2270B and forms the core device of the contactless IC card system. These two devices are collectively called contactless read-write identification integrated circuits (its registered trademark is IDIC, hereinafter referred to as IDIC or contactless IC card). They were developed by Telefunken Semiconductor Company, a subsidiary of the German Benz Group, and have been transferred to Atmel. Produced by the company. Because of its reliable operation and low price, it is a preferred solution for specific application fields.

             1. Basic performance of e5550/U2270B device group The

basic performance of e5550 transponder is as follows:

(1) IDIC with low power supply voltage and low power consumption CMOS structure.
(2) The power supply of the transponder is obtained through non-(direct) contact coil coupling.
(3) The rated radio frequency (RF) oscillation frequency range is: 100 ~ 150kHz.

(4) The transponder is equipped with EEPROM, which is divided into 8 (storage) areas, each area has 33 bits, so there are 264 bits in total (see Table 1).

   

(5) 8个(存储)区的首位分别为该区的写保护位"L"。为"1"时,该区为只读区;为"0"时,该区为既可读又可写区。
(6) 8个(存储)区中的第0区为工作方式数据存储区,通常是不发送的,而其他的7个区每个区中各有32位,即总共有224位供用户使用。
(7) 具备增强防护功能,以免非接触卡式EEPROM的误编程。
(8)每一存储区的写操作时间一般不超过50ms。
(9) EEPROM操作的一些其他选项:

· 比特率(位传送率 b/s)--RF/8,RF/16,RF/32,RF/40,RF/50,RF/64,RF/100,RF/128。
· 调制方式--二进制(BIN)、频移键控(FSK)、相移键控(PSK)、曼彻斯特码(Manchester)、双相位码(Biphase)。
· 其他--请求应答(AOR)、终止方式和口令方式。

U2270B基站读写器的基本性能如下:

(1) 载波频率fOSC范围为100~150kHz。
(2) fOSC为125kHz时,典型的数据传送率为5kb/s。
(3) 适用的调制方式为曼彻斯特码(简称曼码)和双相位码。
(4) 可由5V的稳压电源或汽车蓄电池供电。
(5) 调谐能力。
(6) 与微控制器有兼容的接口。
(7) 处于备用工作方式时,其功耗甚低。
(8) 有一向微控制器供电的输出端。

  有关IDIC的技术规范,可直接从互联网查阅或下载[1]。至于硬件结构,厂商一般也向客户提供必要的技术支持,故本文毋庸赘述。

                 二、 非接触IC卡的读操作

  现仅就IDIC通信中遇到的一些问题,并对通信的核心部分--读写操作做必要的探讨。首先申明,所谓的读写,其意分别为:基站通过MCU进行"读操作";基站通过MCU进行"写操作"。

  e5550和U2270B匹配使用时,根据两者的基本特性,其调制方式只可能在曼码和双相位码中择一。不失一般性,选择曼码调制。曼码调制时数据传送的规则可用图2加以说明。

  图2采用曼码调制的数据表达方式由图2可知,位数据的传送周期(1P)规定了每传送1位数据的时间是固定的,它由RF/n决定。其物理实质是微控制器通过基站与应答器中的存储器(EEPROM)进行数据的读写操作。若载波频率fOSC=125kHz,位数据传送率选RF/32,则每传送一位的时间(周期)为振荡周期的32分频,故位传送周期为:

1P=1/(125kHz×32)=256μs

 


  根据我们得到的器件,采用曼码调制的数据,位数据"1"对应着电平下跳,位数据"0"对应着电平上跳(注意:Telefunken半导体公司提供的资料(Rev.A2,13-Oct-97)正好与此相反,故最好用前自己先测试一遍,切记!)。在一串传送的数据序列中,两个相邻的位数据传送跳变时间间隔应为1P。若相邻的位数据极性相同,则在该两次位数据传送的电平跳变之间,有一次非数据传送的、预备性的(电平)"空跳"。

  电平上跳、电平下跳和两个相邻的同极性位数据之间的预备性空跳是确定位数据传送特征的判据。本判据被定义为判据一(位数据检测指标)。

  非接触IC卡在读操作时,另一须关注的问题是传送的位数据序列起始标志和结束标志。厂商并未提供有关的资料,通过摸索,已基本掌握了其特征,为便于说明,请参见图3。
 

   

             图3 曼码调制的数据串起始/结束标志的时序特

  图3曼码调制的数据串起始/结束标志的时序特征图3中,stepcnt为读操作步序,其确切含义见表2。
 

   

  假定非接触IC卡的存储器内存放的位数据序列为一非空集,则在若干位数据的跳变后,检测到一电平上跳,经过1.5P发生电平下跳,再经过0.5P又发生电平的上跳,则该上跳即为起始标志。
起始标志即为结束标志。这意味着非接触IC卡的存储器内存放的数据包括起始标志(即结束标志)和位数据序列。读操作时,是首尾相接、循环执行的。

  识别数据起始标志和数据结束标志,是通过参数stepcnt进行的顺序化判别,故stepcnt为读操作的判据二(首尾检测指标)。
 

  非接触IC卡在读操作时,第三个须要关注的问题是,如何确定1.5P、1P和0.5P三个特征判据?e5550和U2270B的射频振荡频率范围在100~150kHz,当位传送率选择RF/32时,即fOSC经过32分频后,上述的三个参数在不同的fOSC时,处于什么样的范围内呢?请见表3。
 

   


  It can be seen from the above that as long as the intervals of 1.5P, 1P and 0.5P do not overlap. According to the comparison of two sets of data using 100~150kHz and 110~140kHz, it can be seen that using the latter is more appropriate. Another way is to find a suitable interval index through experiments, which can be used as the judgment threshold for level transitions. In this way, while ensuring the recognition capability, the frequency accuracy requirements for the oscillation loop are reduced from a technical perspective.

  According to the above-mentioned change range of oscillation frequency from 110 to 140 kHz, the different intervals of coding changes are converted into corresponding interval indexes, as listed in Table 4.
 

   


  1.5P, 1P and 0.5P are the interval characteristic values ​​that identify the data start flag, bit data sequence and data end flag. Through experiments, it can be reflected by the interval index prdcnt, so it is the third criterion of the read operation (interval detection index).

  With the help of the above-mentioned bit data detection indicators, head and tail detection indicators and interval detection indicators, writing the non-contact IC card reading operation program is easy.

               3. The non-contact IC card write operation

  base station generates radio frequency oscillations in fixed gaps, and encodes bit data "1" and bit data "0" by controlling the oscillation time between the two gaps, and continuously sends a bit data stream. Complete the write operation. The RF oscillation waveform diagram of the write operation is shown in Figure 4.
 

   

                Figure 4 Signal flow during write operation

  Note: The domain clock (the data provided by TEMIC is represented by fC) is a time interval. If the frequency is 125kHz, fC=1/125kHz=8μs.

  Figure 4 Signal flow during write operation After the contactless IC card is inserted into the base station, the coupling of the radio frequency coil generates carrier oscillation. The different time intervals between two adjacent oscillation stops are used to distinguish bit data "1" and bit data "0" encoding. The vibration stop gap is about 50~

150 domain clock; the continuous oscillation time interval of bit data "0" is 24 domain clocks; the continuous oscillation time interval of bit data "1" is 56 domain clocks. When the oscillation stop gap ends and the continuous oscillation time interval is higher than the 64 domain clock, the IDIC exits the write operation mode.

  Considering that when the writing operation starts (start), there is a frequency stabilization process, and when the writing operation stops (stop), there is an EEPROM writing process of about 16ms, so the start and stop phases are both calculated as 20ms. The trnssqnc marked in Figure 4 is the sending sequence number, the starting phase is 0, the bit data stream sending phase is 1, and the sending end phase is 2.

  There are three pins on the base station reader/writer: bsout, bscfe and bsin. See Table 5 for their meanings.
 

   


  When writing bit data to the e5550, there are four legal data flows, as shown in Figure 5. Among them, OP is the operation type code, which contains two digits. "10" indicates that the upcoming write operation is performed, and "11" is the termination IDIC operation code. In the case of multi-IDIC operation, this feature can be used to control the transponders one by one, so that the transponders to be controlled can generate stable radio frequency oscillations one by one. When the 28th bit (usePWD) of the mode data area is "1", after writing the operation code "10", the 32-bit password (password) must be written into the 7th area of ​​the EEPROM. The bit data stream has 33 bits and is written in blocks. The first bit is the lock bit L, L="1" indicates that the area is a read-only area, L="0" indicates that the area is a read-write area, and the remaining 32 bits are bit data. ADR is the storage data area of ​​the bit data stream, with a value ranging from 0 to 7.

  According to the above-mentioned carrier oscillation characteristics, using the carriercnst parameter to define (see Table 7), the read operation is not difficult to implement. During the read and write operations, the count value in units of 2μs is used as the timing unit. The purpose is to use the timer of the MCS-51 series microcontroller.
 

   


                    Conclusion:

   Through the above explanation, and then carefully studying the relevant technical information, it is not difficult to compile a non-contact IC card reading and writing program using Mann code modulation. Of course, to realize the complete functions of IDIC, some other program modules are needed, such as data storage format and encoding encryption algorithm. If an error occurs during a read/write operation, the read/write operation must be repeated, how many times, and how many times the read/write operation must be repeated. /The writing operation process exits after timeout, etc. These can be solved accordingly according to the needs of the application object. For the non-contact IC card reading and writing program using Mann code modulation, please see the program list.

                    Reference

1. http://www.atmel-wm.com/products/gabprodlevel22.php3?dom1=201&dom2=221&cas=dom2

Reference address:A non-contact IC card reading and writing program using Mann code modulation

Previous article:Application of digital signal processor TMS320F241 in variable frequency air conditioners
Next article:Multi-task programming of multi-DSP system based on VxWorks

Latest Embedded Articles
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号