Texas Instruments MSC1210 User Manual

Page 53

Advertising
background image

B Register

4-3

Basic Registers

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
00

H

through 07

H

) is used by default. In this case, for example, R4 is the same

as internal RAM address 04

H

. 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 04

H

.

For example, if your program instructs the MSC1210 to use register bank 1,
register R4 will now be synonymous with internal RAM address 0C

H

. If select-

ing register bank 2, R4 is synonymous with 14

H

, and if selecting register bank

3, it is synonymous with address 1C

H

.

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 8-bit (1-byte) value.

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 2-byte address that tells the MSC1210 where
the next instruction to execute is found in memory. When the MSC1210 is ini-
tialized, the PC always starts at 0000

H

and is incremented each time an in-

struction is executed. It is important to note that the PC is not always increm-
ented by one. The PC will be incremented by two or three in these cases be-
cause some instructions require two or three bytes.

The PC is special in that there is no way to directly modify its value. That is to
say, something like PC = 2430

H

cannot be done. On the other hand, by execut-

ing LJMP 2430

H

, 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?”

Advertising