SlideShare une entreprise Scribd logo
1  sur  9
Arithmetic instructions ADD,SUB,DIV,MUL,INC,DEC
ADD & SUB ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
ADD Example mov a, #3Fh add a, #D3h ,[object Object],0011 1111 1101 0011 0001 0010 C = 1 AC = 1 OV = 0
Subtract   Example : SUBB A, #0x4F   ;A    A – 4F – C Notice that   There is  no  subtraction WITHOUT borrow.  Therefore, if a subtraction without borrow is desired,  it is necessary to  clear the C  flag. Example : Clr  c SUBB A, #0x4F ;A    A – 4F SUBB A, byte subtract with borrow
Increment & Decrement ,[object Object],[object Object],INC A increment A INC byte increment byte in memory INC DPTR increment data pointer DEC A decrement accumulator DEC byte decrement byte
SIGNIFICANCE OF carry flag ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Multiply When multiplying two 8-bit numbers, the size of the maximum product is 16-bits FF x FF = FE01 (255 x 255 = 65025) MUL AB   ;   BA    A * B Note :  B  gets the  High  byte A  gets the  Low  byte
Division ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Decimal Adjust DA a   ; decimal adjust a Used to facilitate BCD addition.  Adds “6” to either high or low nibble after an addition  to create a valid BCD number. Example : mov a, #23h mov b, #29h add a, b; a    23h + 29h =  4Ch(wanted 52)   DA a  ; a    a + 6 = 52

Contenu connexe

Tendances

Memory organization of 8051
Memory organization of 8051Memory organization of 8051
Memory organization of 8051
Muthu Manickam
 

Tendances (20)

8051 microcontroller
8051 microcontroller 8051 microcontroller
8051 microcontroller
 
8086 Microprocessor
8086 Microprocessor8086 Microprocessor
8086 Microprocessor
 
DAC Interfacing with 8051.pdf
DAC Interfacing with 8051.pdfDAC Interfacing with 8051.pdf
DAC Interfacing with 8051.pdf
 
Pic 18 microcontroller
Pic 18 microcontrollerPic 18 microcontroller
Pic 18 microcontroller
 
DELD Unit IV ring and twisted ring counter
DELD Unit IV ring and twisted ring counterDELD Unit IV ring and twisted ring counter
DELD Unit IV ring and twisted ring counter
 
Assembly Language Programming
Assembly Language ProgrammingAssembly Language Programming
Assembly Language Programming
 
Assembler directives and basic steps ALP of 8086
Assembler directives and basic steps ALP of 8086Assembler directives and basic steps ALP of 8086
Assembler directives and basic steps ALP of 8086
 
8086 architecture
8086 architecture8086 architecture
8086 architecture
 
Interrupts in 8085
Interrupts in 8085Interrupts in 8085
Interrupts in 8085
 
Introduction to Counters
Introduction to CountersIntroduction to Counters
Introduction to Counters
 
Microcontroller 8051 and its interfacing
Microcontroller 8051 and its interfacingMicrocontroller 8051 and its interfacing
Microcontroller 8051 and its interfacing
 
Addressing Modes
Addressing ModesAddressing Modes
Addressing Modes
 
Memory organization of 8051
Memory organization of 8051Memory organization of 8051
Memory organization of 8051
 
Flip-Flop || Digital Electronics
Flip-Flop || Digital ElectronicsFlip-Flop || Digital Electronics
Flip-Flop || Digital Electronics
 
Unit 4-booth algorithm
Unit 4-booth algorithmUnit 4-booth algorithm
Unit 4-booth algorithm
 
Instruction pipeline: Computer Architecture
Instruction pipeline: Computer ArchitectureInstruction pipeline: Computer Architecture
Instruction pipeline: Computer Architecture
 
Switches and LEDs interface to the 8051 microcontroller
Switches and LEDs interface to the 8051 microcontrollerSwitches and LEDs interface to the 8051 microcontroller
Switches and LEDs interface to the 8051 microcontroller
 
Chapter 6 register
Chapter 6 registerChapter 6 register
Chapter 6 register
 
Addressing modes of 8051
Addressing modes of 8051Addressing modes of 8051
Addressing modes of 8051
 
Interrupts in pic
Interrupts in picInterrupts in pic
Interrupts in pic
 

