Application of data memory, the "soul" of single-chip microcomputer

Publisher:ShimmeringMoonLatest update time:2018-03-16 Source: eefocusKeywords:MCU Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

  We can say that the program memory stores the soul of the microcontroller, which is the working program. The smallest one may be only 1KB (it can only hold 1024 8-bit data at most, because there are many 2-byte and 3-byte instructions in the actual instructions, so it cannot hold 1024 instructions) and the largest one may be 128KB.
  
  These 8-bit data are either photolithographed in the factory, or burned in at one time, or... use a special tool called a programmer to load the successfully debugged machine code into it, or spend a few dollars to make a download cable like the AVR microcontroller and load these things from the computer into it (perhaps the most attractive feature of AVR). Once it enters the computer's program memory, it cannot be freely rewritten except with the help of the above-mentioned device. When the microcontroller is running, it only reads instructions or fixed data from it, so the program memory is given an alias of "read-only memory", abbreviated as ROM, including EPROM that uses a programmer to write ultraviolet erase content, electrically erased EEPROM and the emerging FLASH ROM; ROM that is written once is only used in batch products with fixed circuits and programs, and they are all the same in actual work.
  
  In actual use, in order to locate the data in the ROM when the microcontroller is running, each 8-bit storage unit actually has a fixed "address", usually expressed in hexadecimal: for example, for a so-called 4K ROM, the address is from 0000H to 0FFFH, (that is, from 0000, 0001...4095). When the microcontroller is running, which address to fetch data from is completely determined by the program itself, and we do not need to intervene. Remember, when the microcontroller is powered on, it goes through a short reset process and immediately turns to the lowest address 0000H of the ROM. There is often a "jump" instruction placed here, which jumps from here to another address in one step: the real starting address of the program, such as 0080H for a 51 machine. Is there only instructions in the ROM and nothing else? ROM is a program memory, which includes certain fixed data required to run the program in addition to instructions. If we require that a certain port of a single-chip microcomputer outputs a value from 00H to FFH (255) that changes in a half-sine wave, 10,000 times per second, then if we force it to calculate one by one according to the formula, it will be beyond its ability. However, we can store the pre-calculated values ​​in ROM and directly retrieve them when the time comes.
  
  When it comes to data storage, it is actually a piece of storage that can access data at any time, that is, a storage that can be read (taken) or written (stored), referred to as RAM. The RAM used in current single-chip microcomputers belongs to static RAM or SRAM, which is different from the memory stick used in computers. As long as you write data into SRAM, as long as the power is not turned off or it is not cleared, the data will be stored there. Computers use dynamic RAM, which needs to be constantly refreshed to save data. Because the amount of information processed by a single-chip microcomputer is much smaller than that of a computer, it has less RAM: from none, 128, 256, ... 1K, 2K to 4K, much less than ROM.
  
  Because in fact, RAM is only used as a temporary storage place for data. Unless image processing requires the storage of a large amount of data, generally for single-chip microcomputers that perform simpler tasks, this much is enough. If it is really not enough, it can only be expanded by adding SRAM such as 6116, 6264, etc. In order to access 8-bit binary numbers in RAM units, of course, the specific location is marked with "address" like ROM. If a single-chip microcomputer has 1K (1024) RAM, its address is also from 0000 to 1024, or 0000H to 03FFH in hexadecimal. It can be seen that the address is the same as ROM. Will it be confused? No, because reading ROM is performed by the program pointer or transfer instruction or table lookup instruction of the single-chip microcomputer, and these instructions will not enter the RAM area. Reading and writing RAM is another data transfer instruction, and it will not enter the ROM area. This is also different from computers. The latter's programs and data are in the memory bar, with different addresses. If they are misplaced, it will cause unpredictable consequences. This memory structure of the single-chip microcomputer is also called Harvard structure.
  
  The RAM mentioned in this article is mainly used to store temporary data in the microcontroller. For example, when measuring temperature with a microcontroller, it measures once per second and displays the average value of one minute (updated once per minute). We first use sensors, amplifier circuits, and A/D conversion to convert the analog temperature into a proportional binary number. Then, once per second, the digital value is sequentially stored in the RAM of the microcontroller through the input port. Then, they are summed up and averaged in pairs (off topic: it is troublesome for the microcontroller to perform "division" operations, but division by 2, 4, 8... is very simple. Use the "right shift" instruction 1, 2, or 3 times). The final value is displayed, and then all 60 storage units are written with 0 to clear the old data, and the cycle will be repeated again next time. In addition, there are several registers in the microcontroller. The number is small but the functions are very important. In addition to temporarily storing data, they can also exchange, process, transmit, etc., as well as record the current state of the microcontroller at any time. The input and output ports also exist as registers with special functions. The specific functions are different, so you can't figure them out by just talking about them. You need to read relevant books.

