intelo
MCS@-51PROGRAMMER’SGUIDE AND INSTRUCTION SET
CPL A
Function:
Description:
Example:
Bytes:
Cycles:
Enooding:
Operation:
CPL bit
ComplementAccumulator
Eachbit ofthe Accumulatoris logicallycomplemented(one’scomplement).Bitswhichprevi-
ouslycontaineda oneare changedto a zero and vice-versa.No tlagsare affected.
The Accumulatorcontains5CH(O1O111CX3B).The instruction,
CPL A
willleavethe Accumulatorset to OA3H(101OOO11B).
1
1
1111
0100
CPL
(A) -1 (A)
Function:
Deeoription:
Example:
CPL C
Bytes:
Cycletx
Encoding:
Operation:
Complementbit
Thebit variablespecifiedis complemented.A bit whichhadbeena oneis changedto zeroand
vice-versa.No other flagsare affected.CLR can operateonthe carry or anydirectlyaddress-
ablebit.
Note:Whenthis instructionisusedto modifyan output pin,the valueusedas the originaldata
willbe read from the output data latch, not the input pin.
Port 1has previouslybeenwrittenwith 5BH(O1O1I1O1B).Theinstructionsequence,
CPL P1.1
CPL P1.2
willleavethe port set to 5BH(O1O11O11B).
1
1
I
1o11 0011
CPL
(c)+ 1 (c)
2-38