SlideShare a Scribd company logo
LOGICAL INSTRUCTIONS AND,OR,NOT,XOR,ROTATE,SWAP
Bitwise logic operations (AND, OR, XOR, NOT) Clear Rotate Swap Logic instructions do  NOT  affect the flags in PSW
Bitwise Logic ANL    AND  ORL    OR  XRL    XOR CPL    Complement   Examples: 00001111 10101100 ANL 00001111 10101100 ORL 00001111 10101100 XRL 10101100 CPL 00001100 10101111 10100011 01010011
anl  PSW, #0xE7 ;PSW AND 11100111 orl PSW, #0x18 ;PSW OR 00011000 xrl P1, #0x40 ;P1 XRL 01000000
Other Logic Instructions CLR  - clear RL  – rotate left RLC  – rotate left  through Carry RR  – rotate right RRC  – rotate right  through Carry SWAP – swap accumulator  nibbles
CLR (  Set all bits to 0 ) CLR A CLR byte (direct mode) CLR Ri (register mode) CLR @Ri  (register indirect mode)
Rotate Rotate instructions operate  only  on  a RL a Mov a,#0xF0 ; a   11110000 RR a ; a   11100001 RR a Mov a,#0xF0 ; a   11110000 RR a ; a   01111000
Rotate through Carry RRC a mov a, #0A9h ; a    A9 add a, #14h   ; a    BD (10111101), C  0 rrc a ; a     01011110, C  1 RLC a mov a, #3ch   ; a    3ch(00111100) setb c   ; c    1 rlc a ; a     01111001, C  1 C C
Swap SWAP a mov a, #72h   ; a    27h swap a ; a    27h
Rotate and Multiplication/Division Note that a shift left is the same as multiplying by 2, shift right is divide by 2 mov a, #3; A   00000011 (3) clr C ; C   0 rlc a ; A   00000110(6) rlc a ; A   0000110(12) rrc a ; A   00000110(6)

More Related Content

PPTX
Flip Flop | Counters & Registers | Computer Fundamental and Organization
PDF
PLC Programming Languages
PPT
Flipflops and Excitation tables of flipflops
PPTX
Interrupts in 8051
PPT
Chapter 16 timers and counters
PPT
microprocessors
PPTX
Counters
Flip Flop | Counters & Registers | Computer Fundamental and Organization
PLC Programming Languages
Flipflops and Excitation tables of flipflops
Interrupts in 8051
Chapter 16 timers and counters
microprocessors
Counters

What's hot (20)

PDF
telecom and SCADA latest.pdf
PPTX
Arithmetic and logical instructions
PPT
Addressing mode and instruction set using 8051
PDF
Algorithms
PPT
Adc interfacing
PPTX
flag register of 8086
PDF
T-states in microprocessor 8085
PPT
DATA REPRESENTATION
PDF
8051 Timers / Counters
PPTX
SHIFT REGISTERS
PPT
mano.ppt
PPTX
Optical encoder
PPTX
Timing and control unit
PDF
PLC Ladder Programming [Mechatronics]
PDF
Memory interfacing of microcontroller 8051
PPTX
Traffic light controller
PPT
12 Logic Microoperations.pptertryrtytrgrtgtrgtrgtrgtr
PPTX
PLC Architecture
PPTX
Jk flip flop
PPTX
JK flip flop in Digital electronics
telecom and SCADA latest.pdf
Arithmetic and logical instructions
Addressing mode and instruction set using 8051
Algorithms
Adc interfacing
flag register of 8086
T-states in microprocessor 8085
DATA REPRESENTATION
8051 Timers / Counters
SHIFT REGISTERS
mano.ppt
Optical encoder
Timing and control unit
PLC Ladder Programming [Mechatronics]
Memory interfacing of microcontroller 8051
Traffic light controller
12 Logic Microoperations.pptertryrtytrgrtgtrgtrgtrgtr
PLC Architecture
Jk flip flop
JK flip flop in Digital electronics
Ad

Similar to logical 8051 (20)

