1 Introduction
In the power equipment status detection system using infrared imaging technology, the application system is based on the AT89C51 microcontroller and uses the non-contact infrared thermometer model 3iLRL3 from the American Raytheon Company. This thermometer uses the RS232C serial communication standard interface, which is commonly used in many communication devices. The current direct serial communication with a PC is also the RS 232C interface. Although the performance indicators of RS232C are not very good, it still has widespread market support. Serial communication technology plays an important role in measurement and control systems, using only three wires. You can easily exchange information between two digital devices, achieve full-duplex data transmission, and have low hardware costs. And it has good versatility.
2 The hardware design of serial communication
is in the developed system. The infrared thermometer will detect the working and ambient temperature of the power supply and transmit it to the microcontroller through the RS 232C serial port. At the same time, the microcontroller controls the online working configuration of the detection device. The formulation and selection of the working configuration of the infrared detection device is made by the host PC. In this way, the control circuit composed of the microcontroller as the core is the data transfer station, and the host PC downloads the online working configuration of the infrared thermometer. Upload the online operating temperature of the power equipment detected by the infrared thermometer. To diagnose the working status of power equipment. Here, the serial communication interface between the microcontroller and the PC is still the standard communication of RS 232C. The AT89C51 microcontroller has only one serial port, which requires another serial port expansion problem. The system uses the universal serial communication interface chip 8251A to expand. The hardware circuit of the system's serial communication is shown in Figure 1.
RS-232 is EIA (Electronics Industries Association) level. The signal level adopts negative logic, logic "1" = -12V, logic "0" = +12V. This is incompatible with the TTL signal level of the microcontroller, so the serial ports RXD (serial receiving port) and TXD (serial transmitting port) of RS232C and 89C51 microcontroller cannot be directly connected. A converter needs to be connected between the RS232C and TTL circuits. Perform level conversion. There are many level conversion chips on the market. For example, MCl488 and MCl489 were widely used in the early days. MC1488 receives TTL level. Output RS 232C level. MC1489 receives RS 232C level and outputs TTL level. The inconvenience of this level conversion interface is that it requires ±12 V working voltage and consumes large power. Not suitable for low power systems.
Therefore, the system uses the MAX232 produced by MAXIM Company to achieve conversion between the two levels. Its main advantages are: there is a voltage converter inside the chip, which can convert the input +5 V working voltage into the ±12 V voltage required by the RS 232C interface; at the same time, it can achieve bidirectional conversion of 2 channels and 2 levels. In this system, it can replace 2 pieces of MCl488 and 2 pieces of MCl489, and connect an external 5 V power supply. It does not need to connect an external ±12 V power supply like MCl488 and MCl489, so the circuit is simple and the performance is improved.
In the system, the infrared thermometer and the PC have two serial ports, while the 89C51 has only one serial port. The programmable universal serial interface chip 8251A is used to communicate with the host PC. Since the chip select terminal CS interface of the 8251A serial port chip To Y2 of the 74LS138 decoder. Therefore, the port address of 8251A is OA000H, the RXCLK and TXCLK receiving and transmitting clocks are connected to the T1 port of 51, and T1 is used as the baud rate generator [1].
3 Software design
The serial port of the infrared thermometer is directly connected to the 89C15 through MAX232, so the infrared scanning sensor head scans the power equipment according to the given scanning strategy, reads in the temperature scanning signal, and performs maximum, minimum, average and abnormal elimination Processing, the microcontroller records the scanning time and temperature value, and waits for PC commands. Send data to the PC. The data sending process is shown in Figure 2. The infrared sensor detects the status of the power equipment through the online work configuration control downloaded from the PC. The process of receiving data is shown in Figure 3. The serial communication between the microcontroller and the PC passes through 825lA, so in the communication program, first perform initialization programming on 825lA, set the serial communication mode, and determine the communication protocol. These are key points in communications programming.
(1) The working mode setting of the serial port is
completed by setting the serial port control register (SCON) of the microcontroller. Since a frame of 11-bit data format is used, the working mode of the 89C51 serial port can only be set to mode 2 and mode 3. The baud rate of data transmission is controlled by a timer. This system adopts mode 3. In the l frame of data received serially by the microcontroller, the parity bit is completed by TB8 and RB8 (9th bit data) of SCON to complete the check function.
(2)Serial port baud rate setting
Through the calculation of this formula, it can be further verified that there is no error in the initial value of T1 calculated when the frequency of the crystal oscillator selected for the design system is 11.0592 MHz.
(3) The stipulations of handshake signals are
that the request signal is FFH, the response signal is FEH, the error signal is FDH, and the end signal is FCH.
(4) Data transmission method
uses 2 transmission lines of RS 232C to achieve full-duplex sending and receiving data.
(5) Communication method
Asynchronous communication method transmits data in units of words. Since both the sending and receiving parties use their own clocks, the format of the data frame is strictly specified in asynchronous communication.
(6) Format of data frame
One frame of data is 11 bits, including start bit, data bit, parity bit, stop bit. The data format is as follows [2]:
Therefore, the 8251A initialization mode control word is 7DH.
The PC uses Visual basic programming. VB supports object-oriented programming, has a structured event-driven programming model and can use infinitely expanded controls, and can easily create a good human-computer interface. In terms of standard serial communication, VB provides a powerful communication control MSCOMM, the file name is MSCOMM. VBX. This control can set the data sending and receiving of serial communication, and set the serial port status and the information format and protocol of serial communication. The onComm event is triggered during the process of sending or receiving data, and the CommEvent property is accessed programmatically to understand the type of communication event and handle them respectively. The VB serial initialization communication software is as follows [3]:
Serial communication technology is currently widely used in many measurement and control systems, and long-distance communication is more prominent. RS 232C in this system is only used for short-distance communication. Using RS 485 in an improved system can expand transmission distance and system stability is enhanced.
Previous article:Research on WDT in MSP430 microcontroller
Next article:Research and application examples of rapid printing method of electrocardiogram based on thermal printer
Recommended ReadingLatest update time:2024-11-16 17:27
- Popular Resources
- Popular amplifiers
- Siemens S7-1200-PLC Programming and Application Tutorial (3rd Edition) (Edited by Shi Shouyong)
- 西门子S7-12001500 PLC SCL语言编程从入门到精通 (北岛李工)
- Modern Compiler Principles C Language Description (Ampel)
- 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
- [ST MEMS waterproof pressure sensor LPS27HHW review] + Problems with the routine
- Qinheng CH582mesh networking
- The basic structure and working principle of RFID
- EEWORLD University - Teaching on how to use an oscilloscope
- October 22 live broadcast review: Gigabit digital isolators for video, converters, and communications
- What is sourcing current? What is sinking current?
- 【GD32L233C-START Review】-Software Environment and Hardware Resources
- Design of constant current source circuit
- ARW1243 test public code
- Introduction to MCU GPIO Programming