SlideShare une entreprise Scribd logo
1  sur  31
MCS-51 Arithmetic Operation
Microprocessor
(MCS-51)
Number Comparison table
Decimal Hexadecimal Binary
0 0 0 0 0 0
1 1 0 0 0 1
2 2 0 0 1 0
3 3 0 0 1 1
4 4 0 1 0 0
5 5 0 1 0 1
6 6 0 1 1 0
7 7 0 1 1 1
8 8 1 0 0 0
9 9 1 0 0 1
1 0 A 1 0 1 0
1 1 B 1 0 1 1
1 2 C 1 1 0 0
1 3 D 1 1 0 1
1 4 E 1 1 1 0
1 5 F 1 1 1 1
28 July 2016 Microprocessor 2
MCS-51 is 8-bits word size
Microcontroller
• MCS-51 is 8-bits word size computer
1 1 0 1 0 0 1 1
D 3
Binary
Hexadecimal
8 Bits = 1 Byte
28 July 2016 Microprocessor 3
Arithmetic operation
• Additional
• Subtraction
• Multiplication
• Division
• Increment
• Decrement
• Decimal Adjustment (to BCD)
28 July 2016 Microprocessor 4
Additional Review
• Decimal
1
3 4 +
9 4
1 2 8
1
9 +
9
1 8
• Hexadecimal
0
B 4 +
1 4
C 8
1
F +
F
1 E
1
F F +
0 1
1 0 0
1
F F +
F F
1 F E
28 July 2016 Microprocessor 5
Additional
MSB
One Byte
Answer
MCS-51 Additional Operation
• Law of operation with Assembly
– The First operand MUST be Acc
– Every additional operation, the Result will store in
• Carry flag (as Most Significant bit)
• Acc
– Every Additional will effect to Carry flag
28 July 2016 Microprocessor 6
Additional Instructions
– Instructions
• ADD A, Rn
• ADD A, #X
• ADD A, Rx
• ADD A, @Ri
• ADDC A, Rn
• ADDC A, #X
• ADDC A, Rx
• ADDC A, @Ri
28 July 2016 Microprocessor 7
Sample Additional (Small number)
• A =
+
• R3 =
• ADD A, R3
• C = = Acc
8 C
3 8
C 40
28 July 2016 Microprocessor 8
Sample Additional (Big number)
• A =
+
• R3 =
• ADD A, R3
• C = = Acc
A 7
B 3
5 A1
28 July 2016 Microprocessor 9
Simple Additional Program
• See Handout Chapter 8
• Example 0:
• Program to summation R0 and R1, then
28 July 2016 Microprocessor 10
Sample “16-bits Additional Program”
• “16-bits Additional Program”
– Such as: 1001100110111011+ 99BB+
1101110010111011 DCBB
1 0111011001110110 1 76 76
• Solution:
– Because the word size of MCS-51 is 8-bits, the
diagram able to draw as below.
28 July 2016 Microprocessor 11
Sample “16-bits Additional Program”
9 9 B B
D C 6 4
x x x x
R1 R2
28 July 2016 Microprocessor 12
P2 P1
x x
ORG 00H
MOV A, R2
ADD A, P1 ; C, Acc
MOV 12h, A
MOV A, R1
ADDC A, P2 ; C, Acc
MOV 11h, Acc
CLR A
MOV Acc.0, C
MOV 10h, Acc
END
10h 11h 12h
01 76 1F
MCS-51 Subtraction Operation
• Law of operation
– Every Subtraction will include Carry flag
– Result will store in Acc
– Result on Carry flag
• “0” on Carry flag represent Positive result in Acc
• “1” on Carry flag represent Negative result in Acc
– Negative number result will be show in a Second
complement format
– Every Subtraction will effect to Carry flag
28 July 2016 Microprocessor 13
Subtraction Review
• Decimal
3 4 -
1 2
2 2
5 +
9
- 4
• Hexadecimal
B 4 -
1 4
C 8
1 C -
1 E
F E
28 July 2016 Microprocessor 14
Borrow (C) = 1
FE = 2 Complement of -2
Mathematic on Binary System
• Normal
5 -
7
-2
+ 4
2
• Binary System
0 5 -
0 7
F E
+ 0 4
0 2
28 July 2016 Microprocessor 15
FE = 2’n Complement of -2
Borrow (C) = 1
Subtraction Instruction
– Instructions
• SUBB A, Rn
• SUBB A, #X
• SUBB A, Rx
• SUBB A, @Ri
• Note: Every Additional will effect to Carry flag
28 July 2016 Microprocessor 16
32 bits Subtraction Program
• _
28 July 2016 Microprocessor 17
9 9 7 A
1 C 9 4
x x x x
11h 12h
21h 22h
9 D B B
D 3 6 4
13h 14h
x x x x
23h 24h
R1 R2 R3 R4
ORG 00H
CLR C
MOV A, R4
SUBB A, 14h
MOV 24h, A
MOV A, R3
SUBB A, 13h
MOV 23h, Acc
MOV A, R2
SUBB A, 12h
MOV 22h, Acc
MOV A, R1
SUBB A, 11h
MOV 21h, Acc
END
Test in Assembly Editor and Emulator
28 July 2016 Microprocessor 18
Assignment 1
• Chapter 8, Example 2
– Complete the Example 2 then check your code in the
Laboratory
– Check and Sign by Instructor
28 July 2016 Microprocessor 19
Homework 2
• Chapter 8,
– Refer to Example 3
– Write diagram and assembly code for MCS-51 to process
“32bits additional program”
– Specify data enter location by yourself.
– Generate Test data by your self (if needed)
– Submit before next class start.
28 July 2016 Microprocessor 21
Multiplication Operation
• Only operate by Register Acc and B
• Answer
– Low Byte store in Acc
– High Byte store in B
• Instruction
– MUL AB
28 July 2016 Microprocessor 22
3 E
9 2
x xy y
x
Sample Multiplication Operation
Basic Multiplication
See Handout Chapter 8
Example 1
28 July 2016 Microprocessor 23
3 E
9 2
x xy y
x
Sample Multiplication Operation
16-bits multiplication:
See Handout Chapter 8
Example 4
28 July 2016 Microprocessor 24
3 E
9 2 x
9 29 2
9 29 2
9 29 2
9 29 2
9 29 2 9 29 2
Division Operation
• Operate by register Acc and B
– Acc / B
• Answer
– Answer store in Acc
– Fraction store in B
• Instruction
– DIV AB
28 July 2016 Microprocessor 25
3 E0 5
Assignment 2
• Perform write program for MCS51 to operate
“16-bits Multiplication”
• Check by Instructor
28 July 2016 Microprocessor 26
Sample Division Operation
28 July 2016 Microprocessor 27
3 E0 5
0 C
3 C
0 2
C 2
5
Increment
• Increase by One
• On Over flow (Increase FF) will return to 00
• Effect to Carry flag?
28 July 2016 Microprocessor 28
Decrement
• Decrease by One
• On Over flow (Decrease 00) will return to FF
• Effect to Carry flag?
28 July 2016 Microprocessor 29
Binary Coded Decimal (BCD)
• Decimal Adjustment Acc
– DA A
28 July 2016 Microprocessor 30
Homework 3
28 July 2016 Microprocessor 31