PPTX
Logical, Shift, and Rotate Instruction
PDF
Assembly language-lab9
PPTX
[ASM]Lab7
PDF
Assembly Language Programming By Ytha Yu, Charles Marut Chap 7 (Logic, Shift,...
PPT
Al2ed chapter9
PPTX
MPMC-3.pptxMicroprocessor and microcontroller programming
PPT
Logic, shift and rotate instruction
PPT
Logic, shift and rotate instruction
PPTX
Arithmetic instructions
PPTX
Arithmetic and logical instructions set
PPT
chapter 1 intrYour score increases as you pick a category, fill out a long de...
PDF
ARM programming basics for data typeswith examples
PDF
Instruction types
PDF
ARMbuilt-inshift_2a6f2cdd75038e8c46c6d481aac833ec.pdf
PDF
Unit 3 – assembly language programming
PPTX
8086inst logical
PPT
instruction-set-of-8086-mr-binu-joy3.ppt
DOCX
Microprocessors and microcontrollers
PPT
Shift rotate
Logical, Shift, and Rotate Instruction
Assembly language-lab9
[ASM]Lab7
Assembly Language Programming By Ytha Yu, Charles Marut Chap 7 (Logic, Shift,...
Al2ed chapter9
MPMC-3.pptxMicroprocessor and microcontroller programming
Logic, shift and rotate instruction
Logic, shift and rotate instruction
Arithmetic instructions
Arithmetic and logical instructions set
chapter 1 intrYour score increases as you pick a category, fill out a long de...
ARM programming basics for data typeswith examples
Instruction types
ARMbuilt-inshift_2a6f2cdd75038e8c46c6d481aac833ec.pdf
Unit 3 – assembly language programming
8086inst logical
instruction-set-of-8086-mr-binu-joy3.ppt
Microprocessors and microcontrollers
Shift rotate
Ad

More from VJ Aiswaryadevi (15)

PPTX
memory 8051
PPT
interrupts
PPT
branch ins 8051
PPTX
boolean 8051
PPT
arithmetic ins in 8051
PPT
8051 archi
PPT
8051 microprocessor
PPTX
8051 microprocessor
PPT
Groupware
PDF
302 B+Tree Ind Hash
PPT
storage media
PPT
memory 8051
interrupts
branch ins 8051
boolean 8051
arithmetic ins in 8051
8051 archi
8051 microprocessor
8051 microprocessor
Groupware
302 B+Tree Ind Hash
storage media

Recently uploaded (20)

PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
Approach and Philosophy of On baking technology
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Machine learning based COVID-19 study performance prediction
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
cuic standard and advanced reporting.pdf
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PDF
Review of recent advances in non-invasive hemoglobin estimation
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
The Rise and Fall of 3GPP – Time for a Sabbatical?
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Approach and Philosophy of On baking technology
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
The AUB Centre for AI in Media Proposal.docx
Reach Out and Touch Someone: Haptics and Empathic Computing
Machine learning based COVID-19 study performance prediction
NewMind AI Weekly Chronicles - August'25 Week I
20250228 LYD VKU AI Blended-Learning.pptx
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
cuic standard and advanced reporting.pdf
Per capita expenditure prediction using model stacking based on satellite ima...
Review of recent advances in non-invasive hemoglobin estimation
Digital-Transformation-Roadmap-for-Companies.pptx

logical 8051

  • 2. Bitwise logic operations (AND, OR, XOR, NOT) Clear Rotate Swap Logic instructions do NOT affect the flags in PSW
  • 3. Bitwise Logic ANL  AND ORL  OR XRL  XOR CPL  Complement Examples: 00001111 10101100 ANL 00001111 10101100 ORL 00001111 10101100 XRL 10101100 CPL 00001100 10101111 10100011 01010011
  • 4. anl PSW, #0xE7 ;PSW AND 11100111 orl PSW, #0x18 ;PSW OR 00011000 xrl P1, #0x40 ;P1 XRL 01000000
  • 5. Other Logic Instructions CLR - clear RL – rotate left RLC – rotate left through Carry RR – rotate right RRC – rotate right through Carry SWAP – swap accumulator nibbles
  • 6. CLR ( Set all bits to 0 ) CLR A CLR byte (direct mode) CLR Ri (register mode) CLR @Ri (register indirect mode)
  • 7. Rotate Rotate instructions operate only on a RL a Mov a,#0xF0 ; a  11110000 RR a ; a  11100001 RR a Mov a,#0xF0 ; a  11110000 RR a ; a  01111000
  • 8. Rotate through Carry RRC a mov a, #0A9h ; a  A9 add a, #14h ; a  BD (10111101), C  0 rrc a ; a  01011110, C  1 RLC a mov a, #3ch ; a  3ch(00111100) setb c ; c  1 rlc a ; a  01111001, C  1 C C
  • 9. Swap SWAP a mov a, #72h ; a  27h swap a ; a  27h
  • 10. Rotate and Multiplication/Division Note that a shift left is the same as multiplying by 2, shift right is divide by 2 mov a, #3; A  00000011 (3) clr C ; C  0 rlc a ; A  00000110(6) rlc a ; A  0000110(12) rrc a ; A  00000110(6)