SlideShare a Scribd company logo
MADE BY
MOHIT AGARWAL – (161080107026)
5TH SEM COMPUTER
Code conversion allows user to translate a number that is representated
using one coding system to other coding system.
The code conversion involves operations like :
1) Binary to BCD
2) BCD to Binary
3) BCD to Hex
4) Hex to BCD
5) BCD to Seven Segment
6) Binary to ASCII
7) ASCII to Binary
The microprocessor understands the binary/hex number
system. To convert BCD number into its binary equivalent
we need to use the principle of positional weighting in a
given number.
EXAMPLE : (2 Digit BCD to Binary)
60 = 6 x 0A H + 0
60 = 3C H + 0
60 = 3C H
LDA 2200H : Get the BCD number
MOV B, A : Save it
ANI OFH : Mask most significant four bits
MOV C, A : Save unpacked BCD 1 in C register
MOV A, B : Get BCD again
ANI FOH : Mask least significant four bits
RRC : Convert most significant four bits into unpacked BCD 2
RRC
RRC
RRC
MOV B, A : Save unpacked BCD 2 in B register
XRA A : Clear accumulator (sum = 0)
MVI D, 0AH : Set D as a multiplier of 10
SUM:ADD D : Add 10 until (B) = 0
DCR B : Decrement BCD2 by one
JNZ SUM : Is multiplication complete? If not, go back and add again
ADD C : Add BCD 1
STA 2300H : Store the result
HLT : Terminate program execution
INPUT :
2200 H : 60 H
OUTPUT :
2300 H : 3C H
The microprocessor processes data in binary
form but data that is displayed is in BCD form.
Hence, we require to convert the Binary data
to BCD.
The series of operations to be performed is
represented here using a flowchart.
Source Program:
LXI SP, 27FFH : Initialize stack pointer
LDA 6000H : Get the binary number in accumulator
CALL SUBROUTINE : Call subroutine
HLT : Terminate program execution
Subroutine to convert binary number into its equivalent BCD number:
PUSH B : Save BC register pair contents
PUSH D : Save DE register pair contents
MVI B, 64H : Load divisor decimal 100 in B register
MVI C, 0AH : Load divisor decimal 10 in C register
MVI D, 00H : Initialize Digit 1
MVI E, 00H : Initialize Digit 2
STEP1:CMP B : Check if number < Decimal 100
JC STEP 2 : if yes go to step 2
SUB B : Subtract decimal 100
INR E : update quotient
JMP STEP 1 : go to step 1
STEP2:CMP C : Check if number < Decimal 10
JC STEP 3 : if yes go to step 3
SUB C : Subtract decimal 10
INR D : Update quotient
JMP STEP 2 : Continue division by 10
STEP3:STA 6100H : Store Digit 0
MOV A, D : Get Digit 1
STA 6101H : Store Digit 1
MOV A, E : Get Digit 2
STA 6102H : Store Digit 2
POP D : Restore DE register pair
POP B : Restore BC register pair
RET : Return to main program
INPUT :
3040 H : 8A H
OUTPUT :
3041 H : 08 H
3042 H : 03 H
3043 H : 01 H
The ASCII (American Standard Code
for Information Interchange) is
used for communication purposes.
Hence, it is necessary to convert
Binary number to its ASCII
equivalent.
Source program:
LXI SP, 27FFH : Initialize stack pointer
LXI H, 2000H : Source memory pointer
LXI D, 2200H : Destination memory pointer
MVI C, O5H : Initialize the counter
BACK: MOV A, M : Get the number
CALL ASCII : Call subroutine ASCII
STAX D : Store result
INX H : Increment source memory pointer
INX D : Increment destination memory pointer
DCR C : Decrement count by 1
CJNZ : If not zero, repeat
HLT : Stop program execution a
Subroutine ASCII:
ASCII:CPI, OAH : Check if number is OAR
JNC NEXT : If yes go to next otherwise continue
ADI 30H
JMP LAST
NEXT:ADI 37H
LAST:RET : Return to main program
INPUT :
(2000H) = 1
(2001H) = 2
(2002H) = 9
(2003H) = A
(2004H) = B
OUTPUT :
(2200H) = 31
(2201H) = 32
(2202H) = 39
(2203H) = 41
(2204H) = 42
Steps for ASCII to Binary code conversion :
If ASCII code is less than 3A H then 30 H is subtracted from the number
to get its Binary Equivalent.
If the number is between 41 H and 5A H then 37 H is subtracted to get
the binary equivalent of the letter A-F.
EX:
41 H (ASCII) = 41 H - 37 H
= 04 H (BINARY)
Steps for BCD to HEX code conversion :
1) We get the value from the user.
2) Then we take the Most Significant Digit (MSD).
3) We multiply MSD by 10, using repeated addition.
4) Then we add the Least Significant Digit (LSD) to the result obtained
in previous step.
5) And finally the value is stored in the next memory location.
LXI H,0030H : Get the BCD number
MOV A,M : Initialize the memory Pointer
ADD A : Value in accumulator is doubled
MOV B,A : Value in accumulator is moved to register B
ADD A : Value in accumulator is doubled again
ADD A : Value in accumulator is doubled again
ADD B : Value in Register B is added to accumulator
(A is 10 x MSD of the BCD stored at 0030H)
INX H : Point to LSD
ADD M : LSD is added to accumulator
INX H Next location is pointed
MOV M,A : Value obtained is stored here
HLT : Terminate the program
INPUT :
0030 H : 02 H
0031 H : 09 H
OUTPUT :
0032 H : 1D H
Steps for HEX to BCD code conversion :
1) We get the HEX number from user.
2) Then shift the hexadecimal number to C register.
3) We perform repeated addition for C number of times.
4) And adjust for BCD count in each step.
5) Now the BCD value obtained is stored in memory.
LXI H,0030H : Get the HEX number
MOV C,M : Shift the number to C register
LOOP1: ADI 01H : Start a loop of repeated addition for C times
DAA : Adjust for BCD count
JNC LOOP2 : Start another loop for Higher order number
INR D
LOOP2: DCR C : Decrease C till it reaches Zero
JNZ LOOP1
STA 0051H : Store the Lower order here
MOV A,D : Move the Higher order value to accumulator
STA 0050H : Store the Higher order here
HLT
INPUT :
0030 H : 1D H
OUTPUT :
0050 H : 02 H
0051 H : 09 H
• The seven segment LCD display is used
for displaying the results in a
microprocessor based system.
• In such cases we need to convert the
results in the seven segment code.
• Such conversion can be obtained with
a look-up table.
0 3F
1 06
2 5B
3 4F
4 66
5 6D
6 7D
7 07
8 7F
9 6F
LXI H, 6200H : Initialize lookup table pointer
LXI D, 6000H : Initialize source memory pointer
LXI B, 7000H : Initialize destination memory pointer
BACK: LDAX D : Get the number
MOV L, A : A point to the 7-segment code
MOV A, M : Get the 7-segment code
STAX B : Store the result at destination memory location
INX D : Increment source memory pointer
INX B : Increment destination memory pointer
MOV A, C
CPI O5H : Check for last number
JNZ BACK : If not repeat
HLT : End of program
THANKYOU