Contenu connexe

Tendances

Digital and logic designs presentation
Digital and logic designs presentationDigital and logic designs presentation
Digital and logic designs presentationHaya Butt
 
Computer arithmetics coa project pdf version
Computer arithmetics coa project pdf versionComputer arithmetics coa project pdf version
Computer arithmetics coa project pdf versionSuryaKumarSahani
 
Scilab: Computing Tool For Engineers
Scilab: Computing Tool For EngineersScilab: Computing Tool For Engineers
Scilab: Computing Tool For EngineersNaren P.R.
 
Computer architecture
Computer architectureComputer architecture
Computer architectureSanjeev Patel
 
Logical micro-operations
Logical micro-operationsLogical micro-operations
Logical micro-operationsVATSAL TRIVEDI
 
Register transfer language & its micro operations
Register transfer language & its micro operationsRegister transfer language & its micro operations
Register transfer language & its micro operationsLakshya Sharma
 
Binary parallel adder
Binary parallel adderBinary parallel adder
Binary parallel adderanu surya
 
Register transfer and microoperations
Register transfer and microoperationsRegister transfer and microoperations
Register transfer and microoperationsmahesh kumar prajapat
 
overview of register transfer, micro operations and basic computer organizati...
overview of register transfer, micro operations and basic computer organizati...overview of register transfer, micro operations and basic computer organizati...
overview of register transfer, micro operations and basic computer organizati...Rai University
 
Csa stack
Csa stackCsa stack
Csa stackPCTE
 
Seminar on Digital Multiplier(Booth Multiplier) Using VHDL
Seminar on Digital Multiplier(Booth Multiplier) Using VHDLSeminar on Digital Multiplier(Booth Multiplier) Using VHDL
Seminar on Digital Multiplier(Booth Multiplier) Using VHDLNaseer LoneRider
 

