51 Cycle in Single Chip Microcomputer

Publisher:快乐的旅程Latest update time:2015-07-13 Source: 51hei Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
First, clarify a few concepts: clock cycle, oscillation cycle, state cycle, machine cycle, instruction cycle

1. Clock cycle, also known as oscillation period: defined as the reciprocal of the clock pulse, which is equal to the reciprocal of the crystal oscillator in a single-chip microcomputer.

   In the 51 single-chip microcomputer, one clock cycle is defined as one beat (indicated by P), and two beats are defined as a state cycle (indicated by S).

   The clock cycle is the smallest unit of time in a microcontroller.

   Eg: For a microcontroller with a 12M crystal oscillator, the clock period = oscillation period = 1/12 us.

 

2. Machine cycle: The time required to complete a basic operation is called a machine cycle.

   In a computer, for ease of management, the execution process of an instruction is divided into several stages, with each stage performing a basic operation.

   Such as: instruction fetch, memory read, memory write, etc.

   In the 51 MCU, one machine cycle consists of 6 state cycles, that is, 12 clock cycles = 12 x 1/12 us = 1 us

   The machine cycle is defined because the clock cycle time is too short to do anything.

 

3. Instruction cycle: It is defined as the time required to execute one instruction.

   Generally, instructions that contain one machine cycle are called single-cycle instructions, such as MOV instructions, CLR instructions, etc.

         Instructions that take two machine cycles are called two-cycle instructions.

         There are also four-cycle instructions.

   The most reliable way to determine whether an instruction is a single-cycle instruction or a two-cycle instruction is to look up the instruction table. I found a summary of the rules on the Internet.

   This rule should be judged in order. The first principle is higher than the last one (mainly 2 to 6). Whichever one is met in order is the one that belongs to it. 

   one type:

   1. MUL and DIV: the only 4-cycle instructions
   . 2. Instructions including DPTR and PC are all 2-cycle instructions.
   3. All absolute jump and conditional transfer instructions are 2-cycle instructions.
   4. All instructions including the A register are single-cycle instructions.
   5. Among the bit operation instructions, ANL and ORL are 2-cycle instructions.
   6. All instructions containing immediate addresses, except INC direct and DEC direct, are 2-cycle instructions.
   7. The rest are single-cycle instructions.

  

    Now, the commonly used microcontroller program writing software is Keil. After writing the program, we can use software debugging to determine the time required for program execution, and we can also see each instruction:

 

Reference address:51 Cycle in Single Chip Microcomputer

Previous article:Digital tube display STC89C54RD+DB18B20 temperature measurement board
Next article:LED water light program one-dimensional array writing 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号