More Related Content

What's hot

8086 instructions
8086 instructions8086 instructions
8086 instructions
Ravi Anand
 
Addressing modes of 8051
Addressing modes of 8051Addressing modes of 8051
Addressing modes of 8051
SARITHA REDDY
 
Memory interfacing
Memory interfacingMemory interfacing
Memory interfacing
mahalakshmimalini
 
8237 dma controller
8237 dma controller8237 dma controller
8237 dma controller
Tech_MX
 
Addressing modes
Addressing modesAddressing modes
Addressing modes
karthiga selvaraju
 
Serial Communication in 8051
Serial Communication in 8051Serial Communication in 8051
Serial Communication in 8051
Sudhanshu Janwadkar
 
8086 alp
8086 alp8086 alp
Assembly Language Programming Of 8085
Assembly Language Programming Of 8085Assembly Language Programming Of 8085
Assembly Language Programming Of 8085
techbed
 
program status word
program status wordprogram status word
program status word
sheetalverma38
 
TRAFFIC LIGHT CONTROL SYSTEM USING 8085 MICROPROCESSOR
TRAFFIC LIGHT CONTROL SYSTEM USING 8085 MICROPROCESSORTRAFFIC LIGHT CONTROL SYSTEM USING 8085 MICROPROCESSOR
TRAFFIC LIGHT CONTROL SYSTEM USING 8085 MICROPROCESSOR
Subash Sambath Kumar
 
8085 instruction set
8085 instruction set8085 instruction set
Datapath Design of Computer Architecture
Datapath Design of Computer ArchitectureDatapath Design of Computer Architecture
Datapath Design of Computer Architecture
Abu Zaman
 
8051 Microcontroller PPT's By Er. Swapnil Kaware
8051 Microcontroller PPT's By Er. Swapnil Kaware8051 Microcontroller PPT's By Er. Swapnil Kaware
8051 Microcontroller PPT's By Er. Swapnil Kaware
Prof. Swapnil V. Kaware
 
Assembly Language
Assembly LanguageAssembly Language
Assembly Language
Ibrahimcommunication Al Ani
 
Input output accessing
Input output accessingInput output accessing
Input output accessing
ankitraosingh
 