Tendances (18)

Boothmultiplication
BoothmultiplicationBoothmultiplication
Boothmultiplication
 
4 bit add sub
4 bit add sub4 bit add sub
4 bit add sub
 
Digital and logic designs presentation
Digital and logic designs presentationDigital and logic designs presentation
Digital and logic designs presentation
 
Computer arithmetics coa project pdf version
Computer arithmetics coa project pdf versionComputer arithmetics coa project pdf version
Computer arithmetics coa project pdf version
 
Scilab: Computing Tool For Engineers
Scilab: Computing Tool For EngineersScilab: Computing Tool For Engineers
Scilab: Computing Tool For Engineers
 
Computer architecture
Computer architectureComputer architecture
Computer architecture
 
Arithmetic micro operations
Arithmetic micro operationsArithmetic micro operations
Arithmetic micro operations
 
Logical micro-operations
Logical micro-operationsLogical micro-operations
Logical micro-operations
 
CArcMOOC 03.05 - RTL design
CArcMOOC 03.05 - RTL designCArcMOOC 03.05 - RTL design
CArcMOOC 03.05 - RTL design
 
Binary parallel adder
Binary parallel adderBinary parallel adder
Binary parallel adder
 
Analysis of algo
Analysis of algoAnalysis of algo
Analysis of algo
 
Register transfer language & its micro operations
Register transfer language & its micro operationsRegister transfer language & its micro operations
Register transfer language & its micro operations
 
Computer Arithmetic
Computer ArithmeticComputer Arithmetic
Computer Arithmetic
 
Binary parallel adder
Binary parallel adderBinary parallel adder
Binary parallel adder
 
Register transfer and microoperations
Register transfer and microoperationsRegister transfer and microoperations
Register transfer and microoperations
 
overview of register transfer, micro operations and basic computer organizati...
overview of register transfer, micro operations and basic computer organizati...overview of register transfer, micro operations and basic computer organizati...
overview of register transfer, micro operations and basic computer organizati...
 
Csa stack
Csa stackCsa stack
Csa stack
 
Seminar on Digital Multiplier(Booth Multiplier) Using VHDL
Seminar on Digital Multiplier(Booth Multiplier) Using VHDLSeminar on Digital Multiplier(Booth Multiplier) Using VHDL
Seminar on Digital Multiplier(Booth Multiplier) Using VHDL
 

Similaire à Microprocessor Week 4-5 MCS-51 Arithmetic operation

arithmaticpipline-170310085040.pptx
arithmaticpipline-170310085040.pptxarithmaticpipline-170310085040.pptx
arithmaticpipline-170310085040.pptxAshokRachapalli1
 
Mba om 14_statistical_qualitycontrolmethods
Mba om 14_statistical_qualitycontrolmethodsMba om 14_statistical_qualitycontrolmethods
Mba om 14_statistical_qualitycontrolmethodsNiranjana K.R.
 
Data flow model -Lecture-4
Data flow model -Lecture-4Data flow model -Lecture-4
Data flow model -Lecture-4Dr.YNM
 
Computing Just What You Need: Online Data Analysis and Reduction at Extreme ...
Computing Just What You Need: Online Data Analysis and Reduction  at Extreme ...Computing Just What You Need: Online Data Analysis and Reduction  at Extreme ...
Computing Just What You Need: Online Data Analysis and Reduction at Extreme ...Ian Foster
 
Tutorial-on-DNN-07-Co-design-Precision.pdf
Tutorial-on-DNN-07-Co-design-Precision.pdfTutorial-on-DNN-07-Co-design-Precision.pdf
Tutorial-on-DNN-07-Co-design-Precision.pdfDuy-Hieu Bui
 
8085 instruction set and Programming
8085 instruction set and Programming 8085 instruction set and Programming
8085 instruction set and Programming pooja saini
 
Cost-Based Optimizer in Apache Spark 2.2 Ron Hu, Sameer Agarwal, Wenchen Fan ...
Cost-Based Optimizer in Apache Spark 2.2 Ron Hu, Sameer Agarwal, Wenchen Fan ...Cost-Based Optimizer in Apache Spark 2.2 Ron Hu, Sameer Agarwal, Wenchen Fan ...
Cost-Based Optimizer in Apache Spark 2.2 Ron Hu, Sameer Agarwal, Wenchen Fan ...Databricks
 
