This is a number system in which base (or radix) is 2.
There are only two digits – 0 and 1. These two digits can mean many things like
0 representing OFF, LOW, FALSE etc. and 1 representing HIGH, ON, TRUE etc. This
is the only number system that computers can understand directly. In all digital
circuits, binary or its some other versions of binary (Like BCD, Gray, Excess –
3 etc.) are used.
In all logic systems, the functions are realized with electronic
circuits and decision is taken based on voltage levels. Traditionally, humans
use decimal number system in which base is 10 (perhaps because we have 10
fingers in our hands). So, we make all calculations in that system. But implementing
such a system with 10 different levels is something which is next to impossible
(Though researches are going on in this field even today), it is far easier to
design a system with just two voltage levels (LOW / 0V and HIGH/+5 V) and to
convert all calculations to the new system.
Difficulty in representing large numbers is a serious
drawback of binary system (For e.g., even to represent 100, we need 7 bits).
Due to this, two other systems, Octal (base – 8) and Hexadecimal (base – 16)
have been developed and they act as a shorthand representations of binary. It
is also very easy to convert between Binary – octal – Hexadecimal systems.
Apart from the basic Binary code, Some other varieties
of binary are used:
Gray code (also known as
Reflected Binary code) is a non – positional number system in which two
successive digits change by only one unit. This is used extensively in real
time systems, shaft encoders etc.
of Gray code:
In machines with rotating
parts (Like CNC machine, machines used to dig tunnels, DVD/CD player etc.) we
use a device known as rotary encoder to know the angular position of the
rotating disc. This is accomplished by dividing the surface of the discs into
various sectors and representing each sector in binary (For e.g., we can divide
the surface of the disk into 8 parts (each sector being 450 wide)
and represent each sector by binary code 000, 001, 010 etc.) Problem with this
representation lies in the fact that all sensors have different response times.
So, during the transition from one sector to another (Like from 3 (011) to four
(100), all sensors may not change value simultaneously resulting in momentary
erroneous readings (E.g. 011 may become
100 in the following order: 011 – 111 – 110 – 100 ). This has serious repercussions in
industry especially if the data so obtained is used to control some other
process like time keeping.
To solve this problem, a
variant of binary known as Reflected Binary Code / Gray Code, in which
successive digits have change in only a single position. (E.g. 3 in this system
is represented as 010 and four as 110). This reduce the chance of error because
only one sensor has to change state when moving from one sector to another.
Grey code is not a
positional number system and is not used for calculations.
Coded Decimal (BCD)
This is one of the simplest
variants of binary in which each digit of a decimal number is replaced by
corresponding 4 bit binary. This system has numbers from 0000 to 1001. The
numbers 1010 to 1111 are invalid.
E.g. 2017 in BCD = 0010
0000 0001 0111 (spaces are added for clarity)
This is also not a
positional system and arithmetic rules are different from usual binary. ICs
that convert From BCD to 7 segment displays are very common.
3 (XS 3) code
Excess – 3 is also a non
– positional system in which each decimal digit (0 – 9) is represented by
equivalent 4 bit binary from 3 to 12 (i.e., 0011 – 1100) . Combinations like
0000, 0001, 0010, 1101, 1110,1111 are invalid.
It is obtained as
XS– 3 = BCD + 0011
It is easier to use XS –
3 in adder/subtractor circuits as 9’s complement of a digit in XS – 3 can be
obtained by taking one’s complement (Inverting all bits) in the XS – 3
E.g. 9’s complement of 8
In XS -3 , 8 = 1011 and 1
= 0100 ( 1’s complement of 1011)
Using this property, we
can design cheap adder/subtractor circuits.
This stands for American
Standard Code for Information Interchange. This is a 7-bit character coding standard.
In this code, characters are represented in 7-bit binary code and has a total
of 128 characters. Extended ASCII code uses 8 bits.
ASCII code for some
48 to 57 in ASCII -> 0 (zero) to 9 (nine)
65 to 90 -> A ( capital A) to Z (capital A)
97 – 122 -> a ( small
a) to z (small z)
E.g. NITC is Represented
in ASCII as 1001110 1001001 1010100 1000011 ( i.e., 78 73 84 67)
to Grey Code/ Grey Code to binary converter with mode control
This is a device which
converts from binary number system to Grey Code or vice versa depending upon
the value of a control variable known as mode control. In this experiment, the
designed device take a 3 bit binary number as input and generate the equivalent
Gray code as output when mode control is 1.