System design of elevator remote control based on C8051F340 dual serial port

Publisher:和谐共存Latest update time:2010-02-09 Source: 电子技术Keywords:C8051F340 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

0. Introduction

The remote elevator monitoring system is an advanced technology in the elevator field today. The computer located in the elevator center remotely monitors and controls the elevators in the building, monitors and analyzes the fault and operating status data, etc. It also controls the elevator and makes anti-counterfeiting judgments. When the elevator fails, it receives the fault status signal and judges the fault type, and transmits the fault type and operating status information to the service center computer; this article creatively uses the dual serial port microcontroller C8051F340 as the main control chip of the front-end machine, communicates through 232 and 485, and completes scheduling, operation and maintenance.

1. System hardware design

The overall block diagram of this system design is shown in Figure 1.

The PLC communicates via RS-232 through the serial port of the main control chip C805 1F340, while the main control chip and the elevator controller communicate via RS-485. RS-232 communication is also done through the serial port of the main control chip through the two-wire/four-wire conversion circuit. If an ordinary single-serial-port microcontroller is used, even if a two-way three-way design is added, it cannot meet the requirements. Therefore, the C8051F340 microcontroller with dual serial ports is used as the main control chip, so that the three-way communication is carried out on different serial ports.

1.1 Main CPU system

The C8051F340 chip is a fully integrated mixed-signal system-level MCU chip that is high-speed, flexible and low-cost. It has an 8051-compatible CIP-51 core (up to 25MIPS). It is fast. A new FLASH memory has been added, which has the ability to be reprogrammed in the system, can be used for non-volatile data storage, and allows the 8051 firmware to be updated on site. The on-chip JTAG debugging circuit allows non-intrusive, full-speed, in-system debugging using the product MCU installed on the final application system. The debugging system supports observing and modifying memory and registers, and supports breakpoints, watchpoints, single steps, and run and stop commands. The C8051F340 is a typical control system used in industrial systems. In view of the above advantages, and combined with the design goals, this microcontroller is specially selected. The C8051F340 main control unit circuit is shown in Figure 2:

1.2 Communication circuit between main control system and PLC

Serial communication is widely used because it uses fewer lines and is low in cost, especially in remote transmission, as it avoids the inconsistency of multiple line characteristics. In serial communication, both parties are required to use a standard interface so that different devices can be easily connected for communication. The RS-232-C interface is currently the most commonly used serial communication interface. Its full name is "Technical Standard for Serial Binary Data Exchange Interface between Data Terminal Equipment (DTE) and Data Communication Equipment (DCE)".

In practice, only the 3rd to 9th leads of RS-232-C are used in computer and terminal communication. The electrical characteristics of the interface are that the voltage of any signal line in RS-232-C is a negative logic relationship. That is, logic "1", -5--15V; logic "0" +5-+15V. The noise tolerance is 2V.

Therefore, it is necessary to use the MAX232 chip for level conversion. The communication circuit between the C8051F340 main control unit and the PLC is shown in Figure 3:

1.3 Communication circuit between main control system and internal call board

The communication circuit between the C8051F340 main control unit and the internal call board is shown in Figure 4:

According to the actual situation, special requirements such as long distance, high accuracy, enhanced anti-common mode interference ability, and fast transmission rate are required. Here the author uses 485 for communication. Compared with RS-232, RS-485 has the following characteristics:

(1) The interface signal level is lower than that of RS-232-C, so it is not easy to damage the chip of the interface circuit. In addition, the level is compatible with the TTL level and can be easily connected to the TTL circuit.

(2) The maximum data transmission rate of RS-485 is 10Mbps.

(3) The RS-485 interface uses a combination of a balanced driver and a differential receiver, which has enhanced common-mode interference resistance, that is, good noise interference resistance.

(4) The transmission distance of RS-485 interface can actually reach 3000 meters. In addition, RS-485 interface has multi-station capability, which meets our requirement of establishing a device network using a single RS-485 interface.

1.4 Serial port self-test circuit design

The design requires that the serial port has self-test capability, that is, when the system is started or allowed to be checked, the high-speed microcontroller C8051F340 can detect its own serial port, that is, send any byte and receive this byte. If the sending and receiving are consistent, a signal is sent to the PLC and the microcontroller on the internal call board, and waits for the signal from the other party to pass the self-test. If the other party also passes the self-test, the self-test ends and enters normal working state.

1.5 Contactless IC card input and output circuit

Contactless IC card, also known as radio frequency card or induction card, successfully combines radio frequency identification technology, solves the problem of passive and contactless, and is a major breakthrough in the field of electronic devices.

The electrical part of the card consists of a component and AISC. The antenna in the card is only a coil, which is very suitable for sealing into the card. ASIC consists of a high-speed (106KB baud rate) interface, a control unit and an EEPROM. The card reader sends a set of fixed-frequency electromagnetic waves to the IC. There is an IC series resonant circuit in the card, and its frequency is the same as the frequency of the reader. This will produce electromagnetic resonance, so that there is a charge in the capacitor. A one-way electronic pump is connected to the other end of the capacitor to send the charge in the capacitor to another capacitor for storage. When the stored accumulated charge reaches the rated voltage, this power supply can be used as a power supply to provide working voltage for other circuits, transmit the data in the card or receive data from the reader. The control input and output circuit of the contactless IC card is shown in Figure 5:

2. System software design

2.1 Main program design flow chart

The main program design flow chart is shown in Figure 6.

2.2 Communication of interrupt processing module

First, the time conflict problem must be solved. The time for the hardware to receive or send a byte is about 1ms, while the time for the software to receive or send a byte is only a few μs, which provides conditions for dual serial ports to communicate simultaneously. Simultaneous communication actually divides the CPU time into very small time slices. Assuming that the longest time for the faster serial port to send or receive a byte is TRbyteMax, the CPU longest time slice should generally be less than TRbyteMax/2. Of course, in the gap after receiving or sending a frame of data, the CPU time slice can be appropriately extended to do some necessary data processing. Secondly, the data conflict problem must be solved. The two serial ports use their own receiving and sending data buffers and control variables to reduce the amount of interrupt protection data and prevent data conflicts. When the main program, serial port interrupt handler and other interrupt handlers write data to the memory (the memory used for communication with the host computer), the other serial port interrupt must be closed in the shortest possible time. The interrupt closing time should be less than a few hundred μs to prevent the serial port from reading this data before other program data is written. The high-reliability cyclic redundancy check (CRC) technology is used in the serial communication data frame, which greatly reduces the data bit error rate. No bit errors were found in the large amount of data running continuously for several months.

3. Conclusion

This system design is based on C8051F340 dual serial port for elevator remote control. It adopts modular, structured, and object-oriented design methods to make the system highly reliable and real-time. At the same time, the hardware circuit module and software program diagram are given. The hardware circuit diagram is highly versatile and easy to reference and design. In addition, the IC card circuit and dual serial port communication also provide guarantees for the reliability and security of the system.

Keywords:C8051F340 Reference address:System design of elevator remote control based on C8051F340 dual serial port

Previous article:Data Acquisition System Based on C8051f060 Single Chip Microcomputer
Next article:Design of logic non-circulating reversible speed regulation system 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号