P87LPC761 single chip microcomputer controlled time controller system

Publisher:DazzlingSpiritLatest update time:2012-06-09 Source: 现代电子技术 Keywords:P87LPC761 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

1. System Introduction

The time controller is a small system composed of a P87LPC761 microcontroller and a 74HCl64 expansion chip. It controls a relay and can set the time of the day, the relay opening time and closing time. A total of 6 timing groups can be set, which can eliminate unnecessary timings and enable emergency start. All settings are realized through the keyboard, and the buttons have a combo function. Each state has an indicator light. The time controller uses an external 100kHz crystal oscillator and is powered by AC power and equipped with a rechargeable battery. After the AC power is removed, it enters the leisure mode and the clock continues to run.

2 Hardware Circuit Design and Analysis

The system functional block diagram is shown in Figure 1. The difficulty of this system design is not in the hardware but in the software design under the low-frequency crystal oscillator.

The entire hardware circuit can be divided into three parts: power supply, keyboard display and CPU, which are analyzed as follows.

2.1 Power supply

Convert AC power into DC power required by the microcontroller. This is a very common power supply circuit. In order to ensure that the clock can continue to run after the AC power is removed, a charging circuit is added to the power supply part with a rechargeable battery. When there is AC power, the external power supply is directly used to charge the rechargeable battery at the same time. After the AC power is removed, the rechargeable battery is used as the power supply to enter the leisure mode.

2.2 Keyboard and display circuit

Click to browse products in a new window

In order to save components, a dynamic scanning method is used to display the clock, and a 74HCl64 is added to this part. The microcontroller sends data to the 74HCl64 through the serial port, and the data is displayed on the seven-segment digital tube. A triode is added to the common end of each digital tube to amplify the current of the scanning signal to drive each digital tube.

2.3 CPU part

The CPU part is the core of the time relay. It is mainly controlled by P87LPC761. As a member of the Philips small package series, P87LPC761 is a 20-pin packaged single-chip microcomputer, suitable for many occasions requiring high integration and low cost, and can meet many performance requirements. P87LPC761 provides high-speed and low-speed crystal oscillators and RC oscillation modes, programmable selection, with a wide operating voltage range, programmable I/O port line output mode selection, selectable Schmitt trigger input, LED drive output, and internal watchdog timer. P87LPC761 uses 80C51 accelerated processor, and the structural instruction execution speed is twice that of the standard 80C51 MCU. The schematic diagram of the CPU part circuit is shown in Figure 3.

Click to browse products in a new window

3 Software Design

Each machine cycle of the P87LPC761 microcontroller is 6 clock cycles, using a 100kHz crystal oscillator, and each machine cycle is 60/1s. According to experiments, in order to ensure that the LED does not appear to flicker, the time interval between lighting up the digital tubes cannot be greater than 24ms. There are 4 digital tubes in total, so the time interval between lighting up every two digital tubes cannot be greater than 6ms. This should be noted in programming. There are a total of 100 machine cycles between each two interrupts, which is very limited. Therefore, the following principles should be followed when programming:

(1) The program should be as simple as possible. The main program should be as short as possible.

(2) Make the interrupt program as short as possible to give as much time as possible to other programs.

(3) The branch program should be as numerous and short as possible to avoid unnecessary work. [page]

Due to the length of this article, only the overall flow chart of the program is introduced here, as shown in Figure 4.

Click to browse products in a new window


Click to browse products in a new window
Click to browse products in a new window

4.1 Timing compensation

Timer. Works in mode 1, and the count of mode 1 is affected by software. In order to reduce the timing error, when restoring the initial value of timer 1 (3CBOH), the time occupied by the software should be made up. Re-assigning the initial value in the interruption is done as follows:

Click to browse products in a new window

After software compensation, if the crystal oscillator is accurate, the only error that can cause timing error is the interrupt response time.

4.2 Low power consumption processing

Low power consumption is an issue that must be addressed in this design. The presence of AC power is detected through the AC detection circuit. In the program, it is handled as follows: query the level of P1.3 port. When P1.3 port is high, it enters the normal state, that is, the display, keyboard, all interrupts, and serial port are working normally. Once P1.3 port is low, the display, keyboard, serial port and T1 interrupt are turned off, that is, only the TO interrupt of the refresh clock is opened (this is to ensure that the clock can still run and data is not lost in the idle mode) to enter the idle mode. In order to reduce system power consumption, it is also necessary to turn off power-off detection, comparators, etc. This part of the work is completed in the initialization part.

4.3 Status indicator

In order to make full use of the system hardware resources, the decimal point of the seven-segment digital tube is used as the status indicator. Because there is no decimal in the clock display. In the program, we control the decimal point in this way. In the seven-segment code table, the code with a decimal point is placed after the code without a decimal point. The code positions with and without a decimal point for the same number are 10 apart. When a decimal point is needed, just add 10 to the pointer of the code. Two indicator lights are arranged, D10 (green) is the on time indicator, and D11 (yellow) is the off time indicator. If both green and yellow lights are on, it means that the current timing group has been disabled.


Keywords:P87LPC761 Reference address:P87LPC761 single chip microcomputer controlled time controller system

Previous article:Development of Chinese version of LCD display based on BP elevator control system
Next article:Discussion on MSP430 Program Upgrade Method

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号