BinaryNumber SystemThis 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 like0 representing OFF, LOW, FALSE etc. and 1 representing HIGH, ON, TRUE etc. Thisis the only number system that computers can understand directly. In all digitalcircuits, binary or its some other versions of binary (Like BCD, Gray, Excess –3 etc.
) are used.Why Binary?In all logic systems, the functions are realized with electroniccircuits and decision is taken based on voltage levels. Traditionally, humansuse decimal number system in which base is 10 (perhaps because we have 10fingers in our hands). So, we make all calculations in that system. But implementingsuch 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 todesign a system with just two voltage levels (LOW / 0V and HIGH/+5 V) and toconvert all calculations to the new system.Difficulty in representing large numbers is a seriousdrawback 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. Itis also very easy to convert between Binary – octal – Hexadecimal systems. Apart from the basic Binary code, Some other varietiesof binary are used: 1. Graycode Gray code (also known asReflected Binary code) is a non – positional number system in which twosuccessive digits change by only one unit. This is used extensively in realtime systems, shaft encoders etc.Necessityof Gray code:In machines with rotatingparts (Like CNC machine, machines used to dig tunnels, DVD/CD player etc.
) weuse a device known as rotary encoder to know the angular position of therotating disc. This is accomplished by dividing the surface of the discs intovarious sectors and representing each sector in binary (For e.g., we can dividethe 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 thisrepresentation 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 momentaryerroneous readings (E.
g. 011 may become100 in the following order: 011 – 111 – 110 – 100 ). This has serious repercussions inindustry especially if the data so obtained is used to control some otherprocess like time keeping.To solve this problem, avariant of binary known as Reflected Binary Code / Gray Code, in whichsuccessive digits have change in only a single position. (E.
g. 3 in this systemis represented as 010 and four as 110). This reduce the chance of error becauseonly one sensor has to change state when moving from one sector to another. Grey code is not apositional number system and is not used for calculations.2.
BinaryCoded Decimal (BCD) This is one of the simplestvariants of binary in which each digit of a decimal number is replaced bycorresponding 4 bit binary. This system has numbers from 0000 to 1001. Thenumbers 1010 to 1111 are invalid.E.g.
2017 in BCD = 00100000 0001 0111 (spaces are added for clarity)This is also not apositional system and arithmetic rules are different from usual binary. ICsthat convert From BCD to 7 segment displays are very common. 3. Excess3 (XS 3) code Excess – 3 is also a non– positional system in which each decimal digit (0 – 9) is represented byequivalent 4 bit binary from 3 to 12 (i.e., 0011 – 1100) . Combinations like0000, 0001, 0010, 1101, 1110,1111 are invalid.
It is obtained asXS– 3 = BCD + 0011It is easier to use XS –3 in adder/subtractor circuits as 9’s complement of a digit in XS – 3 can beobtained by taking one’s complement (Inverting all bits) in the XS – 3representation.E.g.
9’s complement of 8= 1In XS -3 , 8 = 1011 and 1= 0100 ( 1’s complement of 1011)Using this property, wecan design cheap adder/subtractor circuits. 4. ASCIIThis stands for AmericanStandard 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 totalof 128 characters. Extended ASCII code uses 8 bits.
ASCII code for somecommon characters:48 to 57 in ASCII -> 0 (zero) to 9 (nine)65 to 90 -> A ( capital A) to Z (capital A)97 – 122 -> a ( smalla) to z (small z)E.g. NITC is Representedin ASCII as 1001110 1001001 1010100 1000011 ( i.e.
, 78 73 84 67) Binaryto Grey Code/ Grey Code to binary converter with mode controlThis is a device whichconverts from binary number system to Grey Code or vice versa depending uponthe value of a control variable known as mode control. In this experiment, thedesigned device take a 3 bit binary number as input and generate the equivalentGray code as output when mode control is 1.