SlideShare a Scribd company logo
1 of 18
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-instruction-set-ppt
 8086-instruction-set-ppt 8086-instruction-set-ppt
8086-instruction-set-pptjemimajerome
 
Microprocessor 8085 complete
Microprocessor 8085 completeMicroprocessor 8085 complete
Microprocessor 8085 completeShubham Singh
 
Architecture of 8085 microprocessor
Architecture of 8085 microprocessorArchitecture of 8085 microprocessor
Architecture of 8085 microprocessorAMAN SRIVASTAVA
 
Memory organization of 8051
Memory organization of 8051Memory organization of 8051
Memory organization of 8051Muthu Manickam
 
8085 interfacing with memory chips
8085 interfacing with memory chips8085 interfacing with memory chips
8085 interfacing with memory chipsSrikrishna Thota
 
Computer instructions
Computer instructionsComputer instructions
Computer instructionsAnuj Modi
 
Interfacing memory with 8086 microprocessor
Interfacing memory with 8086 microprocessorInterfacing memory with 8086 microprocessor
Interfacing memory with 8086 microprocessorVikas Gupta
 
Chapter 1 microprocessor introduction
Chapter 1 microprocessor introductionChapter 1 microprocessor introduction
Chapter 1 microprocessor introductionShubham Singh
 
8237 dma controller
8237 dma controller8237 dma controller
8237 dma controllerTech_MX
 
Architecture of 8051
Architecture of 8051Architecture of 8051
Architecture of 8051hello_priti
 
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 setSaumitra Rukmangad
 
PIC MICROCONTROLLERS -CLASS NOTES
PIC MICROCONTROLLERS -CLASS NOTESPIC MICROCONTROLLERS -CLASS NOTES
PIC MICROCONTROLLERS -CLASS NOTESDr.YNM
 
Addressing modes 8085
Addressing modes 8085Addressing modes 8085
Addressing modes 8085ShivamSood22
 
Microprocessor vs. microcontroller
Microprocessor vs. microcontrollerMicroprocessor vs. microcontroller
Microprocessor vs. microcontrolleraviban
 
Arithmetic & logical operations in 8051
Arithmetic & logical operations in 8051Arithmetic & logical operations in 8051
Arithmetic & logical operations in 8051Jay Patel
 

What's hot (20)

8086-instruction-set-ppt
 8086-instruction-set-ppt 8086-instruction-set-ppt
8086-instruction-set-ppt
 
Microprocessor 8085 complete
Microprocessor 8085 completeMicroprocessor 8085 complete
Microprocessor 8085 complete
 
Architecture of 8085 microprocessor
Architecture of 8085 microprocessorArchitecture of 8085 microprocessor
Architecture of 8085 microprocessor
 
8085 alp programs
8085 alp programs8085 alp programs
8085 alp programs
 
Memory organization of 8051
Memory organization of 8051Memory organization of 8051
Memory organization of 8051
 
8051 instruction set
8051 instruction set8051 instruction set
8051 instruction set
 
8085 interfacing with memory chips
8085 interfacing with memory chips8085 interfacing with memory chips
8085 interfacing with memory chips
 
Computer instructions
Computer instructionsComputer instructions
Computer instructions
 
Pin diagram 8085
Pin diagram 8085 Pin diagram 8085
Pin diagram 8085
 
Timing diagram 8085 microprocessor
Timing diagram 8085 microprocessorTiming diagram 8085 microprocessor
Timing diagram 8085 microprocessor
 
Interfacing memory with 8086 microprocessor
Interfacing memory with 8086 microprocessorInterfacing memory with 8086 microprocessor
Interfacing memory with 8086 microprocessor
 
Chapter 1 microprocessor introduction
Chapter 1 microprocessor introductionChapter 1 microprocessor introduction
Chapter 1 microprocessor introduction
 
8237 dma controller
8237 dma controller8237 dma controller
8237 dma controller
 
Architecture of 8051
Architecture of 8051Architecture of 8051
Architecture of 8051
 
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
 
PIC MICROCONTROLLERS -CLASS NOTES
PIC MICROCONTROLLERS -CLASS NOTESPIC MICROCONTROLLERS -CLASS NOTES
PIC MICROCONTROLLERS -CLASS NOTES
 
Addressing modes 8085
Addressing modes 8085Addressing modes 8085
Addressing modes 8085
 
Microprocessor vs. microcontroller
Microprocessor vs. microcontrollerMicroprocessor vs. microcontroller
Microprocessor vs. microcontroller
 
Addressing sequencing
Addressing sequencingAddressing sequencing
Addressing sequencing
 
Arithmetic & logical operations in 8051
Arithmetic & logical operations in 8051Arithmetic & logical operations in 8051
Arithmetic & logical operations in 8051
 

Similar to Code Conversion in 8085 Microprocessor