defense_slides_pengdu
defense_slides_pengdudefense_slides_pengdu
defense_slides_pengduPeng Du
 
streamingalgo88585858585858585pppppp.pptx
streamingalgo88585858585858585pppppp.pptxstreamingalgo88585858585858585pppppp.pptx
streamingalgo88585858585858585pppppp.pptxGopiNathVelivela
 
Cost-Based Optimizer in Apache Spark 2.2
Cost-Based Optimizer in Apache Spark 2.2 Cost-Based Optimizer in Apache Spark 2.2
Cost-Based Optimizer in Apache Spark 2.2 Databricks
 
High-Speed and Energy-Efficient MAC Design using Vedic Multiplier and Carry S...
High-Speed and Energy-Efficient MAC Design using Vedic Multiplier and Carry S...High-Speed and Energy-Efficient MAC Design using Vedic Multiplier and Carry S...
High-Speed and Energy-Efficient MAC Design using Vedic Multiplier and Carry S...IRJET Journal
 
Isc computer project final upload last
Isc computer project final upload lastIsc computer project final upload last
Isc computer project final upload lastArunav Ray
 
Design and Implementation of an Efficient 64 bit MAC
Design and Implementation of an Efficient 64 bit MACDesign and Implementation of an Efficient 64 bit MAC
Design and Implementation of an Efficient 64 bit MACIJERA Editor
 
Precomputing recommendations with Apache Beam
Precomputing recommendations with Apache BeamPrecomputing recommendations with Apache Beam
Precomputing recommendations with Apache BeamTatiana Al-Chueyr
 
VLSI subsystem design processes and illustration
VLSI subsystem design processes and illustrationVLSI subsystem design processes and illustration
VLSI subsystem design processes and illustrationVishal kakade
 
digital logic circuits, digital component floting and fixed point
digital logic circuits, digital component floting and fixed pointdigital logic circuits, digital component floting and fixed point
digital logic circuits, digital component floting and fixed pointRai University
 
Mca i-u-1.1 digital logic circuits, digital component floting and fixed point
Mca i-u-1.1 digital logic circuits, digital component floting and fixed pointMca i-u-1.1 digital logic circuits, digital component floting and fixed point
Mca i-u-1.1 digital logic circuits, digital component floting and fixed pointRai University
 

Similaire à Microprocessor Week 4-5 MCS-51 Arithmetic operation (20)

How To Tweak Angular 2 Performance
How To Tweak Angular 2 PerformanceHow To Tweak Angular 2 Performance
How To Tweak Angular 2 Performance
 
arithmaticpipline-170310085040.pptx
arithmaticpipline-170310085040.pptxarithmaticpipline-170310085040.pptx
arithmaticpipline-170310085040.pptx
 
Mba om 14_statistical_qualitycontrolmethods
Mba om 14_statistical_qualitycontrolmethodsMba om 14_statistical_qualitycontrolmethods
Mba om 14_statistical_qualitycontrolmethods
 
adders(1)
adders(1)adders(1)
adders(1)
 
Data flow model -Lecture-4
Data flow model -Lecture-4Data flow model -Lecture-4
Data flow model -Lecture-4
 
Computing Just What You Need: Online Data Analysis and Reduction at Extreme ...
Computing Just What You Need: Online Data Analysis and Reduction  at Extreme ...Computing Just What You Need: Online Data Analysis and Reduction  at Extreme ...
Computing Just What You Need: Online Data Analysis and Reduction at Extreme ...
 
Tutorial-on-DNN-07-Co-design-Precision.pdf
Tutorial-on-DNN-07-Co-design-Precision.pdfTutorial-on-DNN-07-Co-design-Precision.pdf
Tutorial-on-DNN-07-Co-design-Precision.pdf
 
8085 instruction set and Programming
8085 instruction set and Programming 8085 instruction set and Programming
8085 instruction set and Programming
 
Cost-Based Optimizer in Apache Spark 2.2 Ron Hu, Sameer Agarwal, Wenchen Fan ...
Cost-Based Optimizer in Apache Spark 2.2 Ron Hu, Sameer Agarwal, Wenchen Fan ...Cost-Based Optimizer in Apache Spark 2.2 Ron Hu, Sameer Agarwal, Wenchen Fan ...
Cost-Based Optimizer in Apache Spark 2.2 Ron Hu, Sameer Agarwal, Wenchen Fan ...
 
defense_slides_pengdu
defense_slides_pengdudefense_slides_pengdu
defense_slides_pengdu
 
