8051 Instruction Set Manual

ANL

The ANL instruction performs a bitwise logical AND operation between the specified byte or bit operands and stores the result in the destination operand.

Note

When this instruction is used to modify an output port, the value used as the port data will be read from the output data latch, not the input pins of the port.

See Also: ORL, XRL

ANL A, #immediate
CACF0RS1RS0OV P
Bytes2
Cycles1
Encoding
01010100immediate
Operation
ANL
A = A AND immediate
Example
ANL A, #3Fh
ANL A, @Ri
CACF0RS1RS0OV P
Bytes1
Cycles1
Encoding
0101011i
Operation
ANL
A = A AND (Ri)
Example
ANL A, @R0
ANL A, direct
CACF0RS1RS0OV P
Bytes2
Cycles1
Encoding
01010101direct
Operation
ANL
A = A AND (direct)
Example
ANL A, 40h
ANL A, Rn
CACF0RS1RS0OV P
Bytes1
Cycles1
Encoding
01011nnn
Operation
ANL
A = A AND Rn
Example
ANL A, R4
ANL C, /bit
CACF0RS1RS0OV P
Bytes2
Cycles2
Encoding
10110000bit
Operation
ANL
C = C AND NOT (bit)
Example
ANL C, /22h
ANL C, bit
CACF0RS1RS0OV P
Bytes2
Cycles2
Encoding
10000010bit
Operation
ANL
C = C AND (bit)
Example
ANL C, 22h
ANL direct, A
CACF0RS1RS0OV P
Bytes2
Cycles1
Encoding
01010010direct
Operation
ANL
(direct) = (direct) AND A
Example
ANL 40h, A
ANL direct, #immediate
CACF0RS1RS0OV P
Bytes3
Cycles2
Encoding
01010011directimmediate
Operation
ANL
(direct) = (direct) AND immediate
Example
ANL 30h, #77h