Home »
Embedded Systems
Convert an 8-bit Number to Gray Code in 8086 Microprocessor
In this tutorial, we will learn how to convert an 8-bit number to Gray code in 8086 Microprocessor?
By Diksha Tewari Last updated : May 22, 2023
Problem Statement
To convert 8 bits number into Gray Code using 8086 Microprocessors.
Algorithm
- Move the value at register AL.
- Move the content of AL into register BL.
- Logical shift right AL one time.
- Perform XOR with initial value of input.
- Now load the result value from BL in memory location.
8086 program to convert 8-bit number to Gray code
MOV AL, [2050]
MOV BL, AL
SHR AL, 01
XOR BL, AL
MOV [3050], BL
HLT
Observation
INPUT:
2050:73
OUTPUT:
3050:4A
Hence, we successfully converted 8-bit number into gray code.