1 Introduction
Central air conditioning controller is different from ordinary air conditioning controller. Ordinary air conditioning controller is installed in the indoor hanging unit, and the controller size requirement is not high. It can use any single-chip microcomputer plus external expansion, no matter how many peripheral devices there are. However, since there is no indoor unit to place in the central air conditioning controller, it can only be placed alone, so the controller is required to be small and exquisite. In this design, the user requires the size of the designed controller to be similar to the size of a general household switch panel, with seven buttons, ten LED light indicators and a temperature display, and other functions such as remote control and two-way temperature sampling.
2 System Hardware Design
According to the user's requirements, we made a preliminary design. When arranging the components, we found that in such a small space, after placing the keyboard and display required by the panel, there was only room for a single-chip microcomputer. So how to place the A/D, infrared remote control decoding and peripheral drive circuits? After comparison, we finally chose the PIC single-chip microcomputer. PIC16F877 was used in the development stage, and it can be changed to PIC16C74 later to reduce product costs.
The application of PIC16F877 in this system has the following advantages:
· It has a built-in 10-bit multi-channel analog-to-digital converter, so there is no need to add an external analog-to-digital converter;
· There are three timers, and there are enough clocks available, because the most important part of air conditioning control is on the clock, and the timer is also needed to realize the software decoding of infrared remote control.
In the design, in order to reduce the driving requirements, all low-level signals are used, which further reduces the space requirements of peripheral devices.
In Figure 1, the RA3 pin cannot be used due to the setting limit of the analog-to-digital conversion, and the RC0 and RC1 pins cannot be used due to the clock definition limit.
3 System Software Design
3.1 Overall design plan
The main program of the system is very simple, and it mainly performs one task, which is keyboard scanning detection. Because PIC16F877 has only one external interrupt pin, in order to realize infrared remote control soft decoding, the keyboard must adopt scanning query mode. The technical solution of this system mainly focuses on infrared remote control software decoding and clock control.
3.2 Infrared remote control software decoding
The infrared remote control uses HOLTEK's HT6221 multi-function encoding chip. According to the information released by the company, the chip uses PPM encoding. Each time the HT6221 sends a code, it first sends a 9ms header code and a 4.5ms gap, and then sends out a 16-bit address code (18ms~36ms), an 8-bit data code (9ms~18ms) and an 8-bit data inverse code. Figure 2 shows the format output on the DOUT pin.
The data is identified as: 1.12ms is 0, 2.24ms is 1, as shown in Figure 3. In this way, the infrared remote control software decoding needs to design a clock, which can be identified by counting synchronously with the interrupt. The system clock of this system is 4MHz. In order to facilitate the identification of data values, we determine that the clock interrupt is 0.28ms. Its basic working principle is: decoding by judging the number of clock interrupts (i.e. time value) between two external interrupts. The basic algorithm is as follows:
[page]
3.3 Clock Control Design
The clock interrupt design is the key point of this system. Almost every function of the system revolves around the clock. For example, the compressor outdoor fan starts 20 seconds after the indoor fan starts. When the temperature reaches a certain level, the compressor turns off the fan 20 seconds after it stops. The compressor can only be turned on again three minutes after it stops. The temperature is adjusted by pressing the button, and it will resume after 5 seconds of not pressing the button, and the temperature will be displayed, and the LED will flash. In various modes, in addition to the time requirements for the control itself, there are many clock requirements for protecting the system. After careful analysis of the system, the design plan mainly focuses on two aspects:
The first is to handle various states well. To this end, the state flag is defined for each state as follows:
The four switching modes of the system define the state, and the definition name is mode.
The above lists the states defined by the system. It is with the help of these states that the processing of time control is facilitated.
Second, after analysis, although there are many requirements for clocks, they are all seconds, minutes, and hours, so a real "clock" is designed, and the control of "seconds" is placed in the "seconds" section, "minutes" is placed in the "minutes" section, and "hours" is placed in the "hours" section. Combined with the above states, the control logic is very clear. The algorithm is shown below:
Clock interrupt service program
Secs++ "seconds" count
If Secs<6
goto sec-1 If it is less than 1 minute, process the "seconds" program segment
else
{
The above program is implemented in assembly language. For the sake of clarity and reducing space, algorithm description is used here to illustrate.
Previous article:Remote control response alarm device made with single chip microcomputer
Next article:Single chip control of speech recognition system
Recommended ReadingLatest update time:2024-11-16 22:32
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
- [RVB2601 Creative Application Development] Alibaba Cloud Testing
- Six-and-a-half-digit high-precision current source ATS-2100C
- 12 "Wanli" Raspberry Pi car - socket learning (Android sending and receiving)
- How does Windows know the last startup failure?
- An adjustable voltage regulator circuit with 6V input and 8V output
- 【2022 Digi-Key Innovation Design Competition】Latest unboxing post
- [Precise delay function] Precise delay function in IAR (MSP430)
- After reading this article from the Research Institute, I feel that 6-lane Wi-Fi still has a long way to go.
- Warning for trouble~~~~ la la la~ hurry to the front of the post to find out
- mcgs Kunlun Tongtai Modbus RTU, Modbus TCP communication method Modicon Modbus communication configuration steps