Development and application of non-contact IC card based on Linux serial port

0 Preface

With the rapid development of information technology, personal data will become the main role of future information. As a card type in the card-based application system, the IC card uses an integrated circuit (IC) installed in the card to record and transmit information, which is an effective way to effectively send personal information to the information network and obtain desired results. Method. The IC card chip has the ability to write data and store data, and the contents of the IC card memory can be conditionally provided for external reading or for internal information processing and determination as needed. As a way to exchange data between IC card and reading and writing device, the non-contact IC card communicates with the external device interface device by means of radio wave or electromagnetic field induction, and the card does not need to directly contact the interface device. The electrodes are ready for reading and writing data. Communication distances can range from a few centimeters to tens of meters. Its main advantage is that it has strong environmental adaptability and can complete automatic identification, tracking and management all-weather and contactless.

1 Serial communication device module in Linux

1.1 Linux device files

In Linux, a hardware device is just a device file, and an application can operate on a hardware device just like a normal file. These device files provide interfaces to most physical devices, which are divided into character devices, block devices, and network devices.

(1) Character device: A device that has no cache when accessing, does not use system buffer, and the operation of the device file is directly reflected on the hardware, and the serial port belongs to the character device.
(2) Block devices: Both read and write have cache support and are capable of random access. It mainly includes floppy disk devices, CD-ROMs, and so on.
(3) Network equipment: Any network equipment must go through a network connection 151, that is, a device that can exchange data with other hosts. Usually, the interface is a hardware device but may also be a pure software device.

1.2 Serial Communication Settings

There are two ways to operate the serial port hardware device: one is to use the serial port driver that comes with the Linux kernel; the other method is to directly write the serial port hardware port, only the first method is used here. To set the serial port properties, you should first include termios in the program. The header file of h, this header file contains the terminal control structure and control functions.

There is a very important data structure struct temfios, this data structure contains all the serial port parameters, such as baud rate, data bits, input and output methods. Setting the serial port property is to assign a value to this data structure. Can be passed through termios. The function tssetattr() in h sets the termios parameter of the serial port; the termios parameter of the serial port is obtained by the function tsgetattr(). The attribute values ​​of each member of the data structure and the meaning of the parameters can be referred to the literature [1].

After setting the communication parameters, you can use read to read data from the serial port and write to the serial port to write data. The essence is to read and write the serial port file. When running the program, pay attention to whether the user has the right to read and write the serial port file to be operated. You can use the chmod command to modify the file permissions.

2 Introduction to contactless IC card

At the heart of the Mifare 1 IC Smart (RF) card is Philips' Mifare 1 IC $50. Built-in high-speed CMOS EEPROM MCU and so on. The card has no other components except the IC microchip and a high-efficiency antenna. It is passive (without any battery). The power of the power supply during operation is transmitted by the card reader antenna to the radio carrier signal coupled to the antenna on the card to generate electrical energy. Generally up to 2V or more for the IC working frequency on the card 13.56Mttz.

The Mifare 1 IC card features an advanced data communication encryption and two-way verification cryptosystem; and an anti-overlap feature that handles multiple overlapping cards that overlap the effective working distance of the card reader antenna at the same time. The communication principle is shown in Figure 1.

Mifare 1 IC card reading and writing flow chart

Figure 1 Mifare 1 IC card reading and writing flow chart

3 IC card device development and implementation under Linux

Take the generic Mifare S50 card as an example to describe its use in the campus computer room.

3.1 Establish the corresponding data structure

In the header file AcctData. In h, define the structure AcctItem, which is used to reflect the state of use of the machine, header file ICCard. In h, the definition class ICCard is used to reflect the state of use of the IC card. The ultimate goal of determining the data structure to be applied in the driver module program is to read and write card data processing, so a well-formed data structure is necessary.


Communication mode and rate
};

In this way, all the card processing data structure definitions and the device operation mapping function structure are defined. In summary, the opening, reading, writing and monitoring functions of the IC card device are realized.

Page 1 of 2

The general Table Cloth, this tablecloth decoration effect is better, but not resistant to friction, and it is easy to generate static electricity after repeated rubbing, the usual home maintenance is also very troublesome, can not clean part, can only be cleaned.
Pvc Tablecloth is the best quality tablecloth in all solid wood tablecloths. It is very soft on the touch, and has a rich variety of shapes and colors to meet the needs of most people. PVC tablecloths can be folded and waterproof for other tablecloths. Relatively good, his service life is also very long. Placed on the table can have a good anti-fouling protection for the desktop, and once the PVC Tablecloth is exposed to oil stains, it can be easily solved by simply wiping it.

PVC Tablecloth

Pvc Tablecloth,Pattern Table Sheet, Pvc Table Sheet,Table Cloth

China Amulite Sunrising Luggage &Bag Products Group , https://www.chinabluesunrising.com