Question

In: Electrical Engineering

write a assembly language program to convert GRAY to BCD code in 8051

write a assembly language program to convert GRAY to BCD code in 8051

Solutions

Expert Solution

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


Related Solutions

Write an assembly language program for 8051 microcontroller to find the sum of the following series,...
Write an assembly language program for 8051 microcontroller to find the sum of the following series, 1, -2, +3, -4, +5, -6,..., up to 100 terms. Store lower byte in R0 and higher byte in R1.
Write an 8051-assembly language program for the interfacing of ADC0804 and LM35 to display the room...
Write an 8051-assembly language program for the interfacing of ADC0804 and LM35 to display the room temperature on 16x2 LCD (10marks) please note that the program should be interfacing with ADC0804.
Convert the following pep/9 machine language program into an assembly code. Determine the output of this...
Convert the following pep/9 machine language program into an assembly code. Determine the output of this program if the input is ‘tab’. The left column is the memory address of the first byte on the line: 0000 D1FC15 0003 F1001F 0006 D1FC15 0009 F10020 000C D1FC15 000F F10021 0012 D10020 0015 F1FC16 0018 D1001F 001B F1FC16 001E 00
write a program for the microcontroller-msp430fr6989 using code composer studio not assembly language. write a code...
write a program for the microcontroller-msp430fr6989 using code composer studio not assembly language. write a code that transmits a single character and lights the red LED upon receiving that character. The board will "talk" to itself. The green LED should turn on whenever a message is sent and the LCD will display the message being received.
Write a program in MIPS assembly language to convert an ASCII number string containing positive and...
Write a program in MIPS assembly language to convert an ASCII number string containing positive and negative integer decimal strings, to an integer. Your program should expect register $a0 to hold the address of a nullterminated string containing some combination of the digits 0 through 9. Your program should compute the integer value equivalent to this string of digits, then place the number in register $v0. If a non-digit character appears anywhere in the string, your program should stop with...
Write an assembly language program code to clear and set bit 7th and 19th in a...
Write an assembly language program code to clear and set bit 7th and 19th in a 32-bit variable called N.
HCS12 Assembly Language: 1. Write a program to convert a decimal number stored at memory location...
HCS12 Assembly Language: 1. Write a program to convert a decimal number stored at memory location $1010 into a binary number. Store the result in memory location $2000
Write a MIPS Assembly Language program which runs interactively to convert between decimal, binary, and hexadecimal....
Write a MIPS Assembly Language program which runs interactively to convert between decimal, binary, and hexadecimal. 1. Request input data type. 2. Request input data. 3. Request output data type. 4. Output the data. Use any algorithm
**Add comments to existing ARM code to explain steps** Write an ARM assembly program to convert...
**Add comments to existing ARM code to explain steps** Write an ARM assembly program to convert temperatures from Celsius to Fahrenheit or from Fahrenheit to Celsius. Here are the two formulas for your reference. Use variable to read and store values. C= 5* (F - 32) / 9 F = (9 * C / 5 ) + 32 My code below: TempConvert.s LDR R8,=temperature LDR R1,[R8] LDR R8,=unit LDRB R2,[R8] LDR R8,=celsius LDRB R3,[R8] LDR R8,=fahrenheit LDRB R4,[R8] MOV R6,#9...
**Add comments to ARM code to explain steps** Write an ARM assembly program to convert temperatures...
**Add comments to ARM code to explain steps** Write an ARM assembly program to convert temperatures from Celsius to Fahrenheit or from Fahrenheit to Celsius. Here are the two formulas for your reference. Use variable to read and store values. C= 5* (F - 32) / 9 F = (9 * C / 5 ) + 32 TempConvert.s LDR R8,=temperature LDR R1,[R8] LDR R8,=unit LDRB R2,[R8] LDR R8,=celsius LDRB R3,[R8] LDR R8,=fahrenheit LDRB R4,[R8] MOV R6,#9 MOV R7,#5 ;----C =...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT