Hardware manual

The 8051 Instruction Set
1-10 Atmel 8051 Microcontrollers Hardware Manual
4316A–8051–01/04
MOV A, ENTRY_NUMBER
CALLTABLE
The subroutine “TABLE” would look like this:
TABLE:MOVC A, @A + PC
RET
The table itself immediately follows the RET (return) instruction in Program Memory.
This type of table can have up to 255 entries, numbered 1 through 255. Number 0 can-
not be used, because at the time the MOVC instruction is executed, the PC contains the
address of the RET instruction. An entry numbered 0 would be the RET opcode itself.
1.8 Boolean
Instructions
8051 devices contain a complete Boolean (single-bit) processor. The internal RAM con-
tains 128 addressable bits, and the SFR space can support up to 128 other addressable
bits. All of the port lines are bit-addressable, and each one can be treated as a separate
single-bit port. The instructions that access these bits are not just conditional branches,
but a complete menu of move, set, clear, complement, OR and AND instructions. These
kinds of bit operations are not easily obtained in other architectures with any amount of
byte-oriented software.
The instruction set for the Boolean processor is shown in Table 1-9. All bit accesses are
by direct addressing. Bit addresses 00H through 7FH are in the Lower 128, and bit
addresses 80H through FFH are in SFR space.
Note how easily an internal flag can be moved to a port pin:
MOV C, FLAG
MOV P1.0, C
Table 1-8. Lookup Table Read Instructions
Mnemonic Operation
Execution Time
@ 12MHz (µs)
MOVC A, @A + DPTR Read Pgm Memory at (A + DPTR) 2
MOVC A, @A + PC Read Pgm Memory at (A + PC) 2
Table 1-9. 8051 Boolean Instructions
Mnemonic Operation
Execution Time
@ 12MHz (µs)
ANL C,bit
ANL C,/bit
ORL C,bit
ORL C,/bit
MOV C,bit
MOV bit,C
CLR C
CLR bit
SETB C
SETB bit
CPL C
CPL bit
JC rel
JNC rel
JB bit,rel
JNB bit,rel
JBC bit,rel
C = C AND bit
C = C AND (NOT bit)
C = C OR bit
C = C OR (NOT bit)
C = bit
bit = C
C = 0
bit = 0
C = 1
bit = 1
C = NOT C
bit = NOT bit
Jump if C = 1
Jump if C = 0
Jump if bit = 1
Jump if bit = 0
Jump if bit = 1 ; CLR bit
2
2
2
2
1
2
1
1
1
1
1
1
2
2
2
2
2