streamingalgo88585858585858585pppppp.pptx
streamingalgo88585858585858585pppppp.pptxstreamingalgo88585858585858585pppppp.pptx
streamingalgo88585858585858585pppppp.pptx
 
Cost-Based Optimizer in Apache Spark 2.2
Cost-Based Optimizer in Apache Spark 2.2 Cost-Based Optimizer in Apache Spark 2.2
Cost-Based Optimizer in Apache Spark 2.2
 
High-Speed and Energy-Efficient MAC Design using Vedic Multiplier and Carry S...
High-Speed and Energy-Efficient MAC Design using Vedic Multiplier and Carry S...High-Speed and Energy-Efficient MAC Design using Vedic Multiplier and Carry S...
High-Speed and Energy-Efficient MAC Design using Vedic Multiplier and Carry S...
 
Isc computer project final upload last
Isc computer project final upload lastIsc computer project final upload last
Isc computer project final upload last
 
Design and Implementation of an Efficient 64 bit MAC
Design and Implementation of an Efficient 64 bit MACDesign and Implementation of an Efficient 64 bit MAC
Design and Implementation of an Efficient 64 bit MAC
 
Precomputing recommendations with Apache Beam
Precomputing recommendations with Apache BeamPrecomputing recommendations with Apache Beam
Precomputing recommendations with Apache Beam
 
5. Arithmaticn combinational Ckt.ppt
5. Arithmaticn combinational Ckt.ppt5. Arithmaticn combinational Ckt.ppt
5. Arithmaticn combinational Ckt.ppt
 
VLSI subsystem design processes and illustration
VLSI subsystem design processes and illustrationVLSI subsystem design processes and illustration
VLSI subsystem design processes and illustration
 
digital logic circuits, digital component floting and fixed point
digital logic circuits, digital component floting and fixed pointdigital logic circuits, digital component floting and fixed point
digital logic circuits, digital component floting and fixed point
 
Mca i-u-1.1 digital logic circuits, digital component floting and fixed point
Mca i-u-1.1 digital logic circuits, digital component floting and fixed pointMca i-u-1.1 digital logic circuits, digital component floting and fixed point
Mca i-u-1.1 digital logic circuits, digital component floting and fixed point
 

Plus de Arkhom Jodtang

MCS51 Training board Model CATC2016A
MCS51 Training board Model CATC2016AMCS51 Training board Model CATC2016A
MCS51 Training board Model CATC2016AArkhom Jodtang
 
Microprocessor Week 10: Applications
Microprocessor Week 10: ApplicationsMicroprocessor Week 10: Applications
Microprocessor Week 10: ApplicationsArkhom Jodtang
 
Microprocessor Week 9: Timer and Counter
Microprocessor Week 9: Timer and CounterMicroprocessor Week 9: Timer and Counter
Microprocessor Week 9: Timer and CounterArkhom Jodtang
 
Microprocessor Week 8: Advance programming
Microprocessor Week 8: Advance programmingMicroprocessor Week 8: Advance programming
Microprocessor Week 8: Advance programmingArkhom Jodtang
 
Microprocessor Week 8: Subroutine
Microprocessor Week 8: Subroutine Microprocessor Week 8: Subroutine
Microprocessor Week 8: Subroutine Arkhom Jodtang
 
Microprocessor Week 2: CH2 Circuit and Operation
Microprocessor Week 2: CH2 Circuit and OperationMicroprocessor Week 2: CH2 Circuit and Operation
Microprocessor Week 2: CH2 Circuit and OperationArkhom Jodtang
 
Microprocessor Week1: Introduction
Microprocessor Week1: IntroductionMicroprocessor Week1: Introduction
Microprocessor Week1: IntroductionArkhom Jodtang
 
Microprocessor laboratory 03 Arithmetic Operation (Additional and Subtraction)
Microprocessor laboratory 03 Arithmetic Operation (Additional and Subtraction)Microprocessor laboratory 03 Arithmetic Operation (Additional and Subtraction)
Microprocessor laboratory 03 Arithmetic Operation (Additional and Subtraction)Arkhom Jodtang
 
Use of Computer & IT, Laboratory MS Word
Use of Computer & IT, Laboratory MS WordUse of Computer & IT, Laboratory MS Word
Use of Computer & IT, Laboratory MS WordArkhom Jodtang
 
Microprocessor Laboratory 2: Logical instructions
Microprocessor Laboratory 2: Logical instructionsMicroprocessor Laboratory 2: Logical instructions
Microprocessor Laboratory 2: Logical instructionsArkhom Jodtang
 
