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

  1. Move the value at register AL.
  2. Move the content of AL into register BL.
  3. Logical shift right AL one time.
  4. Perform XOR with initial value of input.
  5. 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.




Comments and Discussions!

Load comments ↻





Copyright © 2024 www.includehelp.com. All rights reserved.