8086 pin details
8086 pin details8086 pin details
8086 pin details
AJAL A J
 
Timing diagram 8085 microprocessor
Timing diagram 8085 microprocessorTiming diagram 8085 microprocessor
Timing diagram 8085 microprocessor
Velalar College of Engineering and Technology
 
8051 Addressing Modes
8051 Addressing Modes8051 Addressing Modes
8051 Addressing Modes
Senthil Kumar
 
Assembly 8086
Assembly 8086Assembly 8086
Assembly 8086
Mustafa Salah
 
Unit4.tms320c54x
Unit4.tms320c54xUnit4.tms320c54x

What's hot (20)

8086 instructions
8086 instructions8086 instructions
8086 instructions
 
Addressing modes of 8051
Addressing modes of 8051Addressing modes of 8051
Addressing modes of 8051
 
Memory interfacing
Memory interfacingMemory interfacing
Memory interfacing
 
8237 dma controller
8237 dma controller8237 dma controller
8237 dma controller
 
Addressing modes
Addressing modesAddressing modes
Addressing modes
 
Serial Communication in 8051
Serial Communication in 8051Serial Communication in 8051
Serial Communication in 8051
 
8086 alp
8086 alp8086 alp
8086 alp
 
Assembly Language Programming Of 8085
Assembly Language Programming Of 8085Assembly Language Programming Of 8085
Assembly Language Programming Of 8085
 
program status word
program status wordprogram status word
program status word
 
TRAFFIC LIGHT CONTROL SYSTEM USING 8085 MICROPROCESSOR
TRAFFIC LIGHT CONTROL SYSTEM USING 8085 MICROPROCESSORTRAFFIC LIGHT CONTROL SYSTEM USING 8085 MICROPROCESSOR
TRAFFIC LIGHT CONTROL SYSTEM USING 8085 MICROPROCESSOR
 
8085 instruction set
8085 instruction set8085 instruction set
8085 instruction set
 
Datapath Design of Computer Architecture
Datapath Design of Computer ArchitectureDatapath Design of Computer Architecture
Datapath Design of Computer Architecture
 
8051 Microcontroller PPT's By Er. Swapnil Kaware
8051 Microcontroller PPT's By Er. Swapnil Kaware8051 Microcontroller PPT's By Er. Swapnil Kaware
8051 Microcontroller PPT's By Er. Swapnil Kaware
 
Assembly Language
Assembly LanguageAssembly Language
Assembly Language
 
Input output accessing
Input output accessingInput output accessing
Input output accessing
 
8086 pin details
8086 pin details8086 pin details
8086 pin details
 
Timing diagram 8085 microprocessor
Timing diagram 8085 microprocessorTiming diagram 8085 microprocessor
Timing diagram 8085 microprocessor
 
8051 Addressing Modes
8051 Addressing Modes8051 Addressing Modes
8051 Addressing Modes
 
Assembly 8086
Assembly 8086Assembly 8086
Assembly 8086
 
Unit4.tms320c54x
Unit4.tms320c54xUnit4.tms320c54x
Unit4.tms320c54x
 

Similar to Code Conversion in 8085 Microprocessor

Microprocessor Part 3
Microprocessor    Part  3Microprocessor    Part  3
Microprocessor Part 3
Sajan Agrawal
 
8085 Assembly language programs.pdf
8085 Assembly language programs.pdf8085 Assembly language programs.pdf
8085 Assembly language programs.pdf
RahulMishra122561
 
Chapter 7 - Programming Techniques with Additional Instructions
Chapter 7 - Programming Techniques with Additional InstructionsChapter 7 - Programming Techniques with Additional Instructions
Chapter 7 - Programming Techniques with Additional Instructions
cmkandemir
 
microp-8085 74 instructions for mct-A :P
microp-8085 74 instructions for mct-A :Pmicrop-8085 74 instructions for mct-A :P
microp-8085 74 instructions for mct-A :P
Jathin Kanumuri
 
8085 Paper Presentation slides,ppt,microprocessor 8085 ,guide, instruction set
8085 Paper Presentation slides,ppt,microprocessor 8085 ,guide, instruction set8085 Paper Presentation slides,ppt,microprocessor 8085 ,guide, instruction set
8085 Paper Presentation slides,ppt,microprocessor 8085 ,guide, instruction set
Saumitra Rukmangad
 
microp-8085 74 instructions for mct-A :P-2
microp-8085 74 instructions for mct-A :P-2microp-8085 74 instructions for mct-A :P-2
microp-8085 74 instructions for mct-A :P-2
Jathin Kanumuri
 
Chapter 3 instruction set-of-8085
Chapter 3 instruction set-of-8085Chapter 3 instruction set-of-8085
Chapter 3 instruction set-of-8085
Shubham Singh
 
