Boolean Variable Manipulation Operations
- A, Acc: Accumulator
- B: B special function register
- C: Carry flag in PSW
- Rn: Register R7-R0 of the currently selected Register Bank.
- dir: 8-bit internal data location’s address. This could be an Internal Data RAM location (0-127) or a SFR [i.e., I/O port, control register, status register, etc. (128-255)]. Direct Addressing Mode.
- @Ri : 8-bit internal data RAM location (0-255) addressed indirectly through register R1or R0. Indirect Addressing Mode.
- #data: 8-bit constant included in instruction. Immediate Addressing Mode.
- #data 16: 16-bit constant included in instruction. Immediate Addressing Mode.
- addr 16: 16-bit destination address. Used by LCALL and LJMP. A branch can be anywhere within the 64K byte Program Memory address space. Long Addressing Mode.
- addr 11: 11-bit destination address. Used by ACALL and AJMP. The branch will be within the same 2K byte page of program memory as the first byte of the following instruction. Absolute Addressing Mode.
- rel: Signed (two’s complement) 8-bit offset byte. Used by SJMP and all conditional jumps. Range is -128 to +127 bytes relative to first byte of the following instruction. Relative Addressing Mode.
- bit: Direct Addressed bit in Internal Data RAM or Special Function Register 1B: 1 byte
2B: 2 byte
3B: 3 byte
1C: 1 cycle
2C: 2 cycles
4C: 4 cycles
P: oscillator Period
Mnemonic | Description | |
---|---|---|
CLR | C | Clear Carry [1B,1C,12P] |
CLR | bit | Clear direct bit [2B,1C,12P] |
SETB | C | Set Carry [1B,1C,12P] |
SETB | bit | Set direct bit [2B,1C,12P] |
CPL | C | Complement Carry [1B,1C,12P] |
CPL | bit | Complement direct bit [2B,1C,12P] |
ANL | C,bit | AND direct bit to CARRY [2B,2C,24P] |
ANL | C,/bit | AND complement of direct bit to Carry [2B,2C,24P] |
ORL | C,bit | OR direct bit to Carry [2B,2C,24P] |
ORL | C,/bit | OR complement of direct bit to Carry [2B,2C,24P] |
MOV | C,bit | Move direct bit to Carry [2B,1C,12P] |
MOV | bit,C | Move Carry to direct bit [2B,2C,24P] |
JC | rel | Jump if Carry is set [2B,2C,24P] |
JNC | rel | Jump if Carry not set [2B,2C,24P] |
JB | bit,rel | Jump if direct Bit is set [3B,2C,24P] |
JNB | bit,rel | Jump if direct Bit is Not Set [3B,2C,24P] |
JBC | bit,rel | Jump if direct Bit is set & clear bit [3B,2C,24P] |
The following Boolean operations can operate on bit level data:
ANL Logical AND
ORL Logical OR
CPL Complement (logical NOT)
XRL Logical XOR (exclusive OR)
SETB 2Fh ; Bit 7 of Internal RAM location 25h is set
CLR C ; Clear the carry flag (flag =0)
CPL 20h ; Complement bit 0 of Internal RAM location 24h
MOV C, 87h ; Move to carry flag the bit 7of Port 0 (SFR at 80h)
ANL C,90h ; AND C with the bit 0 of Port 1 (SFR at 90)
ORL C, 91h ; OR C with the bit 1 of Port 1 (SFR at 90)
Related topics:
8051 Instruction Set Overview | 8051 Instruction Cycle | 8051 Machine Cycle | 8051 Instruction Set Summary | 8051 Arithmetic Operation Instructions | 8051 Logical Operation Instructions | 8051 Data Transfer Instructions | 8051 Program Branching Instructions | 8051 Instruction Opcode | 8051 Instructions that Affect Flag Settings | 8051 Instructions and Examples
List of topics: 8051
No comments:
Post a Comment