Next, let's look at the consequences of accessing a valid address and writing to a prohibited address.
The purpose of the first program is to store the two data 31H and 11H into two units of the external data memory respectively , but the program uses the two logical units corresponding to the physical space 00 unit of the first memory. As a result, the second data 11H overwrites the first data 31H in the physical address 00 unit of the first memory. The problem explained by this program is that one physical unit of the external memory corresponds to two logical addresses, but it is still just one memory and cannot be used as two memories.
The purpose of the second program is to store data 31H into the physical unit 00 of the second external data storage device, and then use the two logical addresses corresponding to the physical unit to fetch data from the unit respectively. The effect is the same, which means that when accessing a physical unit, any logical address corresponding to the unit can be used.
The purpose of the third program is to write a number 12H to the prohibited unit 0000H. As a result, the data in the valid logical addresses 8000H and 2000H are overwritten, so that the next time the program retrieves data from 8000H and 2000H, the data obtained is 12H instead of the correct data originally stored in the two units.
The following is the running process of the first program:
The first instruction sets the contents of accumulator A to 31H.
The second instruction sets the content of DPTR to 8000H.
The third instruction stores the content of accumulator A, 31H, into the external data memory, 8000H.
(Note: From now on, addresses without explanation refer to the logical addresses of the CPU)
The result is that 31H is stored in physical unit 00 of the first memory.
The fourth instruction is to send data 11H into accumulator A.
The fifth instruction is to send 0C000H into DPRT
The sixth instruction is to store the content 11H in accumulator A in external data memory 0C000H.
In essence, it is stored in the physical unit 00 of the first memory, overwriting the data 31H stored in the physical unit last time. From the running of this program, we can see that it is wrong to try to use the two logical addresses of a physical storage unit as two memories.
Let's look at the second program running:
The first instruction sends data 31H to accumulator A.
The second instruction sends 2000H to DPTR
The third instruction stores the data 31H in the accumulator into the 2000H unit of the external data memory, which is actually stored into the physical unit 00 of the second memory.
The fourth instruction fetches the data in the external data memory unit 2000H into the accumulator. In essence, it fetches the data in the physical unit 00 of the second data memory back to the accumulator.
The fifth instruction is to send data 6000H into DPTR
The sixth instruction retrieves the data in the external data memory 6000H unit back to the accumulator
It can be seen that the essence is also to fetch data from the physical unit 00 of the second memory. The result is of course the same as the last time the data was fetched from the 2000H unit. It can be seen that when the memory is accessed using different logical addresses of the same physical unit, the effect is the same.
Let's look at the running process of the third program:
The first instruction sends data 000H to DPTR
The second instruction sends data 12H into accumulator A.
The third instruction stores the data 12H in the accumulator into the external data memory unit 0000H.
Since the CPU sends the address 0000H, P2.5 and P2.7 are both 0, so that the chip select signals of the two memories are valid, and the address lines A0-A12 of the two memories are low . Therefore, after the CPU sends the write signal, the result is of course the same as the last time the number was taken from the 2000H unit.
It can be seen that when different logical addresses of the same physical unit are used to access the memory, the effect is the same. The valid logical addresses of the physical unit 00 of the second memory are 2000H and 6000H. It can be seen that this write instruction to the prohibited address 0000H destroys the original content of the above-mentioned valid logical address, so we must not use prohibited addresses and invalid addresses in the program.
Previous article:How to expand interface chips
Next article:Design and production of the minimum system of single chip microcomputer
- 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
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- 28335 floating point performance test
- What's your Chinese character of the year?
- [NXP Rapid IoT Review] + Rapid IoT Studio WEB/GUI programming tool learning and use
- [NXP Rapid IoT Review] + Unable to add devices again (Summary of the third week review)
- About atmel studio 7 to generate .lib library files
- Basic knowledge of power supply that you must know
- AD PCB cannot be saved, showing file save failed
- How to modify the AT32F4xx SRAM space size
- About software testing of commercial appliances
- EEWORLD University ---- Operating System Harbin Institute of Technology