INTEL 8085 DATA FORMAT AND INSTRUCTIONS
INTEL 8085 DATA FORMAT AND INSTRUCTIONSINTEL 8085 DATA FORMAT AND INSTRUCTIONS
INTEL 8085 DATA FORMAT AND INSTRUCTIONS
Swapnil Mishra
 
Assembly language programs 2
Assembly language programs 2Assembly language programs 2
Assembly language programs 2
HarshitParkar6677
 
15CS44 MP & MC Module 2
15CS44 MP & MC Module  215CS44 MP & MC Module  2
15CS44 MP & MC Module 2
RLJIT
 
5.pptx
5.pptx5.pptx
5.pptx
Chanyalew21
 
Ecet 330 final exam new 2016
Ecet 330 final exam new 2016Ecet 330 final exam new 2016
Ecet 330 final exam new 2016
sergejsvolkovs10
 
Ecet 330 final exam new 2016
Ecet 330 final exam new 2016Ecet 330 final exam new 2016
Ecet 330 final exam new 2016
powellabril
 
Ecet 330 final exam new 2016
Ecet 330 final exam new 2016Ecet 330 final exam new 2016
Ecet 330 final exam new 2016
powellabril
 
Embedded system (Chapter 2) part 2
Embedded system (Chapter 2) part 2Embedded system (Chapter 2) part 2
Embedded system (Chapter 2) part 2
Ikhwan_Fakrudin
 
Instruction set of 8086
Instruction set of 8086Instruction set of 8086
Instruction set of 8086
Tirumalesh Nizampatnam
 
Basic programming of 8085
Basic programming of 8085 Basic programming of 8085
Basic programming of 8085
vijaydeepakg
 
Real Time Embedded System
Real Time Embedded SystemReal Time Embedded System
Real Time Embedded System
Vrushali Lanjewar
 
Chp6 assembly language programming for pic copy
Chp6 assembly language programming for pic   copyChp6 assembly language programming for pic   copy
Chp6 assembly language programming for pic copy
mkazree
 
Microprocessor lab manual
Microprocessor lab manualMicroprocessor lab manual

Similar to Code Conversion in 8085 Microprocessor (20)

Microprocessor Part 3
Microprocessor    Part  3Microprocessor    Part  3
Microprocessor Part 3
 
8085 Assembly language programs.pdf
8085 Assembly language programs.pdf8085 Assembly language programs.pdf
8085 Assembly language programs.pdf
 
Chapter 7 - Programming Techniques with Additional Instructions
Chapter 7 - Programming Techniques with Additional InstructionsChapter 7 - Programming Techniques with Additional Instructions
Chapter 7 - Programming Techniques with Additional Instructions
 
microp-8085 74 instructions for mct-A :P
microp-8085 74 instructions for mct-A :Pmicrop-8085 74 instructions for mct-A :P
microp-8085 74 instructions for mct-A :P
 
8085 Paper Presentation slides,ppt,microprocessor 8085 ,guide, instruction set
8085 Paper Presentation slides,ppt,microprocessor 8085 ,guide, instruction set8085 Paper Presentation slides,ppt,microprocessor 8085 ,guide, instruction set
8085 Paper Presentation slides,ppt,microprocessor 8085 ,guide, instruction set
 
microp-8085 74 instructions for mct-A :P-2
microp-8085 74 instructions for mct-A :P-2microp-8085 74 instructions for mct-A :P-2
microp-8085 74 instructions for mct-A :P-2
 
Chapter 3 instruction set-of-8085
Chapter 3 instruction set-of-8085Chapter 3 instruction set-of-8085
Chapter 3 instruction set-of-8085
 
INTEL 8085 DATA FORMAT AND INSTRUCTIONS
INTEL 8085 DATA FORMAT AND INSTRUCTIONSINTEL 8085 DATA FORMAT AND INSTRUCTIONS
INTEL 8085 DATA FORMAT AND INSTRUCTIONS
 
Assembly language programs 2
Assembly language programs 2Assembly language programs 2
Assembly language programs 2
 
15CS44 MP & MC Module 2
15CS44 MP & MC Module  215CS44 MP & MC Module  2
15CS44 MP & MC Module 2
 
5.pptx
5.pptx5.pptx
5.pptx
 
Ecet 330 final exam new 2016
Ecet 330 final exam new 2016Ecet 330 final exam new 2016
Ecet 330 final exam new 2016
 
Ecet 330 final exam new 2016
Ecet 330 final exam new 2016Ecet 330 final exam new 2016
Ecet 330 final exam new 2016
 
Ecet 330 final exam new 2016
Ecet 330 final exam new 2016Ecet 330 final exam new 2016
Ecet 330 final exam new 2016
 
