In the power equipment status detection system of infrared imaging technology, the application system based on AT89C51 single chip microcomputer adopts the non-contact infrared thermometer model 3iLRL3 of American Ray State Company. The thermometer adopts the RS232C serial communication standard interface, which is commonly used in many communication devices. At present, the direct serial communication with PC is also RS 232C interface. Although the performance index of RS232C is not very good, it still has wide market support. Serial communication technology occupies a very important position in the measurement and control system. Only three wires are used. It is convenient to exchange information between two digital devices and realize full-duplex data transmission. The hardware cost is low and the versatility is good.
2 Hardware design of serial communication
In the developed system. The infrared thermometer will detect the working and ambient temperature of the power equipment and transmit it to the single-chip microcomputer through the RS 232C serial port. At the same time, the single-chip microcomputer controls the online working state of the detection device. The formulation and selection of the working state of the infrared detection device are completed by the host PC. In this way, the control circuit composed of the single-chip microcomputer as the core is the data transfer station. The host PC downloads the online working state of the infrared thermometer and uploads the online working temperature of the power equipment detected by the infrared thermometer to diagnose the working state of the power equipment. Here, the serial communication interface between the single-chip microcomputer and the PC is still the standard communication of RS 232C. The AT89C51 single-chip microcomputer has only one serial port, which requires solving another serial port expansion problem. The system uses the universal serial communication interface chip 8251A to expand. The hardware circuit of the serial communication of the system is shown in Figure 1.
|
RS-232 is an EIA (Electronics Industries Association) level. The signal level uses negative logic, logic "1" = -12V, logic "0" = +12V. This is incompatible with the TTL signal level of the microcontroller, so RS232C cannot be directly connected to the serial port RXD (serial receiving port) and TXD (serial transmitting port) of the 89C51 microcontroller. A converter is required to perform level conversion between RS232C and TTL circuits. There are many level conversion chips on the market, such as MCl488 and MCl489, which were widely used in the early days. MC1488 receives TTL level and outputs RS 232C level. MC1489 receives RS 232C level and outputs TTL level. The inconvenience of this level conversion interface is that it requires ±12V working voltage and consumes a lot of power. It is not suitable for low-power systems.
Therefore, the system uses MAX232 produced by MAXIM 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 realize two-way two-level bidirectional conversion. In this system, it can replace two MCl488 and two MCl489 chips, and connect an external 5 V power supply, instead of the 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 89C51 has only one serial port. The programmable universal serial interface chip 8251A is used to communicate with the upper PC. Since the chip select terminal CS of the 8251A serial port chip is connected to Y2 of the 74LS138 decoder, the port address of 8251A is OA000H, and the RXCLK and TXCLK receiving and sending 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 89C15 through MAX232, so the infrared scanning sensor head scans the power equipment according to the given scanning strategy, reads the temperature scanning signal, performs maximum, minimum, average and abnormal elimination processing, and the microcontroller records the scanning time and temperature value, waiting for the PC command. Send data to the PC, and the data sending process is shown in Figure 2. The infrared sensor detects the status of the power equipment through the online working state control transmitted by the PC, and its data receiving process is shown in Figure 3. The serial communication between the microcontroller and the PC is through 825lA, so in the communication program, the 825lA is first initialized and programmed, the serial port communication mode is set, and the communication protocol is determined. These are the key points of communication program design.
|
|
(1) Setting the working mode of the serial port
This is done by setting the serial port control register (SCON) of the microcontroller. Since the data format is 11 bits per frame, the working mode of the serial port of 89C51 can only be set to mode 2 and mode 3. The baud rate of data transmission is controlled by a timer. This system uses mode 3. In the serial data received by the microcontroller, the parity bit is checked by TB8 and RB8 (9th bit data) of SCON.
(2) Setting the serial port baud rate
The calculation of this formula can further verify that when the frequency of the crystal oscillator selected in the design system is 11.0592 MHz, the calculated initial value of T1 has no error.
(3) Provisions for handshake signals
The request signal is set to FFH, the response signal is set to FEH, the error signal is set to FDH, and the end signal is set to FCH.
(4) Data transmission method
The two transmission lines of RS 232C are used to realize full-duplex transmission and reception of data.
(5) Communication method
Asynchronous communication method transmits data in units of words. Since the sender and the receiver use their own clocks, the format of the data frame is strictly specified in asynchronous communication.
(6) Data frame format
A frame of data is 11 bits, including the start bit, data bit, parity bit, and stop bit. The data format is as follows [2]:
Therefore, the control word of the 8251A initialization method is 7DH.
The PC is programmed using Visual Basic. VB supports object-oriented programming, has a structured event-driven programming model, can use unlimited expansion controls, and can easily create a good human-computer interface. In terms of standard serial port communication, VB provides a powerful communication control MSCOMM, the file name is MSCOMM.VBX. This control can set the data transmission and reception of serial communication, 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. The CommEvent property is accessed by programming to understand the type of communication event and handle them separately. 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. The RS 232C of this system is only used for short-distance communication. Using RS 485 in the improved system can expand the transmission distance and enhance the system stability.
Previous article:Design of serial communication based on 51 single chip microcomputer application system
Next article:Application of Comparator of 51 MCU
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
- I would like to ask if there is any interference noise when measuring the ground line with an oscilloscope
- The microcontroller sends a string to the host
- VirtualBox-5.2.12 Environment Guide
- Working principle and function of encoder
- Help
- MATLAB Design Butterworth Bandpass Filter Parameter Setting
- Op amp circuit PCB design tips
- The benefits of eating noodles for engineers
- 【GD32L233C-START Review】6. Get RTC time and display it through OLED
- [RVB2601 Creative Application Development] Practice 7-U8g2 library displays network weather and time