En vedette

Arithmetic & logical operations in 8051
Arithmetic & logical operations in 8051Arithmetic & logical operations in 8051
Arithmetic & logical operations in 8051
Jay Patel
 
8051 Microcontroller Notes
8051 Microcontroller Notes8051 Microcontroller Notes
8051 Microcontroller Notes
Dr.YNM
 
Abelardo Alaan profile
Abelardo Alaan profileAbelardo Alaan profile
Abelardo Alaan profile
Abelardo Alaan
 
8051 micro controllers Instruction set
8051 micro controllers Instruction set 8051 micro controllers Instruction set
8051 micro controllers Instruction set
Nitin Ahire
 
Logic, shift and rotate instruction
Logic, shift and rotate instructionLogic, shift and rotate instruction
Logic, shift and rotate instruction
kashif Shafqat
 

En vedette (17)

Arithmetic & logical operations in 8051
Arithmetic & logical operations in 8051Arithmetic & logical operations in 8051
Arithmetic & logical operations in 8051
 
1.arithmetic & logical operations
1.arithmetic & logical operations1.arithmetic & logical operations
1.arithmetic & logical operations
 
Arithmetic instructions
Arithmetic instructionsArithmetic instructions
Arithmetic instructions
 
Arithmetic and logical instructions set
Arithmetic and logical instructions setArithmetic and logical instructions set
Arithmetic and logical instructions set
 
8051 Microcontroller Notes
8051 Microcontroller Notes8051 Microcontroller Notes
8051 Microcontroller Notes
 
8051 instruction set
8051 instruction set8051 instruction set
8051 instruction set
 
Addressing mode of 8051
Addressing mode of 8051Addressing mode of 8051
Addressing mode of 8051
 
Abelardo Alaan profile
Abelardo Alaan profileAbelardo Alaan profile
Abelardo Alaan profile
 
logic shift and rotate instruction
logic shift and rotate instructionlogic shift and rotate instruction
logic shift and rotate instruction
 
Shift rotate
Shift rotateShift rotate
Shift rotate
 
Software AND its Types & CASE toolS
Software  AND     its   Types   &    CASE toolSSoftware  AND     its   Types   &    CASE toolS
Software AND its Types & CASE toolS
 
Assembly Language -I
Assembly Language -IAssembly Language -I
Assembly Language -I
 
[ASM]Lab7
[ASM]Lab7[ASM]Lab7
[ASM]Lab7
 
8051 micro controllers Instruction set
8051 micro controllers Instruction set 8051 micro controllers Instruction set
8051 micro controllers Instruction set
 
Logic, shift and rotate instruction
Logic, shift and rotate instructionLogic, shift and rotate instruction
Logic, shift and rotate instruction
 
Question paper with solution the 8051 microcontroller based embedded systems...
Question paper with solution  the 8051 microcontroller based embedded systems...Question paper with solution  the 8051 microcontroller based embedded systems...
Question paper with solution the 8051 microcontroller based embedded systems...
 
8051 experiments1
8051 experiments18051 experiments1
8051 experiments1
 

Similaire à arithmetic ins in 8051

Ascii adjust & decimal adjust
Ascii adjust & decimal adjustAscii adjust & decimal adjust
Ascii adjust & decimal adjust
Tech_MX
 
Instruction 4.pptx
Instruction 4.pptxInstruction 4.pptx
Instruction 4.pptx
HebaEng
 

Similaire à arithmetic ins in 8051 (20)

Hemanth143
Hemanth143 Hemanth143
Hemanth143
 
Al2ed chapter11
Al2ed chapter11Al2ed chapter11
Al2ed chapter11
 
Class4
Class4Class4
Class4
 
6 arithmetic logic inst and prog
6 arithmetic logic inst and prog6 arithmetic logic inst and prog
6 arithmetic logic inst and prog
 
Module 2 (1).pptx
Module 2 (1).pptxModule 2 (1).pptx
Module 2 (1).pptx
 
Mod-2.pptx
Mod-2.pptxMod-2.pptx
Mod-2.pptx
 
Bcd and ascii arithmetic instructions
Bcd and ascii arithmetic instructionsBcd and ascii arithmetic instructions
Bcd and ascii arithmetic instructions
 
