Post on 31-Jan-2018
8085 MICROPROCESSOR PROGRAMMING Rev. 1.0
Page #1
This work is licensed under the Creative Commons Attribution-NonCommercial-Share Alike 2.5 India License. To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/2.5/in/deed.en or send a letter to Creative Commons, 171 Second Street, Suite 300, San Francisco, California, 94105, USA.
8085 MICROPROCESSOR PROGRAMMING Rev. 1.0
Page #2
Gray to binary code conversion
AIM To write an assembly language program to convert gray code in
to binary code
ASSEMBLY LANGUAGE PROGRAM
C300 MVI D 07 16 ; Move immediate data 07H to D register
C301 07 ;
C302 LXI H C600 21 ; Initialize the HL register pair
C303 00 ;
C304 C6 ;
C305 MOV B M 46 ; Move the memory content to B register
C306 MOV A B 78 ; Move the B register content to accumulator
C307 MVI C 00 0E ; Move immediate data 00H in to C register
C308 00 ;
C309 RAR 1F ; Rotate accumulator right
C30A XRA B A8 ; Exclusively OR the content of B register
C30B MOV B A 47 ; Move the accumulator content to B register
C30C DCR D 15 ; Decrement the D register
C30D JNZ C307 C2 ; Jump if no zero to C307H
C30E 07 ;
C30F C3 ;
C310 INX H 23 ; Increment the HL register pair
C311 MOV M A 77 ; Move the accumulator content to the memory
C312 HLT 76 ; Halt the execution
EXECUTION 1
C600 4B ; Gray number(Input data)
C601 72 ; Binary number(Output data)
8085 MICROPROCESSOR PROGRAMMING Rev. 1.0
Page #3
PROGRAM TRACE
8085 MICROPROCESSOR PROGRAMMING Rev. 1.0
Page #4
FLAG WORD
EXECUTION 2
C600 57 ; Gray number(Input data)
C601 65 ; Binary number(Output data)
PROGRAM TRACE
8085 MICROPROCESSOR PROGRAMMING Rev. 1.0
Page #5
FLAG WORD
EXECUTION 3
C600 FE ; Gray number(Input data)
C601 AB ; Binary number(Output data)
8085 MICROPROCESSOR PROGRAMMING Rev. 1.0
Page #6
PROGRAM TRACE
8085 MICROPROCESSOR PROGRAMMING Rev. 1.0
Page #7
FLAG WORD
EXECUTION 4
C600 80 ; Gray number(Input data)
C601 FF ; Binary number(Output data)
PROGRAM TRACE
8085 MICROPROCESSOR PROGRAMMING Rev. 1.0
Page #8
FLAG WORD
EXECUTION 5
C600 BB ; Gray number(Input data)
C601 D2 ; Binary number(Output data)
8085 MICROPROCESSOR PROGRAMMING Rev. 1.0
Page #9
PROGRAM TRACE
8085 MICROPROCESSOR PROGRAMMING Rev. 1.0
Page #10
FLAG WORD
REFERENCE
1. Ramesh S.Gaonkar, “Microprocessor Architecture, Programming, and Applications”, Fourth Edition, Penram International
Publishing (India), 2000.
2. S.Subathra, “Microprocessor Laboratory”, Record work,
Adhiparashakthi Engineering College, Melmaruvathur, March
2001
3. S.Subathra, “Programming in 8085 Microprocessor and its
applications – An Innovative Analysis”, Technical Report,
Adhiparashakthi Engineering College, Melmaruvathur, March
2003
4. Micro-85 EB, User Manual, Version – 3.0, CAT #M85 EB-002, VI Microsystems Pvt. Ltd., Chennai.
5. icro85 simulation software, Infotech Solutions, Calcutta.