Obsolete
Product(s)
- Obsolete
Product(s)
Architecture overview
UPSD3254A, UPSD3254BV, UPSD3253B, UPSD3253BV
Note:
In UPSD325xx devices, the stack resides in on-chip RAM, and grows upwards. The PUSH
instruction first increments the Stack Pointer (SP), then copies the byte into the stack. PUSH
and POP use only direct addressing to identify the byte being saved or restored, but the
stack itself is accessed by indirect addressing using the SP register. This means the stack
can go into the Upper 128 bytes of RAM, if they are implemented, but not into SFR space.
The Data Transfer instructions include a 16-bit MOV that can be used to initialize the Data
Pointer (DPTR) for look-up tables in Program Memory.
The XCH A, <byte> instruction causes the Accumulator and ad-dressed byte to exchange
data. The XCHD A, @Ri instruction is similar, but only the low nibbles are involved in the
exchange. To see how XCH and XCHD can be used to facilitate data manipulations,
consider first the problem of shifting and 8-digit BCD number two digits to the right.
Table 8shows how this can be done using XCH instructions. To aid in understanding how the code
works, the contents of the registers that are holding the BCD number and the content of the
Accumulator are shown alongside each instruction to indicate their status after the
instruction has been executed.
After the routine has been executed, the Accumulator contains the two digits that were
shifted out on the right. Doing the routine with direct MOVs uses 14 code bytes. The same
operation with XCHs uses only 9 bytes and executes almost twice as fast. To right-shift by
an odd number of digits, a one-digit must be executed.
Table 9 shows a sample of code that
will right-shift a BCD number one digit, using the XCHD instruction. Again, the contents of
the registers holding the number and of the accumulator are shown alongside each
instruction.
First, pointers R1 and R0 are set up to point to the two bytes containing the last four BCD
digits. Then a loop is executed which leaves the last byte, location 2EH, holding the last two
digits of the shifted number. The pointers are decremented, and the loop is repeated for
location 2DH. The CJNE instruction (Compare and Jump if Not equal) is a loop control that
will be described later. The loop executed from LOOP to CJNE for R1 = 2EH, 2DH, 2CH,
and 2BH. At that point the digit that was originally shifted out on the right has propagated to
location 2AH. Since that location should be left with 0s, the lost digit is moved to the
Accumulator.
Table 6.
Data transfer instructions that access internal data memory space
Mnemonic
Operation
Addressing modes
Dir.
Ind.
Reg.
Imm.
MOV A,<src>
A = <src>
XXXX
MOV <dest>,A
<dest> = A
X
MOV <dest>,<src>
<dest> = <src>
XXXX
MOV DPTR,#data16
DPTR = 16-bit immediate
constant
X
PUSH <src>
INC SP; MOV “@SP”,<src>
X
POP <dest>
MOV <dest>,”@SP”; DEC SP
X
XCH A,<byte>
Exchange contents of A and
<byte>
XXX
XCHD A,@Ri
Exchange low nibbles of A and
@Ri
X