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.
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
- Popular Resources
- Popular amplifiers
- Wireless Sensor Network Technology and Applications (Edited by Mou Si, Yin Hong, and Su Xing)
- Modern Electronic Technology Training Course (Edited by Yao Youfeng)
- Modern arc welding power supply and its control
- Small AC Servo Motor Control Circuit Design (by Masaru Ishijima; translated by Xue Liang and Zhu Jianjun, by Masaru Ishijima, Xue Liang, and Zhu Jianjun)
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
- 【Portable programmable instrument】Begin preparation for debugging
- TIOBE Programming Language Rankings April 2022
- Selection of Serial Port to WiFi Module and Serial Port to Network Port Module for Industrial Control Gateway of Internet of Things
- TI Cortex MCU Industrial Safety Applications
- [Raspberry Pi Pico Review] WS2812B Snowflake Light Practice -- and IoT Communication RGB Control
- How to convert a sine wave into a square wave
- If you want to work in electronics, you need to remember these English words!
- Decoupling Technology
- Bluetooth 4.0 BLE Development Complete Manual: Practical IoT Development Technology
- Why can't I find the management option in the Download Center?