0% found this document useful (0 votes)
233 views55 pages

Binary Number Systems Guide

This document discusses different number systems used in digital electronics including binary, decimal, octal, and hexadecimal number systems. It provides details on how each system works including the base used, symbols represented, and how numbers are written. Conversion between the different number systems is explained using division and multiplication algorithms. Representation of signed binary numbers including sign-magnitude, one's complement, and two's complement methods is covered. Binary codes and gray code are also summarized.

Uploaded by

madhu518
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as ODP, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
233 views55 pages

Binary Number Systems Guide

This document discusses different number systems used in digital electronics including binary, decimal, octal, and hexadecimal number systems. It provides details on how each system works including the base used, symbols represented, and how numbers are written. Conversion between the different number systems is explained using division and multiplication algorithms. Representation of signed binary numbers including sign-magnitude, one's complement, and two's complement methods is covered. Binary codes and gray code are also summarized.

Uploaded by

madhu518
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as ODP, PDF, TXT or read online on Scribd

Binary Systems

Binary Systems

Number Systems
A number system defines how a number can be represented using distinct symbols. A number can be represented differently in different systems. For example, the two numbers (2A)16 and ( 2)! both refer to the same "uantity,but their representations are different. There are four systems of arithmetic which are often used in digital electronics.
1)Decimal Number System 2)Binary Number System 3)Octal Number System )!e"a Decimal System

Decimal Number system


Decimal number system contains 10 symbols: 0,1,2,3,4,5,6,7,8,9; and that is hy its base or radi! is 10" #ere radi! means total number o$ symbols used in any system %t is also called as &'ase(10 )ystem*

Decimal Number System


+he decimal number system is a ,ositional number system" -!am,le: 5 6 2 1
103 102 101 100

1 . 100 / 1 2 . 101 / 20 6 . 102 / 600 5 . 103 / 5000 +otal/ 5621

Binary Number System +he binary number system is also a ,ositional numberin0 system" %nstead o$ usin0 ten symbols, 0 ( 9, the binary system uses only t o symbols, 0 and 1"

Binary Number System


+he binary number system is also 1no n as base 2" +he 2alues o$ the ,ositions are calculated by ta1in0 2 to some ,o er" 3hy is the base 2 $or binary numbers4
'ecause e use 2 di0its, the di0its 0 and 1" Example: 5110162 , 511010101062 (((( 7alid 'inary 510101262((((((( %n2alid 'inary

Octal Number System

8lso 1no n as the 'ase 8 )ystem %t uses 8 symbols i"e", 0,1,2,3,4,5,6,7 -!am,le: 525768 , 553768 (((((((((((( 7alid 9ctals 557868 (((((((((( %n2alid 9ctal

Hexadecimal Number System


'ase 16 system :ses di0its 0(9 ; letters 8,',<,D,-,= -!am,le: 518<3616 , 58'<D-616 518<>616((( %n2alid #e!

General Form

b b b b b b b b b b
!ere b is Base #i.e.$ 2$%$1&$1' etc)

1 2

3 4

Binary Numbering Scale


Base 2 Number Base 10 Equivalent Power Positional Value

000 001 010 011 100 101 110 111

0 1 2 3 4 6 !

20 21 22 23 24 2 26 2!

1 2 4 8 16 32 64 128

Significant Digits

'inary: 11101101
Most significant digit Least significant digit

#e!adecimal: 1D63878
Most significant digit Least significant digit

Conversions:

Decimal

1)Binary 2)Hexadecimal 3)Octal

Here we use DIVISION ALGORITHM for converting a Decimal(Integer part) number to any of the other forms.

Division Algorit m

+his method re,eatedly di2ides a decimal number by the base o$ the other $orm and records the ?uotient and remainder
The remainder digits form the equivalent in least significant to most significant digit sequence Process: 1) Divide the given Decimal value with the destination base(i.e., 2,8,10,16 etc) and record or store the remainder(LS ). 2) !ow divide the resultant "uotient with destiation base and again store the remainder. #) $e%eat step:2 untill "uotient become &ero and the remainder o' the last %rocess will be considered as (S .

!xam"le
-!am,le : con2ert 2510 to binary )ol2e / 2510 / 42 25 / 12 balance 1 2 12 / 6 balance 0 2 6 / 3 balance 0 2 3 / 1 balance 1 2 1 / 0 balance 1 2 " " " 8ns er / 110012

A)'

@)'

DECIMAL TO OCTAL CONVERSION


-!am,le : con2ert 359 to Decimal 7alue
10

)ol2e / 35910 / 48 359 / 44 balance 7 8 44 / 5 balance 4 8 5 / 0 balance 5 8 " " " 8ns er / 5478

A)'

@)'

Decimal to Hexadecimal Conversion

<on2ert 83010 to its he!adecimal e?ui2alent: 830 B 16 / 51 C 14 51 B 16 / 3 C 3 3 B 16 / 0 C 3


/ - in #e!

33-16

Binary

1)Octal 2)Hexadecimal

Binary to Octal

