Subtitles section Play video
-
The previous video discussed about the BCD and X3 codes.
-
U can check the links in the description to check that video.
-
In this video we will talk about the gray code, its applications and the conversion
-
from gray to binary and binary to gray.
-
This code is also known as the reflective code because of its peculiar arrangement or
-
representation.
-
This code is named after Frank Gray and the successive numbers differ only by the single
-
bit.
-
Let us take a look at how to construct this code.
-
If it consists of only one bit we can represent two numbers i.e) 0 and 1.
-
On adding one more bit, 4 numbers can be represented.
-
To write the numbers in ascending order using Gray code, we use something called mirror
-
technique.
-
Let us try it to write the numbers 0 to 3.
-
0 is represented as 00 and 1 as 01.
-
Now the next two digits are obtained by changing MSB from 0 to 1 and placing a mirror at LSB.
-
This will give us 11 for 2 and 10 for 3.
-
If we look at the numbers, we can see that each successive number is different from the
-
previous bit by only one bit.
-
By adding one more bit, that is three bits altogether, we can represent 8 numbers.
-
Let us try the mirroring technique.
-
Every time the bits end, add 1 as MSB and place mirror below the remaining bits to get
-
its reflection and one gets the decimal numbers
-
So now we understand why it is called as reflective code.
-
This code was developed as error checking code.
-
As each successive numbers differ only by a single bit, this code finds use in error
-
checking and corrections in digital communications.
-
Now let us try converting binary numbers to Gray code.
-
For this we must know the XOR operation which has been covered in the other lecture of this
-
series.
-
You can find the link to that video in the description below or the suggested card in
-
the top right corner of the video.
-
The MSB of gray code will be same as MSB of binary.
-
The next lower bit of gray code is obtained by taking X-or of MSB and next lower
-
bit of binary number.
-
The process of XORing continues till all the binary bits are converted to gray code.
-
Let us try with an example.
-
We will convert 1010 to gray code.
-
The MSB 1 is copied as it is to give MSB of gray code.
-
Next bit of Gray code is obtained by taking X-OR of 1 and 0 which gives 1, X-ORing 0 and
-
1 gives 1 and X-ORing 1 and 0 gives 1.
-
So the obtained gray code is 1111.
-
We continue with understanding gray to binary conversion.
-
The MSB of gray is copied as it is to give MSB of binary.
-
The next binary bits are obtained by X-ORing the existing binary bit with GRAY bits.
-
We will convert 1010 from GRAY to binary.
-
The MSB will be 1.
-
Now we will X-OR the MSB of binary with the next lower bit of GRAY
-
X-ORing 1 and 0 will produce 1.
-
This 1 on X-ORing with 1 will give 0 and X-ORing 0 with 0 will produce 0.
-
So the binary equivalent is 1100 for GRAY code 1010.
-
The next video in this series will discuss the error detection techniques and error detection
-
codes.