Embedded system (Chapter 2) part 2
Embedded system (Chapter 2) part 2Embedded system (Chapter 2) part 2
Embedded system (Chapter 2) part 2
 
Instruction set of 8086
Instruction set of 8086Instruction set of 8086
Instruction set of 8086
 
Basic programming of 8085
Basic programming of 8085 Basic programming of 8085
Basic programming of 8085
 
Real Time Embedded System
Real Time Embedded SystemReal Time Embedded System
Real Time Embedded System
 
Chp6 assembly language programming for pic copy
Chp6 assembly language programming for pic   copyChp6 assembly language programming for pic   copy
Chp6 assembly language programming for pic copy
 
Microprocessor lab manual
Microprocessor lab manualMicroprocessor lab manual
Microprocessor lab manual
 

More from MOHIT AGARWAL

Firewalls and packet filters
Firewalls and packet filtersFirewalls and packet filters
Firewalls and packet filters
MOHIT AGARWAL
 
Abstract Class & Abstract Method in Core Java
Abstract Class & Abstract Method in Core JavaAbstract Class & Abstract Method in Core Java
Abstract Class & Abstract Method in Core Java
MOHIT AGARWAL
 
Distance Vector & Link state Routing Algorithm
Distance Vector & Link state Routing AlgorithmDistance Vector & Link state Routing Algorithm
Distance Vector & Link state Routing Algorithm
MOHIT AGARWAL
 
Static Data Members and Member Functions
Static Data Members and Member FunctionsStatic Data Members and Member Functions
Static Data Members and Member Functions
MOHIT AGARWAL
 
Modes Of Transfer in Input/Output Organization
Modes Of Transfer in Input/Output OrganizationModes Of Transfer in Input/Output Organization
Modes Of Transfer in Input/Output Organization
MOHIT AGARWAL
 
Critical Section in Operating System
Critical Section in Operating SystemCritical Section in Operating System
Critical Section in Operating System
MOHIT AGARWAL
 
Newton raphson method
Newton raphson methodNewton raphson method
Newton raphson method
MOHIT AGARWAL
 
Communication with Artificial intelligence
Communication with Artificial intelligenceCommunication with Artificial intelligence
Communication with Artificial intelligence
MOHIT AGARWAL
 

More from MOHIT AGARWAL (8)

Firewalls and packet filters
Firewalls and packet filtersFirewalls and packet filters
Firewalls and packet filters
 
Abstract Class & Abstract Method in Core Java
Abstract Class & Abstract Method in Core JavaAbstract Class & Abstract Method in Core Java
Abstract Class & Abstract Method in Core Java
 
Distance Vector & Link state Routing Algorithm
Distance Vector & Link state Routing AlgorithmDistance Vector & Link state Routing Algorithm
Distance Vector & Link state Routing Algorithm
 
Static Data Members and Member Functions
Static Data Members and Member FunctionsStatic Data Members and Member Functions
Static Data Members and Member Functions
 
Modes Of Transfer in Input/Output Organization
Modes Of Transfer in Input/Output OrganizationModes Of Transfer in Input/Output Organization
Modes Of Transfer in Input/Output Organization
 
Critical Section in Operating System
Critical Section in Operating SystemCritical Section in Operating System
Critical Section in Operating System
 
Newton raphson method
Newton raphson methodNewton raphson method
Newton raphson method
 
Communication with Artificial intelligence
Communication with Artificial intelligenceCommunication with Artificial intelligence
Communication with Artificial intelligence
 

Recently uploaded

14 Template Contractual Notice - EOT Application
14 Template Contractual Notice - EOT Application14 Template Contractual Notice - EOT Application
14 Template Contractual Notice - EOT Application
SyedAbiiAzazi1
 
Properties Railway Sleepers and Test.pptx
Properties Railway Sleepers and Test.pptxProperties Railway Sleepers and Test.pptx
Properties Railway Sleepers and Test.pptx
MDSABBIROJJAMANPAYEL
 
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
IJECEIAES
 
basic-wireline-operations-course-mahmoud-f-radwan.pdf
basic-wireline-operations-course-mahmoud-f-radwan.pdfbasic-wireline-operations-course-mahmoud-f-radwan.pdf
basic-wireline-operations-course-mahmoud-f-radwan.pdf
NidhalKahouli2
 
Swimming pool mechanical components design.pptx
Swimming pool  mechanical components design.pptxSwimming pool  mechanical components design.pptx
Swimming pool mechanical components design.pptx
yokeleetan1
 
6th International Conference on Machine Learning & Applications (CMLA 2024)
6th International Conference on Machine Learning & Applications (CMLA 2024)6th International Conference on Machine Learning & Applications (CMLA 2024)
6th International Conference on Machine Learning & Applications (CMLA 2024)
ClaraZara1
 