Microprocessor: Delay technique
Microprocessor: Delay techniqueMicroprocessor: Delay technique
Microprocessor: Delay techniqueArkhom Jodtang
 
Distance Measuring Car
Distance Measuring CarDistance Measuring Car
Distance Measuring CarArkhom Jodtang
 
Microprocessor Week 7: Branch Instruction
Microprocessor Week 7: Branch InstructionMicroprocessor Week 7: Branch Instruction
Microprocessor Week 7: Branch InstructionArkhom Jodtang
 
Tamech 2013 Presentation
Tamech 2013 PresentationTamech 2013 Presentation
Tamech 2013 PresentationArkhom Jodtang
 
Electronics & Avionics project
Electronics & Avionics projectElectronics & Avionics project
Electronics & Avionics projectArkhom Jodtang
 

Plus de Arkhom Jodtang (15)

MCS51 Training board Model CATC2016A
MCS51 Training board Model CATC2016AMCS51 Training board Model CATC2016A
MCS51 Training board Model CATC2016A
 
Microprocessor Week 10: Applications
Microprocessor Week 10: ApplicationsMicroprocessor Week 10: Applications
Microprocessor Week 10: Applications
 
Microprocessor Week 9: Timer and Counter
Microprocessor Week 9: Timer and CounterMicroprocessor Week 9: Timer and Counter
Microprocessor Week 9: Timer and Counter
 
Microprocessor Week 8: Advance programming
Microprocessor Week 8: Advance programmingMicroprocessor Week 8: Advance programming
Microprocessor Week 8: Advance programming
 
Microprocessor Week 8: Subroutine
Microprocessor Week 8: Subroutine Microprocessor Week 8: Subroutine
Microprocessor Week 8: Subroutine
 
Microprocessor Week 2: CH2 Circuit and Operation
Microprocessor Week 2: CH2 Circuit and OperationMicroprocessor Week 2: CH2 Circuit and Operation
Microprocessor Week 2: CH2 Circuit and Operation
 
Microprocessor Week1: Introduction
Microprocessor Week1: IntroductionMicroprocessor Week1: Introduction
Microprocessor Week1: Introduction
 
Microprocessor laboratory 03 Arithmetic Operation (Additional and Subtraction)
Microprocessor laboratory 03 Arithmetic Operation (Additional and Subtraction)Microprocessor laboratory 03 Arithmetic Operation (Additional and Subtraction)
Microprocessor laboratory 03 Arithmetic Operation (Additional and Subtraction)
 
Use of Computer & IT, Laboratory MS Word
Use of Computer & IT, Laboratory MS WordUse of Computer & IT, Laboratory MS Word
Use of Computer & IT, Laboratory MS Word
 
Microprocessor Laboratory 2: Logical instructions
Microprocessor Laboratory 2: Logical instructionsMicroprocessor Laboratory 2: Logical instructions
Microprocessor Laboratory 2: Logical instructions
 
Microprocessor: Delay technique
Microprocessor: Delay techniqueMicroprocessor: Delay technique
Microprocessor: Delay technique
 
Distance Measuring Car
Distance Measuring CarDistance Measuring Car
Distance Measuring Car
 
Microprocessor Week 7: Branch Instruction
Microprocessor Week 7: Branch InstructionMicroprocessor Week 7: Branch Instruction
Microprocessor Week 7: Branch Instruction
 
Tamech 2013 Presentation
Tamech 2013 PresentationTamech 2013 Presentation
Tamech 2013 Presentation
 
Electronics & Avionics project
Electronics & Avionics projectElectronics & Avionics project
Electronics & Avionics project
 

Dernier

Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Dr.Costas Sachpazis
 
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingUNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingrknatarajan
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxAsutosh Ranjan
 
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756dollysharma2066
 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Bookingdharasingh5698
 
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...SUHANI PANDEY
 
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...ranjana rawat
 
chapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineeringchapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineeringmulugeta48
 
Generative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTGenerative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTbhaskargani46
 
Glass Ceramics: Processing and Properties
Glass Ceramics: Processing and PropertiesGlass Ceramics: Processing and Properties
Glass Ceramics: Processing and PropertiesPrabhanshu Chaturvedi
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...Call Girls in Nagpur High Profile
 
data_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfdata_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfJiananWang21
 
