8051 Architectural Specification and Functional Description
The Data Transfer, Arithmetic and Logic groups men- tioned in the preceding list are further subdivided into an . array of codes that specify whether the operation is to act upon immediate, RB register, accumulator, SFR or memory locations; whether bits, nibbles, bytes or double- bytes are to be processed; and what addressing methods are to be employed.
DATA TRANSFER
. Data transfer operations are divided into three classes:
•General Purpose
•
•
None affect the flag settings except a POP or MOV into
the PSW.
~~~:·~~·.;·1'··: ...
General Purpose Transfers. Three general purpose data transfer operations are provided. These may be applied to most operands, though there are specific exceptions.
MOV performs a bit or a byte transfer from the source operand to the destination operand. PUSH increments the SP register and then trans- fers a byte from the source operand to the stack element currently addressed by SP.
POP transfers a byte operand from the stack element addressed by the SP register to the destination operand and then decrements SP.
XCH exchanges the byte source operand with register A (accumulator).
XCHD exchanges the
MOVX performs a byte move between the External Data Memory and the A register. The external address can be specified by the DPTR register
MOVC performs the move of a byte from the Program Memory to register A as follows. The operand in the A register is used as an index into a
MOV DPTR,#data loads
LOGIC
The 8051 performs the basic logic operations on both bit and byte operands.
19
CLR is used to set eitber the A register, the C register, or any Direct Addressed bit to zero (0). SETB sets either the C register or any Direct Addressed bit to one (1).
CPL either forms the one's complement of the operand in the A register and returns the result to the A register without affecting flags or forms the one's complement of the C register or any Direct Addressed bit.
RL, RLC, RR, RRC, SWAP. Five rotate opera- tions can be performed on the A register; RL (rotate left), RR (rotate right), RLC (rotate left through C), RRC (rotate right through C) and SWAP (rotate left four). For RLC and RRC the C flag becomes equal to the last bit rotated out. SWAP rotates the A register left four places to exchange bits 3 through 0 with bits 7 through 4.
ANL performs the bitwise logical conjunction of two source operands (for both bit and byte oper- ands) and returns the result to the location of the first operand.
ORL performs the bitwise logical inclusive dis- junction of two source operands (for both bit and byte operands) and returns the result to the loca- tion of the first operand.
XRL performs the bitwise logical exclusive disjunc- tion of the two source oPerands (byte operands) and returns the result to the location of the first operand.
ARITHMETIC
The 8051 provides the four basic mathematical operations. Only
Flag Register Settings. Three
Summary" in Table | . |
|