Off-line timing consumer machine design

This article refers to the address: http://

With the continuous development of IC card technology, the modern management mode based on card application has become increasingly popular. At present, colleges and universities often complete electronic payment services such as deposit, payment, dining, shopping and bathing with a campus card, which greatly improves the management level of the school and the efficiency of service work. Most of the campus card system consumer subsystems are based on the network, and the connected consumer machines must send each consumption record to the consumer server in real time. The advantage is that it has strong real-time performance and supports many consumer groups. The disadvantages are high cost, complicated maintenance, large and inflexible system, and the peak consumption period is very likely to cause the burden on the consumer machine server and congestion.

The traditional bathhouses in colleges and universities are still extensive management, mainly based on manual ticket sales, and do not limit the time of bathing. This is not only easy to cause waste of water and fuel, but also the problem of not knowing the number of free taps in the bathhouse in time, and it is easy to cause a peak of bathing.

The design of this paper is a campus single-card version of the time-consuming consumer machine developed for the current situation of campus bathing. It has a separate independent consumer billing function, all consumer data is stored in the consumer machine, compatible with the existing button consumer communication protocol, and compatible with the IC card format used by the button consumer. It adopts the technology of radio frequency induction. Cardholders can achieve the purpose of time consumption by simply moving in and out of the door. It saves the trouble of selling bath tickets and collecting bath tickets. It is the water management of public bathhouses and collective apartments in colleges and universities. The ideal solution.

Consumer Machine System Overview

The purpose of this design is to develop a off-network timed consumer machine based on I2C bus with MCU as the core, which can run independently from the network and server, and realize the function of timing consumption. The system consists of a controller, a reader, an EEPROM, an IC card, and the like. The single-chip STC89C58 controls the entire system and implements initialization and data transfer to the peripheral chip. Considering that the system requires large-capacity data storage, the 24C256 EEPROM memory produced by ATMEL is used here. The PCF8563 is a low-power real-time clock/calendar chip produced by PHILIPS. It is used to generate the year, month, day, hour, minute, second, etc., to record the time of collecting data.

The system transfers data in both directions between the reader and the IC card in a half-duplex mode at an operating frequency of 13.56 MHz. The reader/writer transmits the signal to be transmitted and then loads it on the carrier signal with the frequency of 13.56MHz and sends it out through the antenna. The IC card entering the working area of ​​the reader receives the pulse signal. On the one hand, the radio frequency interface module in the card chip obtains the power voltage, the reset signal and the clock signal from the signal; on the other hand, the relevant circuit in the chip in the card modulates, decodes, decrypts, and then requests, passwords and Judgment such as authority. If it is a read command, the control logic circuit reads the relevant information from the memory, and after being encrypted, encoded, modulated, it is sent to the reader by the card antenna; if it is a write command for modifying the information, the relevant control logic causes the internal charge pump to be lifted. The voltage provides the high voltage required to erase the EEPROM; in order to rewrite the contents of the EEPROM; if it is determined that the corresponding password and authority do not match, an error message is returned.

Hardware circuit design

The block diagram of the hardware structure of the consumer machine is shown in Figure 1. The microcontroller STC89C58 is responsible for the monitoring of the entire window machine. The RC50 is a MIFARE card reader module, which performs various operations such as non-contact reading and writing of cards under the control of the MCU. The PCF8563 is a low-power, real-time clock/calendar chip that implements the timing function of the clock module. The EEPROM module is used to store a large number of consumption records during off-line consumption.


Figure 1 Consumer hardware structure block diagram

The power module supplies power to each module while operating it, providing a voltage of +5V. The EEPROM module and the reader module do not require an external power supply when they are not operating, and the clock module requires an external power supply to supply energy to keep the clock continuous and correct. Each module exchanges data through the I2C bus. The main advantages of the I2C bus are simplicity and effectiveness. It provides efficient control between integrated circuits by a simple two-wire interface for two-way communication. One line is used to transmit the clock and the other is used to transfer data. Data can be sent or received by the I2C through an interface with a buffer. Control and status information is transmitted through a set of memory mapped registers.


Figure 2 IC card reader hardware circuit

This article uses the general-purpose I/O ports (P1.7 and P1.6) of the microcontroller to virtualize the I2C bus interface. In order to have a common interface when using the virtual I2C bus, a virtual I2C bus software package in the main mode can be designed. , give the normalization operation instruction. When data transmission is performed, the operation chip is selected by identifying the chip address.

1 IC card reader part

