Timing Analysis of MCU

Publisher:独行于世Latest update time:2012-10-17 Source: 21IC Keywords:MCU Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

We introduced the delay program earlier, but it is not perfect, because we only know that the sentence DJNZ R6, D2 will be executed 62500 times, but how long will it take to execute so many times? Does it meet our requirements? We don't know yet, so we will solve this problem below.

Let me first ask a question: What is the most important thing in our school? (Bell) The principal can go on business trips, and teachers can take a break, but if there is no bell in the school for a day, there will be chaos. The whole school works in unison and in a coordinated manner under the unified command of the bell. This bell rings according to a certain schedule, which we can call "time sequence - the order of time". A unit composed of people must have a certain time sequence, and computers must have a stricter time sequence. In fact, a computer is more like a big clock. There are strict rules for when the minute hand moves, when the second hand moves, and when the hour hand moves, and there can be no chaos at all. The things that computers have to accomplish are more complicated, so their time sequence is also more complicated.

We know that when a computer is working, it fetches instructions from the ROM one by one and then executes them step by step. We define the time it takes for a computer to access the memory as a machine cycle. This is a time reference, just like we humans use "seconds" as our time reference. Why not just use "seconds"? It's so good and very familiar. As we continue to learn, we will find that using "seconds" is not a habit.

A machine cycle consists of 12 clock cycles. Let's calculate how long a machine cycle is. Suppose a single-chip microcomputer works with a 12M crystal oscillator, and its clock cycle is 1/12 (microseconds). Its machine cycle is 12*(1/12), which is 1 microsecond. (Please calculate the machine cycle of a single-chip microcomputer working with a 6M crystal oscillator).

Among all the instructions of the MCS-51 microcontroller, some are completed relatively quickly and only require one machine cycle, some are completed relatively slowly and require two machine cycles, and two instructions require four machine cycles. This is not difficult to solve, is it? The execution time of the instruction I asked you to sweep the floor is always longer than the instruction of wiping the blackboard. In order to keep the length of the instruction execution time constant, a new concept is introduced: instruction cycle. The so-called instruction cycle refers to the time to execute an instruction. INTEL gives the instruction cycle number for each instruction. Most of these data do not need to be remembered by us, but some instructions need to be remembered, such as the DJNZ instruction, which is a two-cycle instruction.

Let's calculate the delay. First, we must know the frequency of the crystal oscillator. If we assume that the crystal oscillator is 12M, then one machine cycle is 1 microsecond. The DJNZ instruction is a two-cycle instruction, so it takes 2 microseconds to execute once. A total of 62,500 executions is exactly 125,000 microseconds, or 125 milliseconds.

Keywords:MCU Reference address:Timing Analysis of MCU

Previous article:Improvement of single-chip multi-computer communication network and data communication fault-tolerant technology
Next article:Analysis of the Internal Structure of a Single Chip Microcomputer

Recommended ReadingLatest update time:2024-11-17 00:04

Design of electronic clock based on single chip microcomputer
#include reg51.h #define uchar unsigned char   #define uint  unsigned int   uchar sec = 6, min = 6, hou = 6, a = 0, b = 0, c = 0;   fly num = 0, cmd = 0;   uint time = 0;   uint flag = 0; sbit P30 = P3^0;   sbit P35 = P3^5;   sbit P32 = P3^2;   sbit P33 = P3^3;       uchar code tab ={0xc0, 0xf9, 0xa4, 0xb0, 0x99,
[Microcontroller]
51 Basic concepts of microcontroller serial communication
What attitude should beginners adopt when learning microcontrollers? Some very unruly attitudes must be corrected.   I have taught so many students, and some of them think that 8-bit computers are really too simple. They feel that they have already started and they want to learn embedded, play with ARM, and do Linux.
[Microcontroller]
51 Basic concepts of microcontroller serial communication
Design of portable wireless medical drip monitoring system based on AVR microcontroller
 introduction     Intelligence and portability are the development trends of modern electronic products. The intelligence of medical electronics makes the operation of medical staff more convenient. Medical staff can carry a handheld monitor to monitor the drip in each ward in real time and keep abreast of relevant
[Medical Electronics]
Design of portable wireless medical drip monitoring system based on AVR microcontroller
Large capacity Flash type AT91 series ARM core microcontroller
introduction AT91FR40162 is a member of the AT91 series of microcontrollers produced by Atmel Corporation of the United States. It has an ARM7TDMI core, large-capacity Flash memory, on-chip SRAM and peripherals. The characteristics of this microcontroller are high performance-32-bit RISC architecture, hig
[Microcontroller]
Large capacity Flash type AT91 series ARM core microcontroller
Microchip launches PIC16 microcontroller with integrated micro FPGA, priced at less than 50 cents
Compiled from EEJOURNAL Microchip now offers a flash-based microcontroller with integrated programmable logic blocks for less than 50 cents. The nine new products in Microchip's PIC16F13145 series use the same 8-bit RISC microprocessor architecture as other models in the 16F series, but they also integrate a new blo
[Microcontroller]
Microchip launches PIC16 microcontroller with integrated micro FPGA, priced at less than 50 cents
What are the differences and connections between microcontrollers and embedded systems?
  With the development of electronic information science and technology, the application of single-chip microcomputer and embedded system has been broadened. This paper briefly analyzes the relationship between single-chip microcomputer and embedded system, the basic knowledge of composition structure comparison, and l
[Microcontroller]
What are the differences and connections between microcontrollers and embedded systems?
Automatic display of the tilt status of the vehicle platform based on single chip microcomputer
  Whether a rocket launcher can quickly launch a fire attack is an important factor in measuring the combat performance of its weapon system. Before a rocket launcher can accurately strike a target, it must be accurately leveled. At present, when troops level the rocket launcher body platform, the leveling process is
[Microcontroller]
Automatic display of the tilt status of the vehicle platform based on single chip microcomputer
Design of Carbon Monoxide Monitoring and Alarm Instrument Based on ADuC834 Single Chip Microcomputer
Introduction With the rapid development of industry, there are more and more occasions where humans are exposed to harmful gases, which causes more and more harm to humans themselves. In steel mills and iron mills, the blast furnace gas (mainly composed of CO), a byproduct of blast furnace production, i
[Microcontroller]
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号