D <an be con2erted by 0rou,in0 the binary bit in 0rou, o$ three startin0 $rom A)' D 9ctal is a base(8 system and e?ual to t o the power o" t#ree$ so a di0it in 9ctal is e?ual to three di0it in binary system"

Binary to Hexadecimal system

1 6>rou, the bits o$ the binary number by "our startin0 $rom the ri0ht" 2 6 Ce,lace each 0rou, o$ "our bits by an e?ui2alent he!adecimal di0it" <on2ert 101101012 into a he!adecimal number" 1011 01012 / '516 ' 5

!xercise

1 <on2ert 1010002 into a he!adecimal number and 9ctal number

2 <on2ert 111011112 into a he!adecimal number and 9ctal number

Octal

1)Binary 2)Hexadecimal

Octal to Binery
D <on2ert $rom o%tal to binar& by con2ertin0 each octal di0it to a three bit binary e?ui2alent
Octal digit
Binary Equivalent

0 000

1 001

2 010

3 011

4 100

5 101

6 110

7 111

OC#A$ #O H!%AD!C&'A$

Can be converted by representing each Octal digit by its equivalent 3 bit binary and grouping them 4bits from right to left. (275)8 to (?)16 2 ---- 010; 7 ---- 111 ; 5 ---- 101 i.e., (010111101) Now group 4 bits from R to L by appending 0's at MSB(if req.) i.e., (0000 1011 1101)=(0BD)

Hexadecimal

1)Binary 2)Octal

Hexadecimal to Binary

Can be converted by representing each Hex digit by its equivalent 4 bit binary (FE)16 = (11111110)2 i.e., F --- 1111 E --- 1110

Hexadecimal to Octal

Can be converted by representing each Hex digit by its equivalent 4bit binary and group them in 3bits from Right to Left and append 0's at MSB (if req.) and write the equivalent Octal form Ex: (FE7)16

(1111 1110 0111) = ( 111 111 100 111) = (7747)8

Ot er forms to Decimal Other form of number system is converted to Decimal form by using Multiplication Algorithm Multiplication Algorithm

