STC8G series storage structure RAM FLASH EEPROM

Publisher:WhisperingSongLatest update time:2024-07-29 Source: cnblogs Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

7 Memory

1. Data storage - RAM


Internal RAM [Take STC8A8K as an example: the lower 128 bytes are directly accessed as CODE, and the upper 128 bytes are indirectly accessed as ICODE]

Internal extended RAM [Take STC8A8K as an example: including 8192 bytes of internal XCODE]

External expansion RAM [External XCODE can be expanded to a maximum of 64KB]

2. Program storage - ROM 3. EEPROM


RAM is used to store the intermediate results and process data of program execution (the data disappears after power failure). If code stc8a8k is not added when defining a variable, it is stored in RAM by default.


Internal RAM

A total of 256 bytes, divided into 2 parts:

The lower 128 bytes of RAM [0x00H-0x7FH], of which 0x00H-0x1FH, a total of 32 bytes, are 4 register groups, which are selected by PSW RS0 RS1. 20H-2FH, a total of 16 bytes, can be directly bit-addressed. [No AND or operation]

High 128 bytes RAM [0x80H-0xFFH].

Remark:

rs0 (1 bit) rs1 (1 bit) are each one bit in PSW (8 bits), PSW is the special function register of 51 microcontroller [20220619: sfr PSW = 0xd0; //Program status word register (0xd0=208)].

(1) Cy (PSW.7) PSW.7 is Cy, which is derived from the hardware and software changes when the most recent arithmetic or logical instruction was executed.

(2) Ac (PSW.6) Auxiliary carry flag, used for decimal adjustment operation of BCD code. Ac is set to 1 when the lower four bits carry to the upper four bits, otherwise it is cleared to 0. This bit can also be used in combination with the DA instruction.

(3) F0 (PSW.5) is the status flag used by the user. You can use it as you wish.

(4) RS1, RS0 (PSW.4, PSW.3): 4 groups of working register area selection control bits 1 and 0.

(5) OV (PSW.2) The overflow flag indicates whether an operation overflows when executing an arithmetic instruction.

(6) PSW.1 bit: reserved bit, not used.

(7) P (PSW.0) parity flag.

For example, RS1=1 is equivalent to PSW |=0x10; RS0=0 is equivalent to PSW &=0xf7;

Internal expansion RAM

STC8 integrates internal extended RAM. Whether the internal extended RAM of the microcontroller can be accessed is controlled by the EXTRAM bit in the auxiliary register AUXR.

The program memory and data memory of the STC8G series microcontroller are independently addressed.

The bus of the microcontroller, all program memory of the microcontroller is on-chip Flash memory, and external program memory cannot be accessed.

The STC8G series MCU has a large-capacity data memory integrated inside.

The internal RAM is logically divided into two address spaces: internal RAM (256 bytes) and internal extended RAM. The upper 128 bytes of the internal RAM are

The data memory and special function registers (SFRs) have overlapping addresses, but they are distinguished by different addressing modes when actually used.

7.1 Program Memory

The program memory is used to store user programs, data, tables and other information.

After the microcontroller is reset, the content of the program counter (PC) is 0000H, and the program starts executing from unit 0000H. In addition, the entry of the interrupt service program

The interrupt vector address (also called interrupt vector) is also located in the program memory unit. In the program memory, each interrupt has a fixed entry address.

After an interrupt occurs and is responded to, the microcontroller will automatically jump to the corresponding interrupt entry address to execute the program.

The entry address of the program is 0003H, the entry address of the timer/counter 0 (TIMER0) interrupt service program is 000BH, and the external interrupt 1 (INT1)

The entry address of the interrupt service routine of the timer/counter 1 (TIMER1) is 0013H, the entry address of the interrupt service routine of the timer/counter 1 (TIMER1) is 001BH, and so on.

For more interrupt service routine entry addresses (interrupt vectors), please refer to the interrupt introduction chapter.


Reference address:STC8G series storage structure RAM FLASH EEPROM

Previous article:STC8G series storage structure 2
Next article:STC8G series microcontroller specifications -- internally integrated enhanced dual data pointer

Recommended ReadingLatest update time:2024-11-16 09:24

Simple learning of reading and writing FLASH inside STM32G031G8U6 microcontroller
This article limits the research scope to the access rules of the FLASH area. The following conclusions are obtained from actual measurements: 1. Read 1. Single-byte read routine, single-byte read can start from any address uint8_t STMFLASH_ReadByte(uint32_t faddr) {
[Microcontroller]
Chapter 6: Tiny4412 U-BOOT transplantation six Nand Flash source code analysis
1. U-Boot reference source code  The initialization code of NandFlash is placed in board/samsung/tiny4412/lowlevel_init.S. This code is not provided in Samsung SMDK4212, so we need to write it ourselves. We add a function called nand_asm_init. Of course, since the operation of Nand Flash has certain rules, we can find
[Microcontroller]
Chapter 6: Tiny4412 U-BOOT transplantation six Nand Flash source code analysis
S3C2440 bare metal ------Nor Flash programming_identification
1. Write a menu program First, we write a test menu program to obtain norFlash information and read and write NorFlash. The code is as follows: void nor_flash_test(void) { char c;   while (1) { /* Print menu for us to choose test content*/ printf(" Scan nor flashnr"); printf(" Erase nor flashnr"); prin
[Microcontroller]
S3C2440 bare metal ------Nor Flash programming_identification
Samsung's 14nm EUV DDR5 memory is now in mass production
When we talk about computer performance, the first thing that comes to mind is the CPU. A higher-performance processor can achieve faster computing speeds. At the same time, high-performance memory is also essential. Recently, Samsung announced that it has begun mass production of 14nm DRAM based on extreme ultraviole
[Home Electronics]
Samsung's 14nm EUV DDR5 memory is now in mass production
Samsung announces first computer with MRAM non-volatile magnetoresistive memory: can be used for AI computing
According to foreign media techpowerup, Samsung Electronics today officially announced the world's first computer equipped with MRAM memory. The relevant paper was published on the Nature website and will be published in a magazine soon. The title of the paper is "Cross-array of magnetoresistive memory devices for in-
[Home Electronics]
Samsung announces first computer with MRAM non-volatile magnetoresistive memory: can be used for AI computing
Application of NOR_FLASH in MCU Development
 In MCU development, NOR_FLASH is commonly used in sizes of 4M and 8M: 4M FLASH can be represented in the program as follows: Ptr 0x220000 8M FLASH can be represented in the program as follows: Ptr 0x400000 (the maximum read value is 0x3fffff) With this relationship, we can use the method of calculating the ch
[Microcontroller]
Application of NOR_FLASH in MCU Development
What is the role of RAM in a microcontroller?
A single-chip microcomputer is a small computer. Although a flea is small, it has all the organs and can even jump very high! Naturally, a data storage system is indispensable for a large computer, and a small single-chip microcomputer also has it, and it is often integrated with the CPU, making it more compact and fl
[Microcontroller]
What is the role of RAM in a microcontroller?
STM32 program transplantation_internal flash boot times management lib library establishment
1. Test environment: STM32C8T6 2. Test interface: 3. The serial port uses serial port 1, baud rate 9600 MCU pins------------CH340 pins VCC--------------------VCC GND-------------------GND PA9--------------------RXD   PA10-------------------TXD 1. Following 011, the following lib can be transplanted 2. The program and
[Microcontroller]
STM32 program transplantation_internal flash boot times management lib library establishment
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号