Realization of Single Chip Microcomputer Operating Frequency Switching

Publisher:楼高峰Latest update time:2012-03-01 Source: 电子产品世界 Keywords:MCU Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

With the development of single-chip microcomputer technology, the performance of single-chip microcomputers has been greatly improved, and the operating speed is getting faster and faster, which makes the application of single-chip microcomputers more and more extensive.

Sometimes due to the speed of peripheral devices or other requirements, the operating speed of single-chip microcomputers cannot be very high, and sometimes it is required to be relatively low. For example, when an 8-bit single-chip microcomputer is used for PC/XT bus interface, the operating frequency is up to 4.77MHz, then the operating frequency of the single-chip microcomputer can only be 4.77MHz, which will lead to a decrease in operating speed. When other hardware requires a higher operating frequency, how can we reconcile these two contradictions? Can the single-chip microcomputer work at 4.77MHz when interfacing with PC/XT, and work at a higher frequency when running other programs?



First, we did such an experiment, as shown in Figure 1. We used an external oscillator circuit to obtain two high and low oscillation sources (4:1) through frequency division, and connected them to the external oscillation input of the microcontroller through two controllable gates. P1.0 is used to select the input oscillation frequency, that is, during the execution of the program, the input frequency is directly changed by the language (of course, when changing the frequency, the serial port and timer cannot be used). After the experiment, it was found that although the microcontroller can still work normally, the interference generated during the frequency change process caused some registers in the microcontroller and the data in the RAM to change, and the working state after the change was not very stable.

From the above experiments, it can be seen that it is not advisable to directly change the working frequency of the microcontroller in the normal working mode. In fact, the microcontroller has two other working modes: waiting working mode and power-off working mode (all microcontrollers made by CHMOS process generally have them). After the microcontroller enters the power-off working mode, it must be reset by hard reset, which is obviously not advisable. In the waiting working mode, the clock signal sent to the CPU is blocked, and the CPU enters the waiting state. The internal state of the CPU, such as the stack pointer (SP), program counter (PC), program status word (PSW), accumulator and other registers, is completely preserved, and the waiting working mode can be awakened by individual interrupts, which is exactly what we need. So we add a delay circuit (which can be made with a counter) to the original circuit diagram and connect it to the frequency switching control line, so that the controllable gate can act after entering the waiting working mode. In addition, P1.1 is used to generate individual control signals, which are used as interrupt sources through the delay circuit to wake up the microcontroller. Experiments show that this method can indeed stably realize the switching of the microcontroller's operating frequency, and the additional circuit is also very convenient to implement.



In actual applications, it is found that the I/O port lines of the microcontroller are often not enough. If two I/O ports are used here, it is actually a waste, and it is more troublesome to implement with one. In fact, after the microcontroller enters the waiting working mode, ALE and PSEN are both high levels. ALE continuously outputs pulses with a frequency of fosc/6 when the microcontroller is in normal working state. Only when the CPU accesses the off-chip data memory will a pulse be lost. The frequency control signal and interrupt signal can be generated by the change of the ALE signal. As shown in the figure, the counter counts the input pulses to generate them, and the ALE signal is used as the selection signal of counter 1, so that the control signal and interrupt signal are stopped due to continuous refresh during normal operation. After entering the waiting working mode, counter 1 starts to count formally due to long-term selection, and first generates a control signal to switch the frequency. After the delay of counter 2, the interrupt is used to wake up the microcontroller to enter the normal working state and continue to execute at equal distances.

Experiments show that this method can indeed run reliably, without the need for I/O ports and many control commands. As long as a control command is used to enter the waiting working mode, it will automatically generate a signal to change the frequency and an interrupt signal to wake up the microcontroller. Just add a simple interrupt handler to switch between the two working frequencies at will, fast when it is fast, slow when it is slow, and truly as you wish.

Keywords:MCU Reference address:Realization of Single Chip Microcomputer Operating Frequency Switching

Previous article:Application of PSD813 Device in Single Chip Microcomputer System
Next article:Design of power supply circuit based on LP2951 single-button switch

Recommended ReadingLatest update time:2024-11-16 15:55

MCU+ADC0832+MQ2 temperature and smoke alarm control
1. Actual photos         2. Schematic diagram and PCB diagram drawn by Altium Designer are as follows: (Project files can be downloaded in the 51hei attachment)     Components list: 1. AT89C52 2. 40P base 3. 8P base 4. 5MM LED*2 (red, green) 5. 3MM LED (yellow) 6. 12M crystal oscillator 7. 30P ceramic capacitor*
[Microcontroller]
MCU+ADC0832+MQ2 temperature and smoke alarm control
CMOS automotive electronic regulator based on single chip microcomputer
Introduction to CMOS automotive electronic regulator based on single chip microcomputer The degree of automotive electronics has now become an important international standard for measuring the advanced level of automobiles. It is also for this reason that the current automotive electronics industry is driven a
[Microcontroller]
CMOS automotive electronic regulator based on single chip microcomputer
STM8 MCU ADC Application (IAR)
The STM8 chip integrates a 10-bit successive approximation analog-to-digital converter. There is a potentiometer connected to AIN3 on the development board, but there is no LED digital tube or LCD display to display data. What should I do? The AD acquisition data can be sent to the computer through UART for display. #
[Microcontroller]
Analysis of the startup code provided by 51 MCU Keil (STARTUP.A51)
1. Startup code generated by Keil C Program Listing 1.1 AT89C51 startup code $NOMOD51 //Do not use the default special function register 51 ;------------------------------------------------------------------------------ ; This file is part of the C51 Compiler package ; Copyright (c) 1988-2002 Keil Elektronik GmbH and
[Microcontroller]
Principles of microcontroller selection
★Performance Decide which MCU to choose based on the complexity of the design task ★Memory During the R&D stage, it is recommended to use Flash MCU, which has the advantages of electrical writing and electrical erasing, making it easy to modify the program and speeding up the development process For products that h
[Microcontroller]
ATmega16L MCU digital tube display example program design
Introduction: Here we provide you with an ATmega16L microcontroller digital tube display example program design. ;************************************************************** ;*Title: ATmega16L MCU digital tube display example program ;*document: ;*Version: 1.0 ;**************************************************
[Microcontroller]
An example of designing a single-chip computer keyboard processing program
1. Connection between keyboard and microcontroller Keyboard connection image 3 Microcontroller and keyboard interface diagram Figure 4  2. Connect through the 1/0 port. Connect one end of each button to the I/O port of the microcontroller and the other end to the ground. This is the simplest way. As
[Microcontroller]
An example of designing a single-chip computer keyboard processing program
16-bit MCU development technology based on PIC24F16KA102 XLP design
PIC24F16KA102 is an extremely low 16-bit MCU with a modified Harvard architecture, up to 16MIPS at 32MHz, 8MHz oscillator with 4x PLL selection and multiple division selections, 17-bit x17-bit single-cycle hardware multiplier, 32-bit x16-bit hardware divider, 16-bit x16-bit working register array, C compiler, low po
[Microcontroller]
16-bit MCU development technology based on PIC24F16KA102 XLP design
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号