@ulti,ly the di0its or bits by increasin0 ,o ers o$ base5i"e", 2,8,166, startin0 $rom the ri0ht +hen, to $ind the decimal number e?ui2alent, sum those ,roducts Examples: 5110162 ((((( 1E 23 F 1 E 22 F0 E 21 F 1 E 20 / 8 F 4 F 0 F 1 / 513610 57668 (((( 7 E 81 F 6 E 80 / 56 F 6 / 562610 58'616 ((((((( 8 E 161 F ' E 160 / 160 F 11 / 5171610

'ulti"lication Algorit m
Example: Convert (10101101)2 to its decimal equivalent:
Binary

1 0 1 0 1 1 0 1

x x x x x x x x
Positional Values
Product

27 26 25 24 23 22 21 20 128 + 32 + 8 + 4 + 1

17310

Fractional Conversion

Decimal to Other forms is done by using Repeated Multiplication Method The fractional part of the decimal number is multiplied by the destination base value and the integer part of the result is stored after every process. This process is done untill fractional part of decimal no. becomes zero or up to 5 to 6 precision values

!xam"le

(0.201) in decimal to Octal?


Integerpart

0.201 x 8 = 1.608 0.608 x 8 = 4.864 0.864 x 8 = 6.912 0.912 x 8 = 7.296 0.296 x 8 = 2.368

1 4 6 7 2

(0.210)10 = (0.14672)8

Binary to Octal and Hexadecimal

It is similar to that of Integer part conversion but the grouping has to be done from Left to Right append 0's at right side (if req.) Example: (0.0110101)2 = (011 010 100) =(0.324)8 (0.0110101)2 = (0110 1010) = (6A)16

Octal to Binary and Hexadecimal

It is similar to that of Integer part conversion but the grouping has to be done from Left to Right append 0's at right side (if req.) Example: (0.25)8 = (0.010101)2 (0.25)8 = (010101) = (0101 0100) = (0.54)16

Hex to Binary and Octal

It is similar to that of Integer part conversion but the grouping has to be done from Left to Right append 0's at right side (if req.) EXAMPLE: (0.AB)16 = (0.10101011)2 (0.AB)16 = (0.10101011) =(0.101 010 110) =(0.526)8

Ot er forms to Decimal @ulti,ly the di0its or bits by decreasin0 ,o ers o$ 'our%e base starts $rom (15i"e", 2,8,166, startin0 $rom the le$t" +hen, to $ind the decimal number e?ui2alent, sum those ,roducts E()*P+E: 50"3516 in #e! to decimal4 / 3 ! 16(1 F 5 ! 16(2 F 1 ! 16(3 / 0"1875 F 0"01953 F 0"0002441 / 50"20727610

Signed Binary Numbers

Unsigned numbers: The numbers without any sign are known as Unsigned Numbers Signed Numbers: The numbers with any sign are known as Signed Numbers. 3 methods for representing sign of a Binary number:

Sign-magnitude representation 1's Complement representation 2's Complement representation

Sign('agnitude re"resentation In this method MSB of the binary number represents the Sign and the remaining represents the Magnitude. (B7B6B5B4B3B2B1B0)2 here B indicates Base and B7 is Sign and B6 to B0 is Magnitude which represents the Quantity. If B7 is '0' it indicates that it is a Positive Number and if B7 is '1' it indicates that it is a Negative Number.

Example:

(00001000)2---- +8 (10001000)2---- -8

)*s Com"lement

In this method each bit is subtracted from '1' or it is obtained by replacing 1's with 0's and 0's with 1's. MSB is '0' for Positive Number and '1' for Negative number. Example:

(00001000)2---- +8 (11110111)2---- -8 ( As MSB is '1' it is a negative number)

+*s Com"lement 2's Compliment of a binary number is obtained by adding 1 to the 1's compliment number. MSB is '0' for Positive Number and '1' for Negative number. Example:

(00001000)2---- +8 11110111---- 1's compliment of 8 + 1 11111000 ---- 2's Compliment of 8(i.e., As MSB is '1' it is a negative number)

Binary code

D Di0ital data is re,resented, stored and transmitted as 0rou, o$ binary bits" D +his 0rou, is called binary code" D +he binary code can be used $or re,resent the number as ell as al,ha numeric letters"

Classification of binary code


'inary codes

Gon ei0hted code D-!am,le: >ray -!cess(3

8l,hanumeric <odes D-!am,le: 8)<%% -'<D%<

-rror detectin0 and correctin0 code D-!am,le: #ammin0 Harity

3ei0hted code

'inary -!: 0s1

D '<D -!: 8421 2421 5211 4221

Binary code decimal ,BCDD BCD stands for Binary-Coded Decimal. D A BCD number is a four-bit binary group that represents one of the ten decimal digits 0 through 9.

Binary code decimal ,BCD8421 ,B-./ 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 .e%imal 0 1 2 3 4 5 6 7 8 9

Binary Codes for Decimal Numbers

Gray code
D %t is called cyclic or re$lected code" D %n this code each code 0rou, does not di$$er $rom its nei0hbor in more than one bit" D +his code is used $or in,ut and out,ut de2ices in di0ital system"

#able of gray code


.e%imal number 0 1 2 3 4 5 6 7 8 9 10 11 12 0ra& %o1e 0 0 0 0 0 0 0 1 0 0 1 1 0 0 1 0 0 1 1 0 0 1 1 1 0 1 0 1 0 1 0 0 1 1 0 0 1 1 0 1 1 1 1 1 1 1 1 0 1 0 1 0

Conversion from binary to gray code


*et#o1: D 3rite do n binary $orm o$ the 0i2en decimal number" D D D D 3rite @)' as such" +hen add the binary di0it $rom le$t to ri0ht at the adIacent ,osition" Discard carry i$ any" 3rite the di0it hich comes a$ter addition"

Conversion from binary to gray code


D -!am,le: <on2ert 15 into 0ray code" )olution: 515610 / 5111162

3e ha2e to con2ert 5111162 into 0ray code Ae$t most bit 1


+

1 0 0 0 #ence the resultant 0ray code is 1000 $or 15"

!xam"le
J <on2ert 511101162 into 0ray code"

)olution:

Ae$t most bit

1 1

1 0

1 0

0 1

1 1

1 0

1" 2" 3"

3rite the le$t most bit as such" +hen add the binary di0it $rom le$t to ri0ht at the adIacent ,osition" 3rite the di0it hich comes a$ter addition"

#ence the 0rey code o$ 511101162 is 100110"

Conversion from grey code to binary code


D 1" 2" 3" *et#o1: 3rite the 0i2en 0rey code" 3rite the le$t most bit as such" 8dd this bit to the second le$t most bit, rite the result, discard carry" 8dd this result to the ne!t le$t most bit dia0onally"

4"

Conversion from grey code to binary code


D -!am,le: <on2ert the $ollo in0 0rey code into binary code $rom 51 0 0 06" )olution:

3e ha2e Ae$t most bit

1
+

0
+

0
+

0 1

#ence the corres,ondin0 binary number us 5111162"

# e !xcess(. Code
D Add 3 to each digit of decimal and convert to 4-bit binary form D A BCD code (not 8421 BCD)
Decimal Binary +3 Excess-3 0 0000 0011 0011 1 0001 0011 0100 2 0010 0011 0101 3 0011 0011 0110 4 0100 0011 0111 5 0101 0011 1000 6 0110 0011 1001 7 0111 0011 1010 8 1000 0011 1011 9 1001 0011 1100

Sample Pro lem!


Decimal

Excess-3

0110 1000 1100

# e

ASC&&

Code

D ASCII is an acronym for American Standard Code for Information Interchange D Represents numbers, letters, punctuation marks and control characters D Standard ASCII is a 7-bit code (127 characters) D Extended ASCII (IBM ASCII), an 8-bit code, is also very popular D Extended ASCII adds graphics and math symbols to code (total of 256 symbols)

You might also like