Technical Drawings introduction to drawing of prisms
Technical Drawings introduction to drawing of prismsTechnical Drawings introduction to drawing of prisms
Technical Drawings introduction to drawing of prisms
heavyhaig
 
ACEP Magazine edition 4th launched on 05.06.2024
ACEP Magazine edition 4th launched on 05.06.2024ACEP Magazine edition 4th launched on 05.06.2024
ACEP Magazine edition 4th launched on 05.06.2024
Rahul
 
CHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECT
CHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECTCHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECT
CHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECT
jpsjournal1
 
132/33KV substation case study Presentation
132/33KV substation case study Presentation132/33KV substation case study Presentation
132/33KV substation case study Presentation
kandramariana6
 
Iron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdf
Iron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdfIron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdf
Iron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdf
RadiNasr
 
sieving analysis and results interpretation
sieving analysis and results interpretationsieving analysis and results interpretation
sieving analysis and results interpretation
ssuser36d3051
 
spirit beverages ppt without graphics.pptx
spirit beverages ppt without graphics.pptxspirit beverages ppt without graphics.pptx
spirit beverages ppt without graphics.pptx
Madan Karki
 
Question paper of renewable energy sources
Question paper of renewable energy sourcesQuestion paper of renewable energy sources
Question paper of renewable energy sources
mahammadsalmanmech
 
2. Operations Strategy in a Global Environment.ppt
2. Operations Strategy in a Global Environment.ppt2. Operations Strategy in a Global Environment.ppt
2. Operations Strategy in a Global Environment.ppt
PuktoonEngr
 
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressionsKuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
Victor Morales
 
