51 MCU operation process

Publisher:Radiant777Latest update time:2017-01-11 Source: eefocus Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

Note:
1.ROM: Read-only memory. The read-only storage area of ​​the microcontroller is mostly used to store program memory, also known as program memory.

  • The 51 single-chip microcomputer is an EPROM, which is an erasable read-only memory. The original program can be erased and a new one can be written in.

  • The data can be saved after power failure, but the data memory (RAM) cannot be saved.

  • RAM can only store defined variables continuously when the program is executed. For example, int x, int y

  • You can use the code instruction to put the defined variables in ROM instead of RAM, saving RAM resources

2. RAM: Random Access Memory, used to store defined variables, etc., fast

  • The RAM storage capacity of the 51 microcontroller is much smaller than the ROM, but the speed is very fast.

    Detailed interior illustration

The internal structure looks very complicated, but it can be roughly divided into two parts: the operator (red box) and the controller (blue box).

  • Arithmetic unit: Its main function is to perform addition, subtraction, multiplication, division and logical operations.
    The internal structure can be found online.

  • Controller: controls various operations of the microcontroller

    Program execution process

    1. Program address
    When the program starts, the address of the first program must be known first, which is known through PC (Program Counter).
    For example, at the beginning, the address is 0000H, which is hexadecimal.
    When this address is sent to the address register, that is, after the first instruction is taken out, PC automatically increases by 1, ready to take out the next instruction.

2.
After knowing the address of the instruction by reading the address register, it takes out an instruction pointed to by the address from the ROM (read-only memory).
And puts the fetched instruction into the instruction register, and compiles it through the instruction encoder.

3. Data processing
instructions may require addition, subtraction, multiplication, division and assignment statements. After the instruction encoder, we know which defined data or assignment statements to take out.
We retrieve the data we need through the bus and perform calculations through the arithmetic unit.

For example, we define int x and int y, and store these two data in RAM.
When we fetch an instruction a = x + y, we need the values ​​of x and y to calculate.
Then, through the data fetching process in the previous figure, the data of x and y are fetched
and calculated by the arithmetic unit.

As shown in the figure, take out x and y and enter the black box (operator) to get the final result.
The final result will also be stored in the data storage (RAM) through the variable a.
4. Operating device
Of course, in addition to the calculation step, there is also a situation where the high and low levels of the IO port or other devices are directly controlled.

illustrate

The operation process of this microcontroller is obtained by the author after consulting the data, and it is not necessarily correct. If it is not correct, please correct it.


Reference address:51 MCU operation process

Previous article:LAN control system - lower computer - single chip microcomputer
Next article:MCU 4*4 button digital tube display 0-9

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号