PROGRAM NO.10
OBJECT:Write a program to find Gray Code Equivalent of a binary number using Lookup Table.
INSTRUMENT REQUIRED: 8086 Microprocessor Trainer Kit.
PROGRAM:
MEMORY LOCATION | MACHINE CODE | OPCODE | OPERAND |
0202 | BB 00 03 | MOV | BX,0300H |
0205 | BE 00 02 | MOV | SI,0200H |
0208 | AC | LOD SB | |
0209 | D7 | XLAT | |
020A | 88 04 | MOV | [SI],AL |
020C | F4 | HLT |
DESCRIPTION:
To solve the given objective we have taken a binary number (its hexadecimal equivalent) in the memory location 0200H and left the memory location of 0201H and 0201H empty with 00. Then we have taken a lookup table to check for the gray code equivalent of the input binary number. The lookup table being stored from memory location of 0300H to 030FH.
To solve the given objective we have taken the following steps:
- Move the first gray code number from the lookup table into the BX registe
- Move the source index (SI) pointer to point to the memory location of the input binary number (its hexadecimal equivalent).
- Then the string byte is loaded from the lookup table and translated from gray to binary number.
- Move the source index pointer to point to the memory location where the gray equivalent number is to be stored, i.e. AL.
INPUT:
LOCATION | SPECIFICATION | VALUE STORED |
0200H 0201H | NUMBER INPUT(BINARY)) NUMBER OUTPUT(GRAY CODE) | 0A 00 |
LOOKUP TABLE:-
MEMORY LOCATION | VALUE |
0300H | 00 |
0301H | 01 |
0302H | 03 |
0303H | 02 |
0304H | 06 |
0305H | 07 |
0306H | 05 |
0307H | 04 |
0308H | 0C |
0309H | 0D |
030AH | 0F |
030BH | 0E |
030CH | 0A |
030DH | 0B |
030EH | 09 |
030FH | 08 |
INPUT BINARY CODE VALUE:
MEMORY LOCATION | VALUE |
0200H | 0A |
0201H | 00 |
OUTPUT:
MEMORY LOCATION | VALUE |
0201H | 0F |
RESULT: The gray code equivalent of the binary number is checked from the lookup table and stored at the output.
FLOWCHART:

Most Important Question for Exam
start bit
Motorala MC-6801
1946
All of these
Mask ROM
Both a and b
Magnetic tape
Microprocessor does not contain I/O devices
Fabricated on a tiny silicon chip
Extremely high reliability
All of the these
Formatted
All of the these
To compare numbers
Either of the these
RAM
4 byte
Read only memory chip
Registers
Temporary
Digital signals
Hexadecimal
assembler directives
Ultraviolet rays
Low =-15 volt to –3 vol, high = +3 volt to +15 volt
ENIAC
CONFIG.SYS
is not useful for process control system
to reduce the number of pins
Memory bus
Related Link
- 8086 Instruction Hex Code
- Write a program to two add 16 bit Hexadecimal numbers without carry.
- Write a program to two add 16 bit Hexadecimal numbers with carry.
- Write a program to find the greatest number from an array of 10 numbers.
- Write a program to calculate the factorial of a number.
- Write a program to multiply two 16-bit numbers result should be greater than 16 bit.
- Write a program to input 5 numbers and arrange them in descending order.
- Write a program to convert the string data it’s Two’s complement form.
- Write a program to read 8 bit data from Port B. Complement this data & send it back to Port A of
- Write a program to move a block of data from one memory location to another. Input Value
- Write a program to find Gray code equivalent of a Binary number using Lookup Table.
- Microprocessor 8086 Video Play List