What is & Queries

# Why Gray Codes are used in K-MAP instead of Binary Code?

Gray code belongs to a class of codes called minimum change code in which the only one-bit code group changes when going from one step to the next. This is an un-weighted code which means that there are no specific weights assigned to the bit positions.

### Advantages of the Gray Code

In the Gray Code, if we go from one decimal number to next, only one bit of the Gray code changes. Because of this feature, an amount of switching is minimized and the reliability of the switching systems is improved.

Gray codes actually follow Adjacency property i.e between two successive gray codes there is only one-bit change and in the binary code, there will be multiple value changes.

Because of Adjancey property when one plots a K-MAP, literals can be grouped keeping other literal constant.For example: 00, 01, 11, 11 Like 01, 11

Example of Binary to Gray code conversion.

Convert 1011 Binary to Gray1011 the binary value, there are two values MSB as well as LSB

[MSB] [1 from left] – 1011 – [LSB] [1 from right]

Rules to convert Binary to Gray code

• Write MSB as it is.
• Add MSB in a next and neglect carry if occurs.

Convert 1011 (Binary) to (Gray)

• MSB is 1 and writes it as it is as 1.
• Now add MSB  next to next value  and add both of them, if a carry occurs discard it.
• Now follow the same way for all the numbers 0, 1 & 1. 