DEC byte decrements the variable indicated by 1. An original value of 00H underflow to 0FFH. No flags are affected. Four operand addressing modes are allowed: accumulator, 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.
DEC A
Encoding: 0 0 0 1 0 1 0 0
DEC Rn
Encoding: 0 0 0 1 1 n n n
DEC direct address
Encoding: 0 0 0 1 0 1 0 1 direct address
DEC @Ri
Encoding: 0 0 0 1 0 1 1 i
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.
DEC A
Encoding: 0 0 0 1 0 1 0 0
DEC Rn
Encoding: 0 0 0 1 1 n n n
DEC direct address
Encoding: 0 0 0 1 0 1 0 1 direct address
DEC @Ri
Encoding: 0 0 0 1 0 1 1 i
ORG 0H
START :
MOV A, #10
DEC A ; A = 10 - 1 = 9
MOV R0, A
DEC R0 ; R0 = 9 - 1 = 8
MOV 34h, R0
DEC 34h ; ram location 34h = 8 - 1 = 7
MOV R0, #34h
DEC @R0 ; ram location 34h = 7 - 1 = 6
END ; end of asm source file
Related topics:
8051 Increment Byte and DPTR | 8051 Logical AND for Byte and Bit | 8051 Logical OR for Byte and Bit | 8051 Logical XOR for Byte | 8051 Addition
List of topics: 8051
No comments:
Post a Comment