Ascii arithmetic instructions
Ascii arithmetic instructionsAscii arithmetic instructions
Ascii arithmetic instructions
 
Bcd arithmetic instructions
Bcd arithmetic instructionsBcd arithmetic instructions
Bcd arithmetic instructions
 
Chapter 07 Digital Alrithmetic and Arithmetic Circuits
Chapter 07 Digital Alrithmetic and Arithmetic CircuitsChapter 07 Digital Alrithmetic and Arithmetic Circuits
Chapter 07 Digital Alrithmetic and Arithmetic Circuits
 
Ascii adjust & decimal adjust
Ascii adjust & decimal adjustAscii adjust & decimal adjust
Ascii adjust & decimal adjust
 
FYBSC IT Digital Electronics Unit III Chapter II Arithmetic Circuits
FYBSC IT Digital Electronics Unit III Chapter II Arithmetic CircuitsFYBSC IT Digital Electronics Unit III Chapter II Arithmetic Circuits
FYBSC IT Digital Electronics Unit III Chapter II Arithmetic Circuits
 
Instruction set of 8086
Instruction set of 8086Instruction set of 8086
Instruction set of 8086
 
Digital Logic Design
Digital Logic Design Digital Logic Design
Digital Logic Design
 
Instruction 4.pptx
Instruction 4.pptxInstruction 4.pptx
Instruction 4.pptx
 
Arithmetic instrctions
Arithmetic instrctionsArithmetic instrctions
Arithmetic instrctions
 
Code Conversion in 8085 Microprocessor
Code Conversion in 8085 MicroprocessorCode Conversion in 8085 Microprocessor
Code Conversion in 8085 Microprocessor
 
8086 instructions
8086 instructions8086 instructions
8086 instructions
 
INTEL 8085 DATA FORMAT AND INSTRUCTIONS
INTEL 8085 DATA FORMAT AND INSTRUCTIONSINTEL 8085 DATA FORMAT AND INSTRUCTIONS
INTEL 8085 DATA FORMAT AND INSTRUCTIONS
 
Chapter 3 instruction set-of-8085
Chapter 3 instruction set-of-8085Chapter 3 instruction set-of-8085
Chapter 3 instruction set-of-8085
 

Plus de VJ Aiswaryadevi (15)

8051
80518051
8051
 
memory 8051
memory  8051memory  8051
memory 8051
 
logical 8051
logical 8051logical 8051
logical 8051
 
interrupts
interruptsinterrupts
interrupts
 
mup
mupmup
mup
 
branch ins 8051
branch ins 8051branch ins 8051
branch ins 8051
 
boolean 8051
boolean 8051boolean 8051
boolean 8051
 
8051 archi
8051 archi8051 archi
8051 archi
 
8051 microprocessor
8051 microprocessor8051 microprocessor
8051 microprocessor
 
8051 microprocessor
8051 microprocessor8051 microprocessor
8051 microprocessor
 
Groupware
GroupwareGroupware
Groupware
 
Db
DbDb
Db
 
302 B+Tree Ind Hash
302 B+Tree Ind Hash302 B+Tree Ind Hash
302 B+Tree Ind Hash
 
storage media
storage mediastorage media
storage media
 
B Trees
B TreesB Trees
B Trees
 

Dernier

Dernier (20)

How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptxOn_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxCOMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
 
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
 
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptx
 
How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structure
 

arithmetic ins in 8051

  • 2.
  • 3.
  • 4. Subtract Example : SUBB A, #0x4F ;A  A – 4F – C Notice that There is no subtraction WITHOUT borrow. Therefore, if a subtraction without borrow is desired, it is necessary to clear the C flag. Example : Clr c SUBB A, #0x4F ;A  A – 4F SUBB A, byte subtract with borrow
  • 5.
  • 6.
  • 7. Multiply When multiplying two 8-bit numbers, the size of the maximum product is 16-bits FF x FF = FE01 (255 x 255 = 65025) MUL AB ; BA  A * B Note : B gets the High byte A gets the Low byte
  • 8.
  • 9. Decimal Adjust DA a ; decimal adjust a Used to facilitate BCD addition. Adds “6” to either high or low nibble after an addition to create a valid BCD number. Example : mov a, #23h mov b, #29h add a, b; a  23h + 29h = 4Ch(wanted 52) DA a ; a  a + 6 = 52