UNIT-IFLUID PROPERTIES & FLOW CHARACTERISTICS
UNIT-IFLUID PROPERTIES & FLOW CHARACTERISTICSUNIT-IFLUID PROPERTIES & FLOW CHARACTERISTICS
UNIT-IFLUID PROPERTIES & FLOW CHARACTERISTICSrknatarajan
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlysanyuktamishra911
 
Vivazz, Mieres Social Housing Design Spain
Vivazz, Mieres Social Housing Design SpainVivazz, Mieres Social Housing Design Spain
Vivazz, Mieres Social Housing Design Spaintimesproduction05
 
Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01KreezheaRecto
 
Unit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdfUnit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdfRagavanV2
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordAsst.prof M.Gokilavani
 

Dernier (20)

Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
 
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
 
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingUNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptx
 
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Mahipalpur Delhi Contact Us 8377877756
 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
 
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
 
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
 
chapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineeringchapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineering
 
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
 
Generative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTGenerative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPT
 
Glass Ceramics: Processing and Properties
Glass Ceramics: Processing and PropertiesGlass Ceramics: Processing and Properties
Glass Ceramics: Processing and Properties
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
 
data_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfdata_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdf
 
UNIT-IFLUID PROPERTIES & FLOW CHARACTERISTICS
UNIT-IFLUID PROPERTIES & FLOW CHARACTERISTICSUNIT-IFLUID PROPERTIES & FLOW CHARACTERISTICS
UNIT-IFLUID PROPERTIES & FLOW CHARACTERISTICS
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghly
 
Vivazz, Mieres Social Housing Design Spain
Vivazz, Mieres Social Housing Design SpainVivazz, Mieres Social Housing Design Spain
Vivazz, Mieres Social Housing Design Spain
 
Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01
 
Unit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdfUnit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdf
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
 

