Skip to content
Home » Binary Codes

Binary Codes

    Binary codes are used to represent the distinct discrete element of information. They are patterns of 1s and 0s for a computer to understand information other than binary numbers.

    The discrete elements of information are not only binary numbers but also, other types of information such as decimal numbers, etc.

    What is a Binary Code?

    Suppose we have an n-bit code then there are 2n combination of binary codes consists of 1s and 0s.

    For example,

    3-bit code has 23 = 8 codes

    Bit Combination Codes
    0000
    1001
    2010
    3011
    4100
    5101
    6110
    7111

    There are 8 combinations, but the bit combination has value is between 0 to 2n – 1. A 3-bit code has bit combination from 0 to 23 – 1 = 7.

    Minimum bits required

    For 16 code combinations, you need minimum of 4 bits, n = 4 bits, so that 24 = 16.

    For 8 codes, you need a minimum of 3 bits like in the example above,

    n = 3 bits so that 23 = 8.

    Maximum bit for Binary Code

    There is no restriction on a number of bits that you can use for a binary code.

    For example

    10 decimal numbers – 0,1,2,3,4,5,6,7,8,9 can be represented using 4-bits and can also be represented using 10-bits. Let’s check this for first 5 decimal numbers.

    Decimal value4-bit code 10-bit code
    000000000000000
    100010000000010
    200100000000100
    300110000001000
    401000000010000

    A 4-bit code is binary representation of decimal and 10-bit code uses placeholder for each decimal number. Here the code – 0000010000 does not mean 25 = 16, but it means 5th position from right is a 1, therefore, decimal number = 4.

    References

    • John.F.Wakerly. 2008. Digital Design: Principles And Practices, 4/E. Pearson Education, India.
    • Mano, M. Morris. 1984. Digital Design. Pearson.
    • NATARAJAN, ANANDA. 2015. Digital Design. PHI Learning Pvt. Ltd.