1 Introduction
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 common 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. It can easily exchange information between two digital devices and realize full-duplex data transmission, with low hardware cost and good versatility.
2 Hardware Design of Serial Communication
Serial communication refers to the use of a data line to transmit data one bit at a time, with each bit of data occupying a fixed length of time. It only requires a few lines to exchange information between systems, and is particularly used for long-distance communication between computers and computers, and between computers and peripherals.
In the developed system, the infrared thermometer detects the working and ambient temperature of the power equipment and transmits 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, and the host PC transmits the online working state of the infrared thermometer. 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 for expansion. The hardware circuit of the serial communication of this 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. Output RS 232C level. MC1489 receives RS 232C level and outputs TTL level. The inconvenience of this level conversion interface is that it requires ±12V operating voltage and consumes a lot of power. It is not suitable for low-power systems.
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 of the 8251A serial port chip is connected to Y2 of the 74LS138 decoder, the port address of the 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
AT89C51 is a low-voltage, high-performance CMOS 8-bit microprocessor with 4K bytes of FLASH memory (FPEROM—Flash Programmable and Erasable Read Only Memory), commonly known as a single-chip microcomputer. AT89C2051 is a single-chip microcomputer with 2K bytes of flash programmable and erasable read-only memory. The erasable read-only memory of the single-chip microcomputer can be erased repeatedly 1000 times. The device is manufactured using ATMEL's high-density non-volatile memory manufacturing technology and is compatible with the industry-standard MCS-51 instruction set and output pins. Due to the combination of a multi-function 8-bit CPU and flash memory in a single chip, ATMEL's AT89C51 is an efficient microcontroller, and AT89C2051 is a streamlined version of it. The AT89C single-chip microcomputer provides a highly flexible and inexpensive solution for many embedded control systems.
Key Features:
Compatible with MCS-51
128×8 bits internal RAM
32 programmable I/O lines
Two 16-bit timer/counters
5 interrupt sources
Programmable serial channel
Low power idle and power-down modes
On-chip oscillator and clock circuit
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 accomplished by setting the microcontroller's serial port control register (SCON). Since an 11-bit data frame is used, 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 uses mode 3. In the microcontroller's serial received frame data, 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) Regulations on 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
Utilize the two transmission lines of RS 232C to realize full-duplex sending and receiving data.
(5) Communication method
In asynchronous communication, data is transmitted in units of words. Since the sender and 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 consists of 11 bits, including a start bit, data bits, parity bit, and stop bit. The data format is as follows [2]:
Therefore, the 8251A initialization mode control word 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-machine interface. In terms of standard serial port communication, the onComm event is triggered during the process of sending or receiving data. The CommEvent property is accessed through programming to understand the type of communication event and handle it separately. The VB serial initialization communication software is as follows [3]:
|
4 Conclusion
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:Programmable Active Filter Circuit Based on Single Chip Microcomputer Control
Next article:Design of serial communication based on single chip microcomputer application system
- Molex leverages SAP solutions to drive smart supply chain collaboration
- Pickering Launches New Future-Proof PXIe Single-Slot Controller for High-Performance Test and Measurement Applications
- CGD and Qorvo to jointly revolutionize motor control solutions
- Advanced gameplay, Harting takes your PCB board connection to a new level!
- Nidec Intelligent Motion is the first to launch an electric clutch ECU for two-wheeled vehicles
- Bosch and Tsinghua University renew cooperation agreement on artificial intelligence research to jointly promote the development of artificial intelligence in the industrial field
- GigaDevice unveils new MCU products, deeply unlocking industrial application scenarios with diversified products and solutions
- Advantech: Investing in Edge AI Innovation to Drive an Intelligent Future
- CGD and QORVO will revolutionize motor control solutions
- 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
- SHT31 Review + Unboxing
- MSP430: Input Capture
- High Voltage Impedance Tuning Quick Guide
- K210 face recognition environment construction process
- Charge up! The latest generation of ACF UCC28782 ultra-small fast charging adapter!
- Proteus simulation experiment of single chip microcomputer communication
- 【TI recommended course】#Power system design tools#
- Question about username
- NeoPixel simulates fluid physics motion
- BMP library management based on FPGA.pdf