Microprocessor Part 3
Microprocessor    Part  3Microprocessor    Part  3
Microprocessor Part 3Sajan Agrawal
 
8085 Assembly language programs.pdf
8085 Assembly language programs.pdf8085 Assembly language programs.pdf
8085 Assembly language programs.pdfRahulMishra122561
 
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 Instructionscmkandemir
 
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 :PJathin Kanumuri
 
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-2Jathin Kanumuri
 
INTEL 8085 DATA FORMAT AND INSTRUCTIONS
INTEL 8085 DATA FORMAT AND INSTRUCTIONSINTEL 8085 DATA FORMAT AND INSTRUCTIONS
INTEL 8085 DATA FORMAT AND INSTRUCTIONSSwapnil Mishra
 
Chapter 3 instruction set-of-8085
Chapter 3 instruction set-of-8085Chapter 3 instruction set-of-8085
Chapter 3 instruction set-of-8085Shubham Singh
 
Assembly language programs 2
Assembly language programs 2Assembly language programs 2
Assembly language programs 2HarshitParkar6677
 
15CS44 MP & MC Module 2
15CS44 MP & MC Module  215CS44 MP & MC Module  2
15CS44 MP & MC Module 2RLJIT
 
Ecet 330 final exam new 2016
Ecet 330 final exam new 2016Ecet 330 final exam new 2016
Ecet 330 final exam new 2016sergejsvolkovs10
 
Ecet 330 final exam new 2016
Ecet 330 final exam new 2016Ecet 330 final exam new 2016
Ecet 330 final exam new 2016powellabril
 
Ecet 330 final exam new 2016
Ecet 330 final exam new 2016Ecet 330 final exam new 2016
Ecet 330 final exam new 2016powellabril
 
Embedded system (Chapter 2) part 2
Embedded system (Chapter 2) part 2Embedded system (Chapter 2) part 2
Embedded system (Chapter 2) part 2Ikhwan_Fakrudin
 
Basic programming of 8085
Basic programming of 8085 Basic programming of 8085
Basic programming of 8085 vijaydeepakg
 
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 copymkazree
 
8085 Assembly programming.pptx
8085 Assembly programming.pptx8085 Assembly programming.pptx
8085 Assembly programming.pptxbansidhar11
 

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
 
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
 
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
 
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
 
8085 Assembly programming.pptx
8085 Assembly programming.pptx8085 Assembly programming.pptx
8085 Assembly programming.pptx
 

More from MOHIT AGARWAL

Firewalls and packet filters
Firewalls and packet filtersFirewalls and packet filters
Firewalls and packet filtersMOHIT 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 JavaMOHIT AGARWAL
 
Distance Vector & Link state Routing Algorithm
Distance Vector & Link state Routing AlgorithmDistance Vector & Link state Routing Algorithm
Distance Vector & Link state Routing AlgorithmMOHIT AGARWAL
 
Static Data Members and Member Functions
Static Data Members and Member FunctionsStatic Data Members and Member Functions
Static Data Members and Member FunctionsMOHIT 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 OrganizationMOHIT AGARWAL
 
Critical Section in Operating System
Critical Section in Operating SystemCritical Section in Operating System
Critical Section in Operating SystemMOHIT AGARWAL
 
Newton raphson method
Newton raphson methodNewton raphson method
Newton raphson methodMOHIT AGARWAL
 
Communication with Artificial intelligence
Communication with Artificial intelligenceCommunication with Artificial intelligence
Communication with Artificial intelligenceMOHIT 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

Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Dr.Costas Sachpazis
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )Tsuyoshi Horigome
 
Heart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxHeart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxPoojaBan
 
main PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidmain PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidNikhilNagaraju
 
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝soniya singh
 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130Suhani Kapoor
 
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfCCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfAsst.prof M.Gokilavani
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxJoão Esperancinha
 
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionSachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionDr.Costas Sachpazis
 
Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.eptoze12
 
power system scada applications and uses
power system scada applications and usespower system scada applications and uses
power system scada applications and usesDevarapalliHaritha
 
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escortsranjana rawat
 
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerStudy on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerAnamika Sarkar
 
Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...VICTOR MAESTRE RAMIREZ
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024hassan khalil
 
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfCCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfAsst.prof M.Gokilavani
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...Soham Mondal
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 

Recently uploaded (20)

Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )
 
Heart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxHeart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptx
 
main PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidmain PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfid
 
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
 
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdfCCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
CCS355 Neural Network & Deep Learning Unit II Notes with Question bank .pdf
 
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
 
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionSachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
 
Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.
 
power system scada applications and uses
power system scada applications and usespower system scada applications and uses
power system scada applications and uses
 
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
 
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerStudy on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
 
Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...
 
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Serviceyoung call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
young call girls in Rajiv Chowk🔝 9953056974 🔝 Delhi escort Service
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024
 
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfCCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
 
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
 

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.