Microprocessor Week 4-5 MCS-51 Arithmetic operation

  • 2. Number Comparison table Decimal Hexadecimal Binary 0 0 0 0 0 0 1 1 0 0 0 1 2 2 0 0 1 0 3 3 0 0 1 1 4 4 0 1 0 0 5 5 0 1 0 1 6 6 0 1 1 0 7 7 0 1 1 1 8 8 1 0 0 0 9 9 1 0 0 1 1 0 A 1 0 1 0 1 1 B 1 0 1 1 1 2 C 1 1 0 0 1 3 D 1 1 0 1 1 4 E 1 1 1 0 1 5 F 1 1 1 1 28 July 2016 Microprocessor 2
  • 3. MCS-51 is 8-bits word size Microcontroller • MCS-51 is 8-bits word size computer 1 1 0 1 0 0 1 1 D 3 Binary Hexadecimal 8 Bits = 1 Byte 28 July 2016 Microprocessor 3
  • 4. Arithmetic operation • Additional • Subtraction • Multiplication • Division • Increment • Decrement • Decimal Adjustment (to BCD) 28 July 2016 Microprocessor 4
  • 5. Additional Review • Decimal 1 3 4 + 9 4 1 2 8 1 9 + 9 1 8 • Hexadecimal 0 B 4 + 1 4 C 8 1 F + F 1 E 1 F F + 0 1 1 0 0 1 F F + F F 1 F E 28 July 2016 Microprocessor 5 Additional MSB One Byte Answer
  • 6. MCS-51 Additional Operation • Law of operation with Assembly – The First operand MUST be Acc – Every additional operation, the Result will store in • Carry flag (as Most Significant bit) • Acc – Every Additional will effect to Carry flag 28 July 2016 Microprocessor 6
  • 7. Additional Instructions – Instructions • ADD A, Rn • ADD A, #X • ADD A, Rx • ADD A, @Ri • ADDC A, Rn • ADDC A, #X • ADDC A, Rx • ADDC A, @Ri 28 July 2016 Microprocessor 7
  • 8. Sample Additional (Small number) • A = + • R3 = • ADD A, R3 • C = = Acc 8 C 3 8 C 40 28 July 2016 Microprocessor 8
  • 9. Sample Additional (Big number) • A = + • R3 = • ADD A, R3 • C = = Acc A 7 B 3 5 A1 28 July 2016 Microprocessor 9
  • 10. Simple Additional Program • See Handout Chapter 8 • Example 0: • Program to summation R0 and R1, then 28 July 2016 Microprocessor 10
  • 11. Sample “16-bits Additional Program” • “16-bits Additional Program” – Such as: 1001100110111011+ 99BB+ 1101110010111011 DCBB 1 0111011001110110 1 76 76 • Solution: – Because the word size of MCS-51 is 8-bits, the diagram able to draw as below. 28 July 2016 Microprocessor 11
  • 12. Sample “16-bits Additional Program” 9 9 B B D C 6 4 x x x x R1 R2 28 July 2016 Microprocessor 12 P2 P1 x x ORG 00H MOV A, R2 ADD A, P1 ; C, Acc MOV 12h, A MOV A, R1 ADDC A, P2 ; C, Acc MOV 11h, Acc CLR A MOV Acc.0, C MOV 10h, Acc END 10h 11h 12h 01 76 1F
  • 13. MCS-51 Subtraction Operation • Law of operation – Every Subtraction will include Carry flag – Result will store in Acc – Result on Carry flag • “0” on Carry flag represent Positive result in Acc • “1” on Carry flag represent Negative result in Acc – Negative number result will be show in a Second complement format – Every Subtraction will effect to Carry flag 28 July 2016 Microprocessor 13
  • 14. Subtraction Review • Decimal 3 4 - 1 2 2 2 5 + 9 - 4 • Hexadecimal B 4 - 1 4 C 8 1 C - 1 E F E 28 July 2016 Microprocessor 14 Borrow (C) = 1 FE = 2 Complement of -2
  • 15. Mathematic on Binary System • Normal 5 - 7 -2 + 4 2 • Binary System 0 5 - 0 7 F E + 0 4 0 2 28 July 2016 Microprocessor 15 FE = 2’n Complement of -2 Borrow (C) = 1
  • 16. Subtraction Instruction – Instructions • SUBB A, Rn • SUBB A, #X • SUBB A, Rx • SUBB A, @Ri • Note: Every Additional will effect to Carry flag 28 July 2016 Microprocessor 16
  • 17. 32 bits Subtraction Program • _ 28 July 2016 Microprocessor 17 9 9 7 A 1 C 9 4 x x x x 11h 12h 21h 22h 9 D B B D 3 6 4 13h 14h x x x x 23h 24h R1 R2 R3 R4 ORG 00H CLR C MOV A, R4 SUBB A, 14h MOV 24h, A MOV A, R3 SUBB A, 13h MOV 23h, Acc MOV A, R2 SUBB A, 12h MOV 22h, Acc MOV A, R1 SUBB A, 11h MOV 21h, Acc END
  • 18. Test in Assembly Editor and Emulator 28 July 2016 Microprocessor 18
  • 19. Assignment 1 • Chapter 8, Example 2 – Complete the Example 2 then check your code in the Laboratory – Check and Sign by Instructor 28 July 2016 Microprocessor 19
  • 20.
  • 21. Homework 2 • Chapter 8, – Refer to Example 3 – Write diagram and assembly code for MCS-51 to process “32bits additional program” – Specify data enter location by yourself. – Generate Test data by your self (if needed) – Submit before next class start. 28 July 2016 Microprocessor 21
  • 22. Multiplication Operation • Only operate by Register Acc and B • Answer – Low Byte store in Acc – High Byte store in B • Instruction – MUL AB 28 July 2016 Microprocessor 22 3 E 9 2 x xy y x
  • 23. Sample Multiplication Operation Basic Multiplication See Handout Chapter 8 Example 1 28 July 2016 Microprocessor 23 3 E 9 2 x xy y x
  • 24. Sample Multiplication Operation 16-bits multiplication: See Handout Chapter 8 Example 4 28 July 2016 Microprocessor 24 3 E 9 2 x 9 29 2 9 29 2 9 29 2 9 29 2 9 29 2 9 29 2
  • 25. Division Operation • Operate by register Acc and B – Acc / B • Answer – Answer store in Acc – Fraction store in B • Instruction – DIV AB 28 July 2016 Microprocessor 25 3 E0 5
  • 26. Assignment 2 • Perform write program for MCS51 to operate “16-bits Multiplication” • Check by Instructor 28 July 2016 Microprocessor 26
  • 27. Sample Division Operation 28 July 2016 Microprocessor 27 3 E0 5 0 C 3 C 0 2 C 2 5
  • 28. Increment • Increase by One • On Over flow (Increase FF) will return to 00 • Effect to Carry flag? 28 July 2016 Microprocessor 28
  • 29. Decrement • Decrease by One • On Over flow (Decrease 00) will return to FF • Effect to Carry flag? 28 July 2016 Microprocessor 29
  • 30. Binary Coded Decimal (BCD) • Decimal Adjustment Acc – DA A 28 July 2016 Microprocessor 30
  • 31. Homework 3 28 July 2016 Microprocessor 31