During the debugging phase of the Lanzhou Heavy Ion Accelerator Cooling Storage Ring Project (HIRFL-CSR), the beam obtained by the HIRFL heavy ion accelerator needs to be injected into the cooling storage ring (CSR). During the beam adjustment process, because the control system operation is ordinary and the real-time requirements are high, the amount of data on the network increases greatly, causing the front-end gateway to handle a large amount of data from the power control module; in addition, the front-end gateway and the power control module are connected to the strong power control system on the electrical appliances, and the front-end gateway and the power control module microsystem are sometimes affected by the strong power control system, which increases the possibility of the front-end gateway crashing. If the beam adjuster in the central control room finds that the front-end gateway is dead during the beam adjustment process, he must go to the site to reset the gateway before the beam adjustment work can proceed smoothly. This is time-consuming and laborious for the adjuster, and the work efficiency is affected. In order to improve the efficiency of beam adjustment and reduce the physical labor of the adjuster, we designed and implemented the remote reset system of the HIRFL-CSR beam injection line gateway, so that the beam adjuster can quickly reset the front-end gateway with a mouse on the computer in the central control room, improving the efficiency of beam adjustment.
Figure 1
The gateway remote reset system is mainly composed of AT89C51 single-chip microcomputer hardware circuit, reset gateway, AT89C51 single-chip microcomputer signal processing program, and control room interface application program. The system structure diagram is shown in Figure 1.
1 Hardware structure and principle
1.1 MCU Hardware Circuit
The hardware circuit of the single chip microcomputer is divided into: signal conversion circuit, AT89C51 single chip microcomputer, isolation circuit, relay circuit
Road, etc.
The signal conversion circuit works in full-duplex mode and has two main functions: one is to convert the MAX485 signal sent by the reset gateway into an RS232 signal that can be received by the P3 port of the AT89C51 microcontroller. The AT89C51 then processes the signal and selects the corresponding relay through the P2 port to reset the corresponding gateway. The other is to use another MAX485 to convert the signal sent from the P3 port of the AT89C51 into a MAX485 bus signal received by the reset gateway.
AT89C51 is a low-power, high-performance CMOS 8-bit microcontroller with 4K bytes of flash memory and programmable erasable memory. The microcontroller uses Atmel's high-density, non-volatile memory manufacturing technology, and is compatible with the industry-standard MSC-51 instruction set and I/O pins. Its programming development software can be Keil uVision2, which is convenient and efficient to program. AT89C51 provides a very flexible and inexpensive solution for many embedded control applications. Its main features include: 4K bytes of flash memory, 128 bytes of RAM, 32 I/O ports, 2 16-bit timers, 5 bipolar interrupt source structures, 1 full-duplex serial port, on-chip oscillator and clock circuit. Due to the high cost performance of AT89C51, we use AT89C51 to implement the microprocessor of the reset hardware circuit.
The AT89C51 microcontroller in this system mainly implements intelligent processing of the received signal, and then selects the relay to complete the reset operation by transmitting a signal to the P2 port. Because the external output isolation circuit of the P2 port of the microcontroller uses an open collector photoelectric isolation device, and the relay circuit uses a pull-up resistor and a photoelectric isolation device in series, when a certain position of the internal P2 port register is 0, the external corresponding relay circuit is not turned on, and the front-end gateway is in normal working condition. When a certain position of the internal P2 port register is 1, the external corresponding relay circuit is turned on, the relay is turned on for 3 seconds, and the corresponding gateway is powered off for 3 seconds to reset. After the reset is successful, the microcontroller returns the reset success information to the network through the P3 port.
1.2 Reset the Gateway
The main function of the reset gateway is to complete the connection between the central control room application and the AT89C51 single-chip microcomputer hardware circuit module. Because the data throughput between the gateway and the AT89C51 circuit module is very small, and there is no electrical connection between the AT89C51 circuit module and the power supply, the serious interference of the strong power control circuit on the single-chip microcomputer system is avoided, so the stability and reliability of the reset circuit are guaranteed. A reset gateway can fan out several reset circuits, and a reset circuit can reset at least 8 gateways, so a reset gateway can manage the reset work of dozens of front-end gateways. At the same time, the MAX485 bus is used between the reset gateway and the AT89C51 circuit, so the AT89C51 single-chip microcomputer hardware circuit can be distributed in a large range of locations to reset the decentralized gateways.
2 Software Description
2.1 AT89C51 MCU Program
The signal processing program of AT89C51 microcontroller is written in Keil uVision2. The program mainly works in the query mode, which can eliminate the jumble. The number of jumble bits to be eliminated can be defined by yourself. When the input command is wrong, it can be re-entered. After the microcontroller operation is successful, it can return a success message. The flowchart of the whole program is shown in Figure 2.
The program of this microcontroller first adds the "stdio.h" and "at89x51.h" header files, which are mainly used to define the registers of AT89C51 and call system library functions. Secondly, a delay function and an addressing function are declared. The delay function is mainly used to control the length of the reset time, and the addressing function is mainly used to identify the microcontroller circuit block number on the network. When the AT89C51 program detects that its own commands appear on the network, it continues to execute the program to perform the corresponding reset operation. Otherwise, when it recognizes that it is not its own command one by one, it will immediately eliminate the characters in the buffer and re-acquire the commands on the network. When garbled data appears on the bus, the microcontroller that adopts this query mode will not make wrong operation, because the command can only be successfully input and the corresponding reset operation can be completed when the characters and order of the input command conform to the defined command format. If one character is wrong, it must be re-entered. Compared with simple query input, such program structure can not only eliminate the garbled characters transmitted over the network, but also can re-enter the command immediately when the input command is wrong, avoiding the situation in which the input command of the simple query mode must be input with all the specified characters before re-entering, thereby improving operating efficiency.
Figure 2
2.2 Control Room Interface Application
The control room interface application is mainly written by VC++, and the core is Socket programming. Socket is a socket specification based on the transport layer protocol (mainly TCP and UDP). It was originally proposed by the University of California, Berkeley, and it defines the specification for communication between two computers (also a programming specification). The two computers communicate using a "channel", which is composed of sockets at both ends of the communication. Socket shields the differences between the underlying communication software and the specific operating system, making it possible for any two computers that have installed the TCP protocol software and implemented the socket specification to communicate.
Most network communication programs can be divided into two categories: server side and client side. Since the reset gateway is a server side based on the Linux operating system, this application uses Stream Socket to create a central control room client service application based on Windows. Stream Socket is a connection-oriented programming method that provides a series of data error correction functions to ensure that the data transmitted on the network reaches the other party in a timely and correct manner. The Socket programming model of this interface client application is shown in Figure 3.
Figure 3
This application first uses MFCAppWizard to create a single text dialog box, then adds an IP edit box, a port edit box, and a connect button to the dialog box to connect to the reset gateway; adds some radio buttons to select the front-end gateway to be reset; adds an edit dialog box to display the received return information; adds a reset button to send a reset command to AT89C51. Then, add the corresponding CSocket class, function, and variable to the application. After the program is compiled, you can generate a Win32 Release executable file and then install it to the central control room to implement the reset operation. The application operation steps are very simple. When the staff finds that the front-end gateway is frozen, open this application, enter the IP and port number of the reset gateway, and connect. After the reset gateway is successfully connected, you can select the front-end gateway number and click the reset button. If the reset is successful, the reset success message will appear in the edit dialog box, and the staff can continue to adjust the bundle quickly.
3 Conclusion
The innovation of this paper is to use a microprocessor to realize the intelligent reset control of the front-end gateway in scientific research experiments, eliminating the phenomenon that the front-end gateway crashes during the HIRFL-CSR test phase for several years, forcing scientific research staff to manually reset the front-end gateway on site, which greatly facilitates the beam adjustment personnel and improves the work efficiency of scientific researchers. The front-end intelligent circuit module implemented by the microprocessor realizes the remote control of the front-end equipment in the scientific research experiment through the operation of the network communication application program in the central control room. Since the system has been used in the HIRFL-CSR beam injection line since October 2005, it has been stable, has strong anti-interference, and has not occurred any misoperation. Practice has proved that this system can still reset the front-end gateway when the communication port of the front-end control gateway is blocked, and has the advantages of reliable reset and strong real-time performance. Through the implementation of this remote reset system in the scientific research control system, we can also apply this control method to many links of scientific research experiment control, such as: remote power switch, remote control solenoid valve, and status acquisition of front-end equipment. Therefore, our physics researchers should consciously apply microcomputer control technology to all aspects of scientific research experiments, and try to let computers complete some time-consuming and laborious work to improve the degree of automation in scientific research, so as to help researchers achieve results in their professional fields. This requires our physics researchers to first learn some computer-related knowledge, and secondly, to have the awareness of using microcomputers to help themselves do scientific research, and finally, to use the knowledge of microcomputer control to realize automatic control in scientific research and help themselves do scientific research well.
References:
He Limin, Microcontroller Application System Design, Beijing University of Aeronautics and Astronautics Press, 1990.
Li Dayou, Jiang Xiufang. Single-chip microcomputer hardware, software and applications, Higher Education Press, 1992
Zhou Heqin, Wu Xiuqing, Microcomputer Principles and Interface Technology (2nd Edition), University of Science and Technology of China Press, 2001
Zhang Shuocheng, et al., Application of optical fiber communication in HIRFL-CSR control system, Microcomputer Information, 2005-9-1, 25~26
Previous article:A robot tracking algorithm
Next article:Design and implementation of real-time communication system between PC and multiple single-chip microcomputers
Recommended ReadingLatest update time:2024-11-16 15:48
- Popular Resources
- Popular amplifiers
- 西门子S7-12001500 PLC SCL语言编程从入门到精通 (北岛李工)
- Siemens Motion Control Technology and Engineering Applications (Tongxue, edited by Wu Xiaojun)
- MCU C language programming and Proteus simulation technology (Xu Aijun)
- 100 Examples of Microcontroller C Language Applications (with CD-ROM, 3rd Edition) (Wang Huiliang, Wang Dongfeng, Dong Guanqiang)
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
- Reset mode of TMS320C6678
- msp430F4152 official website routine program
- How to use type B leakage current sensor in charging gun IC-CPD, charging pile
- Can someone tell me what the built-in heating function of the sht3x series does?
- Leverage the advantages of real-time operating systems with MSP432 MCUs
- Start with TF card made by card reader
- 【RT-Thread software package application works】Smart home
- EEWORLD University----Live Replay: How to Build a Car Charger
- IoT standards: Game over
- 无需重新设计电路板?三大提示助你显著改善降压转换器中的EMI!