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.
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.
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.
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.
===================================================
Previous article:MCU C language programming: buttons, counting and display
Next article:Improvement of 4×4 matrix keyboard circuit
- Popular Resources
- Popular amplifiers
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
- Huawei's Strategic Department Director Gai Gang: The cumulative installed base of open source Euler operating system exceeds 10 million sets
- Download from the Internet--ARM Getting Started Notes
- Learn ARM development(22)
- Learn ARM development(21)
- Learn ARM development(20)
- Learn ARM development(19)
- Learn ARM development(14)
- Learn ARM development(15)
- Analysis of the application of several common contact parts in high-voltage connectors of new energy vehicles
- Wiring harness durability test and contact voltage drop test method
- Why is negative feedback introduced in the amplifier circuit?
- OCP China Day 2021 is about to be held, and we invite you to come and discuss the most cutting-edge industry applications of open computing!
- Detailed explanation of ADC of MSP430 microcontroller
- About CH32V103 timer interrupt problem
- Realization of various wavelet transforms based on FPGA
- MSP430FR2433 LaunchPad Development Kit
- The world's first integrated 5G baseband processor Kirin 990 5G was released today
- [CH579M-R1] + Help: Simulating I2C to read data failed (solved)
- CC2530 RF part use - to achieve point-to-point transmission and reception
- Cut the charging cable TI wireless charging solution to unlock a variety of applications