Which register bank shares space with the stack
The register used to access the stack is called the SP stack pointer register. The stack pointer is 8 bits wide and it can take values of 00 to FFH. When the is powered up, the SP register contains value This means that RAM location 08 is the first location used for the stack by the Locations 08 to IF can be used for the stack, in this case the upper limit of stack is 1FH. In other words, register bank 1 and the stack are using the same memory space. The register used to access the stack is called stack pointer register.
The stack pointer is a small register used to point at the stack. When we push something into the stack memory, the stack pointer increases. When an microcontroller power up, the stack pointer contained value is 07, by default, as shown in the above figure.
To avoid this problem, before starting the program, we have to assign a different address location to the stack pointer. If we perform any operation whether addition or subtraction, then these operations are unable to be performed directly in the memory, and therefore, are performed by using the registers. There are different types of registers in microcontroller.
These registers are classified into two types based on their operations:. As we discussed earlier in this article that there are four different bank registers with each bank having 8 addressable 8-bit registers, and only one bank register can be accessed at a time.
These registers can be implemented by bit address and byte address registers. The auxiliary special function registers are not directly connected to the — but, in fact, without these registers — the cannot operate properly. The register set of is explained below. Setting a fixed constant value in the register is called a register set. These 80 locations RAM are widely used for the purpose of storing data and parameters by programmers.
A total of 32 bytes of RAM are set aside for the register banks and the stack. These 32 bytes are divided into four register banks in which each bank has 8 registers, R0—R7. The third bank of R0—R7 starts at memory location 10H and goes to location to 17H. If RAM locations 00—1F are set aside for the four registers banks, which register bank of R0—R7 do we have access to when the is powered up?
The answer is register bank 0; that is, RAM locations from 0 to 7 are accessed with the names R0 to R7 when programming the Because it is much easier to refer these RAM locations by names such as R0 to R7, rather than by their memory locations. Register bank 0 is the default when the is powered up. We can switch to the other banks using PSW register.
0コメント