BOOLEAN INSTRUCTIONSCLR,CPL,SETB,AND,OR
BOOLEAN INSTRUCTIONSThis group of instructions is associated with the single-bit operations of the 8051.This group allows manipulating the individual bits of bit addressable registers and memory locations as well as the CY flag.The P, OV, and AC flags cannot be directly altered.This group includes:Set, clear, and, or complement, move.Conditional jumps.
CLR <bit>CLR CCLR instruction can operate on the carry flagCLR C The CARRY flag is set to 0CLR bitCLR instruction can operate on any directly addressable    bitCLR P2.7If Port 2 has been previously written with DCH (11011100),then the operation leaves the port set to 5CH (01011100)
SETB <bit>SETB CSETB instruction operates on the carry flag and sets the specified bit to 1SETB Csets the carry flag to 1 SETB bitSETB instruction operates on any   directly-addressable bit and sets the specified bit to 1SETB P2.0Port 2 has the value of 24H (00100100), the Port 2 value changes to 25H (00100101)
CPL <bit>CPL CThis operation complements the carry flagCPL CCPL bitCPL instruction complements any directly addressable BitCPL P2.2If Port 2 has the value of 53H (01010011) then after the execution the port set to 55H (01010101)
ANLANL C, <source-bit>This instruction ANDs the bit addressed with the carry bit and stores the result in the carry bit itselfANL C,P2.7 ;AND carry flag with bit 7 of P2ANL C, /<source-bit>If a slash (/) is used in the source operand bit, the logical complement of the source bit is used, but the source bit itself is not affectedANL C,/OV ;AND with inverse of OV flag
ORLORL C, <source-bit>This instruction ORs the bit addressed with the carry bit and stores the result in the carry bit itselfORL C,P2.5 ;OR carry flag with bit 5 of P2ORL C, /<source-bit>If a slash (/) is used in the source operand bit, the logical complement of the source bit is used, but the source bit itself is not affectedORL C,/OV ;OR with inverse of OV flag
MOV <dest-bit>,<source-bit>One of the operands must be the carry flag; the other may be any directly-addressable bitMOV C,P3.3MOV P2.0,CIf P2=C5H (11000101), P3.3=0 and CY=1 initially, after instructions,   	P2=C4H (11000100) and CY=0
JC / JNC addrJump to a relative address if CY is set / cleared.
JB / JNB <bit>,addrJump to a relative address if a bit is set / cleared.
JBC <bit>,addrJump to a relative address if a bit is set and clear the bit. JBC P1.3,ARRAY1If P1=56H (01010110), the above instruction sequence will cause the program to branch to the instruction at ARRAY1, modifying P1 to 52H (01010010)

boolean 8051

  • 2.
  • 3.
    BOOLEAN INSTRUCTIONSThis groupof instructions is associated with the single-bit operations of the 8051.This group allows manipulating the individual bits of bit addressable registers and memory locations as well as the CY flag.The P, OV, and AC flags cannot be directly altered.This group includes:Set, clear, and, or complement, move.Conditional jumps.
  • 4.
    CLR <bit>CLR CCLRinstruction can operate on the carry flagCLR C The CARRY flag is set to 0CLR bitCLR instruction can operate on any directly addressable bitCLR P2.7If Port 2 has been previously written with DCH (11011100),then the operation leaves the port set to 5CH (01011100)
  • 5.
    SETB <bit>SETB CSETBinstruction operates on the carry flag and sets the specified bit to 1SETB Csets the carry flag to 1 SETB bitSETB instruction operates on any directly-addressable bit and sets the specified bit to 1SETB P2.0Port 2 has the value of 24H (00100100), the Port 2 value changes to 25H (00100101)
  • 6.
    CPL <bit>CPL CThisoperation complements the carry flagCPL CCPL bitCPL instruction complements any directly addressable BitCPL P2.2If Port 2 has the value of 53H (01010011) then after the execution the port set to 55H (01010101)
  • 7.
    ANLANL C, <source-bit>Thisinstruction ANDs the bit addressed with the carry bit and stores the result in the carry bit itselfANL C,P2.7 ;AND carry flag with bit 7 of P2ANL C, /<source-bit>If a slash (/) is used in the source operand bit, the logical complement of the source bit is used, but the source bit itself is not affectedANL C,/OV ;AND with inverse of OV flag
  • 8.
    ORLORL C, <source-bit>Thisinstruction ORs the bit addressed with the carry bit and stores the result in the carry bit itselfORL C,P2.5 ;OR carry flag with bit 5 of P2ORL C, /<source-bit>If a slash (/) is used in the source operand bit, the logical complement of the source bit is used, but the source bit itself is not affectedORL C,/OV ;OR with inverse of OV flag
  • 9.
    MOV <dest-bit>,<source-bit>One ofthe operands must be the carry flag; the other may be any directly-addressable bitMOV C,P3.3MOV P2.0,CIf P2=C5H (11000101), P3.3=0 and CY=1 initially, after instructions, P2=C4H (11000100) and CY=0
  • 10.
    JC / JNCaddrJump to a relative address if CY is set / cleared.
  • 11.
    JB / JNB<bit>,addrJump to a relative address if a bit is set / cleared.
  • 12.
    JBC <bit>,addrJump toa relative address if a bit is set and clear the bit. JBC P1.3,ARRAY1If P1=56H (01010110), the above instruction sequence will cause the program to branch to the instruction at ARRAY1, modifying P1 to 52H (01010010)