Question

I am looking for a good reference on the 8051 embedded processor family (specifically the 80C32) that will explain the internal memory map, and how it differs between processors in the family.

I'm currently reading how the stack pointer is initialized at reset to 07H. But I see in documentation (here, for instance) for all processors in this family that the internal RAM, starting at address 00H, maps R7 of Bank 0 for the internal registers in the location 07H.

What am I misunderstanding about how the internal registers and the stack are mapped?

enter image description here

Was it helpful?

Solution

The answer is given in the page you linked to:

Programming Tip: By default, the 8051 initializes the Stack Pointer (SP) to 07h when the microcontroller is booted. This means that the stack will start at address 08h and expand upwards. If you will be using the alternate register banks (banks 1, 2 or 3) you must initialize the stack pointer to an address above the highest register bank you will be using, otherwise the stack will overwrite your alternate register banks. Similarly, if you will be using bit variables it is usually a good idea to initialize the stack pointer to some value greater than 2Fh to guarantee that your bit variables are protected from the stack.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top