[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf
[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf
[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf
awadeshbabu
 
Presentation of IEEE Slovenia CIS (Computational Intelligence Society) Chapte...
Presentation of IEEE Slovenia CIS (Computational Intelligence Society) Chapte...Presentation of IEEE Slovenia CIS (Computational Intelligence Society) Chapte...
Presentation of IEEE Slovenia CIS (Computational Intelligence Society) Chapte...
University of Maribor
 
bank management system in java and mysql report1.pdf
bank management system in java and mysql report1.pdfbank management system in java and mysql report1.pdf
bank management system in java and mysql report1.pdf
Divyam548318
 
Harnessing WebAssembly for Real-time Stateless Streaming Pipelines
Harnessing WebAssembly for Real-time Stateless Streaming PipelinesHarnessing WebAssembly for Real-time Stateless Streaming Pipelines
Harnessing WebAssembly for Real-time Stateless Streaming Pipelines
Christina Lin
 

Recently uploaded (20)

14 Template Contractual Notice - EOT Application
14 Template Contractual Notice - EOT Application14 Template Contractual Notice - EOT Application
14 Template Contractual Notice - EOT Application
 
Properties Railway Sleepers and Test.pptx
Properties Railway Sleepers and Test.pptxProperties Railway Sleepers and Test.pptx
Properties Railway Sleepers and Test.pptx
 
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
 
basic-wireline-operations-course-mahmoud-f-radwan.pdf
basic-wireline-operations-course-mahmoud-f-radwan.pdfbasic-wireline-operations-course-mahmoud-f-radwan.pdf
basic-wireline-operations-course-mahmoud-f-radwan.pdf
 
Swimming pool mechanical components design.pptx
Swimming pool  mechanical components design.pptxSwimming pool  mechanical components design.pptx
Swimming pool mechanical components design.pptx
 
6th International Conference on Machine Learning & Applications (CMLA 2024)
6th International Conference on Machine Learning & Applications (CMLA 2024)6th International Conference on Machine Learning & Applications (CMLA 2024)
6th International Conference on Machine Learning & Applications (CMLA 2024)
 
Technical Drawings introduction to drawing of prisms
Technical Drawings introduction to drawing of prismsTechnical Drawings introduction to drawing of prisms
Technical Drawings introduction to drawing of prisms
 
ACEP Magazine edition 4th launched on 05.06.2024
ACEP Magazine edition 4th launched on 05.06.2024ACEP Magazine edition 4th launched on 05.06.2024
ACEP Magazine edition 4th launched on 05.06.2024
 
CHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECT
CHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECTCHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECT
CHINA’S GEO-ECONOMIC OUTREACH IN CENTRAL ASIAN COUNTRIES AND FUTURE PROSPECT
 
132/33KV substation case study Presentation
132/33KV substation case study Presentation132/33KV substation case study Presentation
132/33KV substation case study Presentation
 
Iron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdf
Iron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdfIron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdf
Iron and Steel Technology Roadmap - Towards more sustainable steelmaking.pdf
 
sieving analysis and results interpretation
sieving analysis and results interpretationsieving analysis and results interpretation
sieving analysis and results interpretation
 
spirit beverages ppt without graphics.pptx
spirit beverages ppt without graphics.pptxspirit beverages ppt without graphics.pptx
spirit beverages ppt without graphics.pptx
 
Question paper of renewable energy sources
Question paper of renewable energy sourcesQuestion paper of renewable energy sources
Question paper of renewable energy sources
 
2. Operations Strategy in a Global Environment.ppt
2. Operations Strategy in a Global Environment.ppt2. Operations Strategy in a Global Environment.ppt
2. Operations Strategy in a Global Environment.ppt
 
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressionsKuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
KuberTENes Birthday Bash Guadalajara - K8sGPT first impressions
 
[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf
[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf
[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf
 
Presentation of IEEE Slovenia CIS (Computational Intelligence Society) Chapte...
Presentation of IEEE Slovenia CIS (Computational Intelligence Society) Chapte...Presentation of IEEE Slovenia CIS (Computational Intelligence Society) Chapte...
Presentation of IEEE Slovenia CIS (Computational Intelligence Society) Chapte...
 
bank management system in java and mysql report1.pdf
bank management system in java and mysql report1.pdfbank management system in java and mysql report1.pdf
bank management system in java and mysql report1.pdf
 
Harnessing WebAssembly for Real-time Stateless Streaming Pipelines
Harnessing WebAssembly for Real-time Stateless Streaming PipelinesHarnessing WebAssembly for Real-time Stateless Streaming Pipelines
Harnessing WebAssembly for Real-time Stateless Streaming Pipelines
 

Code Conversion in 8085 Microprocessor

  • 1. MADE BY MOHIT AGARWAL – (161080107026) 5TH SEM COMPUTER
  • 2. Code conversion allows user to translate a number that is representated using one coding system to other coding system. The code conversion involves operations like : 1) Binary to BCD 2) BCD to Binary 3) BCD to Hex 4) Hex to BCD 5) BCD to Seven Segment 6) Binary to ASCII 7) ASCII to Binary
  • 3. The microprocessor understands the binary/hex number system. To convert BCD number into its binary equivalent we need to use the principle of positional weighting in a given number. EXAMPLE : (2 Digit BCD to Binary) 60 = 6 x 0A H + 0 60 = 3C H + 0 60 = 3C H
  • 4. LDA 2200H : Get the BCD number MOV B, A : Save it ANI OFH : Mask most significant four bits MOV C, A : Save unpacked BCD 1 in C register MOV A, B : Get BCD again ANI FOH : Mask least significant four bits RRC : Convert most significant four bits into unpacked BCD 2 RRC RRC RRC MOV B, A : Save unpacked BCD 2 in B register XRA A : Clear accumulator (sum = 0) MVI D, 0AH : Set D as a multiplier of 10 SUM:ADD D : Add 10 until (B) = 0 DCR B : Decrement BCD2 by one JNZ SUM : Is multiplication complete? If not, go back and add again ADD C : Add BCD 1 STA 2300H : Store the result HLT : Terminate program execution INPUT : 2200 H : 60 H OUTPUT : 2300 H : 3C H
  • 5. The microprocessor processes data in binary form but data that is displayed is in BCD form. Hence, we require to convert the Binary data to BCD. The series of operations to be performed is represented here using a flowchart.
  • 6. Source Program: LXI SP, 27FFH : Initialize stack pointer LDA 6000H : Get the binary number in accumulator CALL SUBROUTINE : Call subroutine HLT : Terminate program execution Subroutine to convert binary number into its equivalent BCD number: PUSH B : Save BC register pair contents PUSH D : Save DE register pair contents MVI B, 64H : Load divisor decimal 100 in B register MVI C, 0AH : Load divisor decimal 10 in C register MVI D, 00H : Initialize Digit 1 MVI E, 00H : Initialize Digit 2
  • 7. STEP1:CMP B : Check if number < Decimal 100 JC STEP 2 : if yes go to step 2 SUB B : Subtract decimal 100 INR E : update quotient JMP STEP 1 : go to step 1 STEP2:CMP C : Check if number < Decimal 10 JC STEP 3 : if yes go to step 3 SUB C : Subtract decimal 10 INR D : Update quotient JMP STEP 2 : Continue division by 10 STEP3:STA 6100H : Store Digit 0 MOV A, D : Get Digit 1 STA 6101H : Store Digit 1 MOV A, E : Get Digit 2 STA 6102H : Store Digit 2 POP D : Restore DE register pair POP B : Restore BC register pair RET : Return to main program INPUT : 3040 H : 8A H OUTPUT : 3041 H : 08 H 3042 H : 03 H 3043 H : 01 H
  • 8. The ASCII (American Standard Code for Information Interchange) is used for communication purposes. Hence, it is necessary to convert Binary number to its ASCII equivalent.
  • 9. Source program: LXI SP, 27FFH : Initialize stack pointer LXI H, 2000H : Source memory pointer LXI D, 2200H : Destination memory pointer MVI C, O5H : Initialize the counter BACK: MOV A, M : Get the number CALL ASCII : Call subroutine ASCII STAX D : Store result INX H : Increment source memory pointer INX D : Increment destination memory pointer DCR C : Decrement count by 1 CJNZ : If not zero, repeat HLT : Stop program execution a
  • 10. Subroutine ASCII: ASCII:CPI, OAH : Check if number is OAR JNC NEXT : If yes go to next otherwise continue ADI 30H JMP LAST NEXT:ADI 37H LAST:RET : Return to main program INPUT : (2000H) = 1 (2001H) = 2 (2002H) = 9 (2003H) = A (2004H) = B OUTPUT : (2200H) = 31 (2201H) = 32 (2202H) = 39 (2203H) = 41 (2204H) = 42
  • 11. Steps for ASCII to Binary code conversion : If ASCII code is less than 3A H then 30 H is subtracted from the number to get its Binary Equivalent. If the number is between 41 H and 5A H then 37 H is subtracted to get the binary equivalent of the letter A-F. EX: 41 H (ASCII) = 41 H - 37 H = 04 H (BINARY)
  • 12. Steps for BCD to HEX code conversion : 1) We get the value from the user. 2) Then we take the Most Significant Digit (MSD). 3) We multiply MSD by 10, using repeated addition. 4) Then we add the Least Significant Digit (LSD) to the result obtained in previous step. 5) And finally the value is stored in the next memory location.
  • 13. LXI H,0030H : Get the BCD number MOV A,M : Initialize the memory Pointer ADD A : Value in accumulator is doubled MOV B,A : Value in accumulator is moved to register B ADD A : Value in accumulator is doubled again ADD A : Value in accumulator is doubled again ADD B : Value in Register B is added to accumulator (A is 10 x MSD of the BCD stored at 0030H) INX H : Point to LSD ADD M : LSD is added to accumulator INX H Next location is pointed MOV M,A : Value obtained is stored here HLT : Terminate the program INPUT : 0030 H : 02 H 0031 H : 09 H OUTPUT : 0032 H : 1D H
  • 14. Steps for HEX to BCD code conversion : 1) We get the HEX number from user. 2) Then shift the hexadecimal number to C register. 3) We perform repeated addition for C number of times. 4) And adjust for BCD count in each step. 5) Now the BCD value obtained is stored in memory.
  • 15. LXI H,0030H : Get the HEX number MOV C,M : Shift the number to C register LOOP1: ADI 01H : Start a loop of repeated addition for C times DAA : Adjust for BCD count JNC LOOP2 : Start another loop for Higher order number INR D LOOP2: DCR C : Decrease C till it reaches Zero JNZ LOOP1 STA 0051H : Store the Lower order here MOV A,D : Move the Higher order value to accumulator STA 0050H : Store the Higher order here HLT INPUT : 0030 H : 1D H OUTPUT : 0050 H : 02 H 0051 H : 09 H
  • 16. • The seven segment LCD display is used for displaying the results in a microprocessor based system. • In such cases we need to convert the results in the seven segment code. • Such conversion can be obtained with a look-up table. 0 3F 1 06 2 5B 3 4F 4 66 5 6D 6 7D 7 07 8 7F 9 6F
  • 17. LXI H, 6200H : Initialize lookup table pointer LXI D, 6000H : Initialize source memory pointer LXI B, 7000H : Initialize destination memory pointer BACK: LDAX D : Get the number MOV L, A : A point to the 7-segment code MOV A, M : Get the 7-segment code STAX B : Store the result at destination memory location INX D : Increment source memory pointer INX B : Increment destination memory pointer MOV A, C CPI O5H : Check for last number JNZ BACK : If not repeat HLT : End of program

Editor's Notes

  1. You can use this slide as your opening or closing slide. Should you choose to use it as a closing, make sure you review the main points of your presentation. One creative way to do that is by adding animations to the various graphics on a slide. This slide has 4 different graphics, and, when you view the slideshow, you will see that you can click to reveal the next graphic. Similarly, as you review the main topics in your presentation, you may want each point to show up when you are addressing that topic. Add animation to images and graphics: Select your image or graphic. Click on the Animations tab. Choose from the options. The animation for this slide is “Split”. The drop-down menu in the Animation section gives even more animations you can use. If you have multiple graphics or images, you will see a number appear next to it that notes the order of the animations. Note: You will want to choose the animations carefully. You do not want to make your audience dizzy from your presentation.