The 8051 Instruction Set
Atmel 8051 Microcontrollers Hardware Manual 1-38
4316B–8051–02/04
1.14.16 INC<byte>
Function: Increment
Description: INC increments the indicated variable by 1. An original value of 0FFH overflows to 00H. No flags are affected.
Three addressing modes are allowed: register, direct, or register-indirect.
Note: When this instruction is used to modify an output port, the value used as the original port data will be read
from the output data latch, not the input pins.
Example: Register 0 contains 7EH (011111110B). Internal RAM locations 7EH and 7FH contain 0FFH and 40H,
respectively. The following instruction sequence,
INC @R0
INC R0
INC @R0
leaves register 0 set to 7FH and internal RAM locations 7EH and 7FH holding 00H and 41H, respectively.
INC A
Bytes: 1
Cycles: 1
Encoding: 00000100
Operation: INC
(A) ← (A) + 1
INC R
n
Bytes: 1
Cycles: 1
Encoding: 00001r r r
Operation: INC
(R
n
) ← (R
n
) + 1
INC direct
Bytes: 2
Cycles: 1
Encoding: 00000101 direct address
Operation: INC
(direct) ← (direct) + 1
INC @R
i
Bytes: 1
Cycles: 1
Encoding: 0000011 i
Operation: INC
((R
i
)) ← ((R
i
)) + 1