Home » Embedded Systems

Convert an 8 bits number into its Gray number | 8086 Microprocessor

Here, we are going to learn how to convert an 8 bits number into its Gray number using assembly language in 8086 microprocessor?
Submitted by Diksha Tewari, on October 30, 2018

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.

Program:

    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 bits number into gray number.






Comments and Discussions

Ad: Are you a blogger? Join our Blogging forum.
Learn PCB Designing: PCB DESIGNING TUTORIAL




Languages: » C » C++ » C++ STL » Java » Data Structure » C#.Net » Android » Kotlin » SQL
Web Technologies: » PHP » Python » JavaScript » CSS » Ajax » Node.js » Web programming/HTML
Solved programs: » C » C++ » DS » Java » C#
Aptitude que. & ans.: » C » C++ » Java » DBMS
Interview que. & ans.: » C » Embedded C » Java » SEO » HR
CS Subjects: » CS Basics » O.S. » Networks » DBMS » Embedded Systems » Cloud Computing
» Machine learning » CS Organizations » Linux » DOS
More: » Articles » Puzzles » News/Updates


© https://www.includehelp.com some rights reserved.