The circuit of IC card reader is shown in Figure 2. Due to the high-integration TYPE A reader chip MF RC500 from PHILIPS, the antenna driver circuit requires only a few external components, and the effective distance can reach 10cm. After each power-on or hard-start, the chip will restore its parallel interface mode and detect the current MCU interface type. The MF RC500 can support different microcontroller interfaces. An intelligent automatic detection logic can automatically adapt to the parallel interface of the system bus. The chip is selected using the signal NCS. To connect to the microcontroller using a separate address and data bus, the ALE pin must be connected to the DVDD. This design uses a multiplexed address and data bus to interface with the microcontroller, so the ALE pin of the MF RC500 must be connected to the ALE signal of the microcontroller.

2 memory part

The consumption data stored in the timed consumer machine requires no power loss, so ATMEL's 24C256 EEPROM is selected for this purpose. The 24C256 is a 256 kb serial CMOS EEPROM that supports the I2C bus data transfer protocol. The programmable self-timed write cycle (including the automatic erase time of no more than 10ms, typical time is 5ms), the address assignment is shown in Table 1.


Figure 3 data information write flow chart

The correct reading of data in the serial EEPROM is closely related to the design of the system software. The system software should determine the data transmission bit according to the hardware circuit; establish the data area address pointer, and set the read and write control main program according to the working timing of the serial EEPROM. The main program is divided into the following two parts.

1) Data port initialization

According to the characteristics of serial EEPROM data access, set the working mode of the data port, establish the corresponding data pointer DPTR, establish the respective subroutine for the storage and retrieval of address and data information, and prepare for the storage and retrieval of the next step of data information. .

2) Data information writing/reading

As shown in Figure 3, first set the data source entry address DPTP, then call the serial EEPROM entry address service subroutine, strobe the EEPROM data area, and start the read/write program to transfer data.

3 timing module

The circuit of the timing module is shown in Figure 4. The PCF8563 is a low-power CMOS real-time clock/calendar chip that provides a programmable clock output, an interrupt output and a brownout detector, all of which are serially passed through the I2C bus interface. After the initial calendar information is sent to PCF8563, the calendar in PCF8563 will run automatically. Since the PCF8563 is a real-time clock chip, continuous power supply is still required when there is no external power supply to keep the time accurate. Therefore, this part of the circuit also adds a power-down protection function. When the main power supply system is unexpectedly powered off, that is, when Vcc is 0V, D1 is cut off, and the 3.6V standby power supply continues to supply power to the PCF8563 through D2 to ensure its normal operation.

4 display module

The display part of the consumer machine includes 8 LED digital tubes on the front and rear panels, all driven by the 74LS164. The display part adopts the ordinary serial static display. The analog I2C serial port is composed of P1.6 and P1.7 of STC89C58, and the driving signals are sent to the front and rear display panels respectively through P89LPC932.

5 data communication part

Before each consumer machine is put into use, the parameters such as the reader key, the consumption machine number and the reference time of the consumer machine can be set according to the actual situation through the serial port. After the setting is successful, the parameters are saved in the EEPROM of the consumer.


Figure 4 clock circuit

In this design, RS232 serial communication is used for data transmission. The data acquisition and storage is completed by the single-chip computer system, and the data processing is completed by the PC, that is, the PC and the single-chip microcomputer are composed of the upper computer and the lower computer distributed control system. As the front-end processor, the lower-level MCU goes deep into the field and is responsible for collecting various data and recording it, and transmitting various data to the host computer when needed.

Conclusion

This paper proposes a blueprint for the module division for the one-card system off-line version. It has guiding significance for the design of the off-line button and the secondary consumer machine in the card system, which can be used for reference and reference.

This system adopts the STC89C58, which is relatively mature in application development. Other chips are also mainstream products on the market, and the price is reasonable, so the overall system is cost-effective. In addition, the system also has the following advantages: using RF induction technology, high reliability, high confidentiality, fast and convenient, long service life; using I2C bus to simplify the hardware circuit structure; using electronic wallet method to achieve networking and off-network consumption Parallel operation of the machine; large-capacity EEPROM with long-term storage function after power-off; automatic recognition of illegal cards and alarms; flexible data collection.

In terms of data communication, the system adopts RS232 serial communication. Today, USB interface communication has been widely used. According to the application requirements, the USB interface can be added to greatly increase the transmission rate.


Ningbo Autrends International Trade Co.,Ltd. , https://www.ecigarettevapepods.com