Questions about RAM, SFR and bit address in 51 single chip microcomputer

Publisher:知音学友Latest update time:2018-05-08 Source: eefocus Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

There is a bit address 4EH in the 51 single-chip microcomputer.
The 16 bytes of RAM 20H~2FH in the 51 single-chip microcomputer can be addressed according to "bits".
There are a total of 128 "bit addresses", which are 00H~7FH.

The bit address 4EH is the 6th bit in the "byte unit with byte address 29H". 

Postscript: Zuoerlundao has collected the usage specifications of the on-chip RAM in 51 single-chip microcomputers and sorted them out as follows.

The MCS-51 series MCU has a total of 128 bytes of RAM on the chip, with an address range of 00H~7FH.
In these 128 bytes, all operations (read, write or calculate) can be performed according to the byte address, and direct or indirect addressing methods are possible. In
these 128 bytes, according to the usage characteristics, they can be divided into three categories: working register area, bit addressing area and general data area.
The usage classification of the on-chip RAM can be seen in Table 1.

About RAM, SFR and bit address in 51 MCU - Non-famous blogger - Electronic Information Corner

The following will introduce them according to their functional characteristics.
1. Working register area
In the on-chip RAM of the MCS-51 series microcontroller, there are four working register areas, called working register area 0 to working register area 3.
Each area has eight bytes. In addition to being able to operate with byte address numbers, it can also be operated with names such as R0, R1...R7. Operating with names is called register addressing, and the instruction code is relatively short.
Among them, R0 and R1 can be used as indirect addressing registers, and the contents in them are used as addresses to indirectly address the on-chip RAM (or 256 bytes of off-chip RAM).
At any time, only one working register area can be used. The area currently in use can be determined by setting RS1 and RS0 in PSW through instructions. PSW is called the program status word, which is a special function register to be introduced below.
By setting RS1 and RS0, the current working register area can be quickly switched, which is suitable for protecting the scene in different program segments. The working register area that is not currently in use cannot be named R0, R1...R7, but can be read and written at will according to the byte address.
During reset, RS1 and RS0 are initialized to 0, so the working register area 0 will be automatically used after reset.

2. Bit addressing area
The bit addressing area has 16 bytes in total, and the byte address is 20H~2FH. Each of the 8 "bits" in a byte has a "bit address". There are 128 bits in total, and the range of "bit address" is 00H~7FH.
The corresponding relationship between "byte address" and "bit address" in this area can be seen in Table 2.

About RAM, SFR and bit address in 51 MCU - Non-famous blogger - Electronic Information Corner

From Table 2, we can see that the "bit address 4EH" mentioned in the previous question is the sixth bit in the "byte address 29H". The
bit addressing area can be operated on a single bit according to the "bit address", or it can be operated on according to the "byte address", that is, the contents of eight bit addresses can be operated at the same time.
The MCS-51 series of microcontrollers has a set of dedicated "bit operation" instructions (also known as Boolean instructions), which can perform "and", "or", "not" and other operations on these bit addresses. This is one of the characteristics of this series of microcontrollers.

3. General data area
The general data area has 80 bytes and can only be operated according to "byte address" (direct or indirect addressing).

The above introduces the RAM in the address range of 00H~7FH. The following continues to introduce this address and move towards higher addresses.

There are 21 special function registers (SFRs) distributed discretely in the address range of 80H~FFH on the chip. The register names and address distribution are shown in Table 3. The
8052 series microcontrollers also have 128 bytes of general-purpose RAM in the range of 80H~FFH. When operating it, the "indirect address" addressing method must be used. The
special function registers in this address range can only be operated using the "direct" addressing method.

About RAM, SFR and bit address in 51 MCU - Non-famous blogger - Electronic Information Corner

Eleven of the special function registers can be "bit-addressed". Table 3 also lists the bit-addressable registers and bit address numbers. In
Table 3, if the bit address is blank, it means that the register cannot be "bit-addressed".
From Table 3, we can see the rule: when the byte address is divisible by 8, the byte can be bit-addressed. The "bit address" of the lowest bit is the same as the "byte address", and the bit addresses of other bits are incremented by 1 in the order of high bits.
===================================================


Reference address:Questions about RAM, SFR and bit address in 51 single chip microcomputer

Previous article:MCU C language programming: buttons, counting and display
Next article:Improvement of 4×4 matrix keyboard circuit

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号