in~.
MCS”-51 PROGRAMMER’SGUIDEAND INSTRUCTION SET
DEC byte
Function: Decrement
Description:
The
variableindicatedis decrementedby 1.An originalvalueofOOHwillunderilowto OFFH.
No flags are affected. Four operandaddressingmodes are allowed:accumulator,register,
&r@ or register-indirect.
Note: When this instruction is usedto modifyan output port, the value usedas the original
port data willbe read from the outputdata latch, not the input pins.
Exampte:
Register Ocontains7FH (0111111IB). Internal RAM locations7EH and 7FH contain OOH
and 40H, respectively.The instructionsequence
DEC @RO
DEC RO
DEC @RO
willleaveregisterOset to 7EH and internalRAM locations7EHand 7FH set to OFFHand
3FI-I.
DEC A
Bytes: 1
Cyclx 1
Encoding: 0001 0100
Operation:
DEC
(A) - (A) – 1
DEC Rn
Bytes: 1
cycles: 1
Encoding: 0001
lrrr
Operation:
DEC
(Rn) + @l) – 1
241