In: Electrical Engineering
write a assembly language program to convert GRAY to BCD code in 8051
An assembly language program to convert gray code in to binary code.
CODE
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
RESULT:
C600 57 ; Gray number(Input data)
C601 65 ; Binary number(Output data)
CONCLUSION:
Thank you sir/madam