Application of PIC microcontroller in central air conditioner controller

Publisher:自由探索Latest update time:2012-02-06 Source: 电子工程师 Keywords:PIC16F877 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

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.

Keywords:PIC16F877 Reference address:Application of PIC microcontroller in central air conditioner controller

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

PIC16F877 EEPROM reading and writing experiment
The typical reading/writing time of each EEPROM unit of PIC16F877 is 4ms, and the maximum is 8ms. In the process of programming each EEPROM unit, the CPU needs to insert a waiting time, which can be solved by using the interrupt function or the software query method. Here we use the software query method to cyclically
[Microcontroller]
PIC16F877 EEPROM reading and writing experiment
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号