B Register
As mentioned previously, there are four sets of R registers: register bank 0, 1, 2, and 3. When the MSC1210 is first powered up, register bank 0 (addresses 00H through 07H) is used by default. In this case, for example, R4 is the same as internal RAM address 04H. However, yours program may instruct the MSC1210 to use one of the alternate register banks (i.e., register banks 1, 2, or 3). In this case, R4 will no longer be the same as internal RAM address 04H. For example, if your program instructs the MSC1210 to use register bank 1, register R4 will now be synonymous with internal RAM address 0CH. If select- ing register bank 2, R4 is synonymous with 14H, and if selecting register bank 3, it is synonymous with address 1CH.
The concept of register banks adds a great level of flexibility to the MSC1210, es- pecially when dealing with interrupts (see Chapter 10, Interrupts, for details). However, always remember that the register banks really reside in the first 32 by- tes of internal RAM.
4.4 B Register
The B register is very similar to the accumulator in the sense that it may hold an
The B register is only used by two MSC1210 instructions: MUL AB and DIV AB. Therefore, to quickly and easily multiply or divide A by another number, the oth- er number may be stored in B.
Aside from the MUL and DIV instructions, the B register is often used as anoth- er temporary storage register much like a 9th R register.
4.5 Program Counter (PC)
The program counter (PC) is a
The PC is special in that there is no way to directly modify its value. That is to say, something like PC = 2430H cannot be done. On the other hand, by execut- ing LJMP 2430H, the same thing is effectively accomplished.
It is also interesting to note that although the value of the PC may be changed (by executing a jump instruction, etc.), there is no way to read the value of the PC. That is to say, there is no way to ask the 8052 “what address are you about to execute?”
Basic Registers | |
|