Instruction Set
Program Status Word (PSW)
-contains several status bits that
reflects the current state of the CPU
*Carry bit
- carry bit in arithmetic
operations serves as the “Accumulator” for a number of Boolean
operations
*Auxiliary Carry (for BCD
operations)
*2 Register Bank - selects bits
*Overflow flag
*2 user-definable status flags
*Parity bit – 1 if odd, 0 if even
Addressing Modes
*Direct Addressing
-operand is specified by an 8-bit
address field in the instruction
-128 lowest bytes of internal Data
RAM and SFRs can be directly addressed
*Indirect Addressing
-specific a register which contains
the address of the operand
-Both internal and external RAM can
be directly addressed
*Register Instructions
-Register banks R0 through R7, can
be accessed by certain instructions which carry a 3-bit register
specification within the opcode of the instruction. Instructions that
access the registers this way are code efficient.
*Register-specific Instructions
-The opcode does itself.
Instructions that refer to the accumulator as “A” assemble us
accumulator-specific opcode.
*Immediate Constants
-The value of a constant can follow
the opcode in Program Memory.
Ex. MOV A, #100
-Can also be specified as 64 in the
digits.
*Indexed Addressing
-Only Program Memory can be
accessed with indexed addressing, and it can only be read.
-Reading look-up tables in Program
Memory.
Arithmetic Instruction
ADD 7F # (direct addressing)
ADD A, @ R0
(indirect addressing)
ADD A, R 7
(register addressing)
ADD, # 127
(immediate constant)
Logical Instructions
The instructions that perform
Boolean operations (AND, OR, Exclusive OR, NOT) on bytes perform the
operation on a bit-by-bit basis.
Data Transfers
*Internal Ram
-moving data around within the
internal memory spaces, and the addressing modes that can be used
with each one.
*External RAM
-Instructions that access external
Data Memory. Only indirect addressing can be used.
Lookup Tables
-Instructions access only Program
Memory, the lookup tables can be read, not updated.
Boolean Instructions
-Instructions that access these
bits are not just conditional branches, but a complete menu of move,
set, clear, compliment, OR and AND instructions.
*Relative Offset
Jump Instructions
-Conditional Jumps –Unconditional
Jumps
Reference:
ATMEL 8051 Microcontrollers Hardware Manual. Atmel Corporation 2005.