Keywords:MCU Reference address:Application of data memory, the "soul" of single-chip microcomputer

Previous article:DDS+PLL Frequency Synthesis Technology and Application
Next article:Analysis of SMS design based on TC35i GSM module

Recommended ReadingLatest update time:2024-11-16 19:57

51 MCU clock and reset
Clock circuit: The clock signal of 8031 ​​microcontroller is usually obtained by two circuit forms: internal oscillation mode and external oscillation mode. Connecting a crystal oscillator (referred to as crystal oscillator) or ceramic resonator to pins XTAL1 and XTAL2 constitutes the internal oscillation mode. Since
[Microcontroller]
51 MCU clock and reset
Railway signal semi-automatic blocking optical cable transmitter based on STC single chip microcomputer
Semi-automatic block railway lines exist in large numbers in China, and the block information used to connect a train between two stations is completed by two types of information: positive and negative pulses. The transmission medium for transmitting block information is overhead open wires or optical cables. Railway
[Microcontroller]
Railway signal semi-automatic blocking optical cable transmitter based on STC single chip microcomputer
Notes on using Keil C51 MCU development environment
It is best to use Keil to write C51 programs. You can also use Weifu, but Weifu's editing capabilities are far inferior. I am used to writing code with Keil, and then using Weifu hardware simulation (only WAVE simulation head). However, Keil is easy to use, but the key to writing code is still the C51 level, that is
[Microcontroller]
Notes on using Keil C51 MCU development environment
How to break through the growth pole of the automotive MCU market? Xihua Technology's TMCU breaks through the barriers
The huge opportunities and changes brought by the "New Four Modernizations" to the automotive industry have also impacted the existing supply chain system. Domestic chip companies that were once blocked by high technical barriers have gradually broken through. Among them, the key components of auto
[Automotive Electronics]
Design of Waveform Generator Based on FPGA and Single Chip Microcomputer
1 Introduction The application of programmable logic devices (PLD) and EDA technology has become a trend in electronic system design. FPGA is an emerging programmable logic device (PLD). Compared with other PLDs, it has higher density, faster working speed and greater programming flexibility. Single-chip microc
[Microcontroller]
Design of Waveform Generator Based on FPGA and Single Chip Microcomputer
Design and implementation of fire-fighting robot based on AVR microcontroller
Abstract: According to the competition rules of the fire-fighting robot, the hardware structure design scheme and software design process of the fire-fighting robot are given. The robot processor used is an AVR microcontroller, which mainly uses infrared sensors and photosensitive sensors to detect the environment,
[Industrial Control]
Design and implementation of fire-fighting robot based on AVR microcontroller
National Technology starts from the aftermarket to help upgrade the intelligent safety of automobiles
The "2021 China Integrated Circuit Design Innovation Conference and IC Application Expo" (ICDIA for short) was held at Suzhou Shishan International Conference Center. Focusing on the recent hot topic of automotive electronics chip shortage and localization, the "8th Automotive Electronics Innovation Forum and 2021 Aut
[Embedded]
National Technology starts from the aftermarket to help upgrade the intelligent safety of automobiles
Explanation of the architecture of the external circuits and ports of the ht46f49e microcontroller
Through the study of the brief description of the functions of the single-chip microcomputer in the introduction to the single-chip microcomputer , we know that the core function of the single-chip microcomputer can be described as: being able to perform certain operations in sequence according to the pre-set function
[Power Management]
Explanation of the architecture of the external circuits and ports of the ht46f49e 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号