0% found this document useful (0 votes)
25 views15 pages

Unit II

This document discusses data representation in computers, focusing on how computers use binary numbers to process and store information. It explains units of data representation such as bits, bytes, and words, as well as different number systems including decimal, binary, octal, and hexadecimal. Additionally, it covers methods for representing numbers, including floating point and fixed point representations, and the arithmetic operations associated with signed numbers.

Uploaded by

zewdu aynie
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views15 pages

Unit II

This document discusses data representation in computers, focusing on how computers use binary numbers to process and store information. It explains units of data representation such as bits, bytes, and words, as well as different number systems including decimal, binary, octal, and hexadecimal. Additionally, it covers methods for representing numbers, including floating point and fixed point representations, and the arithmetic operations associated with signed numbers.

Uploaded by

zewdu aynie
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd

UNIT II

Four
Data Representation in
Computers
We enter data into a computer or
review (see) output data from a
computer using the letter of
alphabet, various special symbols,
and the numerals in the decimal
number system. But since
computer is an electronic device,
which understands electrical flow
(signal), there is no letter,
symbol or number inside the
computer. Computer works with
binary numbers.
Unit II : Information Representation Page 1
Four
Data Representation in
Computers
We enter data into a computer or
review (see) output data from a
computer using the letter of
alphabet, various special symbols,
and the numerals in the decimal
number system. But since
computer is an electronic device,
which understands electrical flow
(signal), there is no letter,
symbol or number inside the
computer. Computer works with
binary numbers.
Unit II : Information Representation Page 2
Four
Data Representation in
Computers
We enter data into a computer or
review (see) output data from a
computer using the letter of
alphabet, various special symbols,
and the numerals in the decimal
number system. But since
computer is an electronic device,
which understands electrical flow
(signal), there is no letter,
symbol or number inside the
computer. Computer works with
binary numbers.
Unit II : Information Representation Page 3
Four
Data Representation in
Computers
We enter data into a computer or
review (see) output data from a
computer using the letter of
alphabet, various special symbols,
and the numerals in the decimal
number system. But since
computer is an electronic device,
which understands electrical flow
(signal), there is no letter,
symbol or number inside the
computer. Computer works with
binary numbers.
Data Representation

Unit II : Information Representation Page 4


We enter data into a computer or review (see) output data from a computer using the letter of alphabet,
various special symbols, and the numerals in the decimal number system. But since computer is an electronic
device, which understands electrical flow (signal), there is no letter, symbol or number inside the computer.
Computer works with binary numbers.
Units of Data Representation
When data is stored, processed or communicated within the computer system, it is packed in
units. Arranged from the smallest to the largest, the units are called bit, byte, and word; these
units are based on the binary number system.
BIT:
Bits are the smallest units and can convey only two possible states 0 or 1;
Bit stands for Binary digits;
A bit is a single element in the computer, on a disk that stands for either “ON” indicating
1 or “OFF” indicating 0;
In the computer “ON” is represented by the existence of current and “OFF” is represented by
the non-existence of current. On a magnetic disk, the same information is stored by changing
the polarity of magnetized particles on the disk’s surface.
BYTE:
Bits can be organized into large units to make them represent more and meaningful information.
This large unit is called a byte and is the basic “unit of data representation” in a computer
system. The commonly used byte contains 8 bits. Since each bit has two states and there are 8
bits in a byte, the total amount of data that can be represented using a single byte is 28 or 256
possible combinations. Each byte can represent a character.
A byte is then used as a unit of measurement in the computer memory, processing unit, external
storage and during communication. If the computer memory is 524288 byte, this is expressed in
short by saying 512KB, where KB stands for kilobyte.
- 1 Kilobyte (1KB) is 210 or 1024 bytes
- 1 Megabyte (MB) is 220 bytes or 210 kilobytes
- 1 Gigabyte (GB) is 230 bytes or 220 kilobytes or 210 megabytes
WORD:
Word refers the number of bits that a computer process at a time or a transmission media
transmits at a time. Although bytes can store or transmit information, the process can even be
faster if more than one byte is processed at a once. A combination of bytes, then form a “word”.
A word can contain one, two, three, four or eight bytes based on the capacity of the computer.
Word length is usually given in bits. We say that a computer is an 8-bit, a 16 bit, a 32 bit or a 64
bit computer to indicate that the amount of data it can process at a time. The larger the word
Unit II : Information Representation Page 5
length a computer has the more powerful and faster it is.
Concept of Number Systems and Binary Arithmetic
A number system defines a set of values used to represent quantity. There are various number
systems e.g. decimal, binary, octal, hexadecimal, etc each differs one another by the number of
symbols used in the system. Each numbering system used different symbols to represent a given
quantity. The number systems that are generally used by computers are: decimal, binary, octal,
and hexadecimal.
The Decimal Number System
The primary number system used is a base ten number system or decimal number system. The
Decimal number system is based on the ten different digits or symbols (0,1,2,3,4,5,6,7,8,9).
Starting at the decimal point and moving to the left, each position is represented by the base
(radix) value (10 for decimal) raised to power. The power starts at Zero for the position just to
the left of the decimal point. The power incremented for each positions that continues to the left.
Moving to the right of the decimal point is just like moving to the left except that we will need
to place a minus sign in front of each power.
For example: (8762)10 = (8*103) + (7*102) + (6*101) + (2*100)
(0.475)10= (4*10-1) + (7*10-2) + (5*10-3)
The Binary number system
Computers do not use the ten digits of the decimal system for counting and arithmetic. Two
digits, 0 and 1, are used to refer for these two states.
Binary number system is based on the two different digits; 0 and 1. With binary number system,
it is very easier for the hardware to represent the data. Binary number system is base two
number system
Why Binary number? : Inside the computer, there are integrated circuits with thousands of transistors. These
transistors are made to operate on a two-state. By this design, all the input and output voltages are either
HIGH or LOW. Low voltage represents binary 0 and high voltage represents binary 1.
Voltage Low High
Binary 0 1
In Computer the data is represented in binary format (1s and 0s). Even though we use characters,
decimals, punctuation marks, symbols and graph, internally these things are represented in binary format.

For example: (01100)2, (10110.011)2 , etc

Octal number system

Unit II : Information Representation Page 6


The octal number system with its eight symbols (0, 1, 2, 3, 4, 5, 6, and 7) is a base 8 system.

For example: (322)8, (10.25)8, etc

4.2.4 Hexadecimal number system

Hexadecimal number system is another number system that works exactly like the decimal and

binary number systems, except that the base is 16. It uses 16 symbols (0-9, and A-F characters

to represent 10-15).

For example: (8F0)16, (D.45)16, etc

It is important to note that every decimal number system has its equivalent binary number.

For example:

Decimal Binary Code Octal Hexadecimal


0 0000 0 0
1 0001 1 1
2 0010 2 2
3 0011 3 3
4 0100 4 4
5 0101 5 5
6 0110 6 6
7 0111 7 7
8 1000 8
9 1001 9
10 1010 A
11 1011 B
12 1100 C
13 1101 D
14 1110 E
15 1111 F
Conversion from binary to its equivalent decimal and from decimal to its equivalent binary is
possible. The method, which is used for the conversion of decimal into binary, is often called as
the remainder method. This method involves the following steps.
- Begin by dividing the decimal number by 2 (the base of binary number system)
- Note the remainder separately as the rightmost digit of the binary equivalent
- Continually repeat the process of dividing by 2 until quotient is zero and keep
writing the remainders after each step of division (these remainders will either be 0 or 1)
- Finally, when no more division can occur, write down the remainders in reverse

order (last remainder written first)

Unit II : Information Representation Page 7


Example: Determine the binary
equivalent of (44)10
order (last remainder written first)
Example: Determine the binary equivalent of (44)10

i) Floating Point Representation


In this method, a real number is expressed as a combination of a mantissa and exponent. The mantissa is kept as less than 1 and
greater than or equal to 0.1 and the exponent is the power of 10.
For example, the decimal number +4567.89 is represented in floating point with a fraction and an exponent as follows:
Fraction Exponent
+0.456789 +04  scientific notation is +0.456789 x 10+4
 m x re
Here, Mantissa = 0.456789 Exponent = 4
While storing numbers, the leading digit in the mantissa is always made non-zero by approximately shifting it and adjusting the
value of the exponent, i.e.. .004567  0.4567 * 10 -2  0.4567E-2
This shifting of the mantissa to the left till its most significant digits is non-zero, is called Normalization.
Only the mantissa m and the exponent e are physically represented in the register (including their signs). A floating point binary
number is represented in a similar manner except that it uses base 2 for the exponent.
Example: the binary number +1001.11 is represented with an 8 bit fraction and 6 bit exponent as follows:
Fraction Exponent
01001110 000100
Here again the fraction has a 0 in the Leftmost position to denote positive.
The exponent has the equivalent binary number +4. The floating point

M x 2e = +( .1001110)2 x 2+4
A floating point number is said to be Normalized if the most significant digit of the mantissa is nonzero.

Example: The 8 bit binary number 00011010 is not normalized because of the three 0’s.
The number can be normalized by shifting three positions to the left and discarding the leading 0’s obtains 11010000. The three
shifts multiply the number by 23 = 8. To keep the same value for the floating-point number, the exponent must be subtracted by 3.
Normalized numbers provide the maximum possible precision for the floating point number.
Many computers and all electronic calculators have the built-in capability of performing floating-point arithmetic operations.

ii) Fixed Point Representation


Positive Integers, including zero, can be represented as unsigned numbers. However, to represent negative integers, we need a
notation for negative values. In ordinary arithmetic, a negative number is indicated by a minus sign and a positive number by a plus
sign.
Because of hardware limitations, computers must represent everything with 1’s and 0’s, including the sign of a number. As a
consequence, it is customary to represent the sign with a bit placed in the leftmost position of the number.
There are two ways of specifying the position of the binary point in a register by giving it a fixed position or by employing a
floating point representation. The fixed point method assumes that the binary pint is always fixed in one position. The two
positions most widely used are

Unit II : Information Representation Page 8


1) A binary point in the extreme left of the register to make the stored number a fraction, and
2) A binary point in the extreme right of the register to make the stored number an integer.
Representation of number as an integer:
When an integer binary number is positive, the sign is represented by 0 and the magnitude by a positive binary number.
When the number is negative, the sign is represented by 1 but the rest of the number maybe represented in one of three possible
ways:
1. Signed magnitude representation
2. Signed 1’s complement representation
3. Signed 2’s complement representation
The negative number is represented in either the 1’s or 2’s complement of its positive value.
It’s customary to use 0 for the + sign and 1 for the –sign. Therefore -001, -010 and -011 are coded as 1001, 1010 and 1011.
Note: Complement
Sign –magnitude numbers are easy to understand, but they require too much hardware for addition and subtraction. It has led to the widespread
use of complements for binary arithmetic.
For instance, if A = 0111  The 1’s complement is Ā = 1000
The 2’s complement is defined as the new word obtained by adding 1 to 1’s complement. As an equation
A ‘ = Ā + 1 Where A ‘ = 2’s complement
Ā = 1’s complement
Here are some examples. If A = 0111
The 1’s complement is Ā = 1001
In terms of a binary the 2’s complement is the next reading after the 1’s complement.
Another example, If A = 0000 1000
Then Ā = 1111 0111
1  (adding 1)
And A ‘ = 1111 1000

Example: Consider the signed number 14 stored in an 8 bit register.


+14 is represented by a sign bit of 0 in the leftmost position followed by the binary equivalent of 14  00001110. Note that each
of the eight bits of the register must have a value and, therefore, 0’s must be inserted in the most significant positions following the
sign bit.

Although there is only one way to represent +14, there are three different ways to represent -14 with eight bits.
Sign bit
In signed magnitude representation 1 0001110
In signed 1’s complement representation 1 1110001
In signed 2’s complement representation 1 1110010

The signed magnitude representation of -14 is obtained from +14 by complementing only the sign bit.
The signed 1’s complement representation of -14 is obtained by complementing all the bits of +14, including the sign bit.
The signed 2’s complement representation is obtained by taking the 2’s complement of the positive number, including its sign bit .

Arithmetic Addition:
The addition of two numbers in the signed-magnitude system follows the rules of ordinary arithmetic. If the signs are same, we
add the two magnitudes and give the sum the common sign. If the sign are different, we subtract the smaller magnitude from the
larger and give the result the sign of the larger magnitude.
Add the two numbers, including their sign bits, and discard any carry out of the sign bit position. Numerical examples for
addition are shown below. Note that negative numbers must initially be in 2’s complement and that if the sum obtained after the
addition is negative, it is in 2’s complement form.

+6 00000110 -6 11111010
+13 00001101 +13 00001101
+19 00010011 +7 00000111

In each of the four cases, the operation performed is always addition, including the sign bits. Any carry out of the sign bit position
is discarded, and negative results are automatically in 2’s complement form.

Unit II : Information Representation Page 9


Arithmetic subtraction:
Subtraction of two signed binary numbers when negative numbers are in 2’s complement form is very simple.
The complement of a negative number in complement form produces the equivalent positive number.
Ex: (-6) – (-13) = +7
In binary with 8 bits this is written as 11111010 – 11110011.
The subtraction is changed to addition by taking the 2’s complement of (-13) to give (+13).
Ie., 11110011  2’s complement is  0000 1101
In binary this is 11111010 + 00001101 = 100000111.
Removing the end carry, we obtain the correct answer 00000111 (+7)

It is worth noting that binary numbers in the signed 2’s complement system are added and subtracted by the same basic addition
and subtraction rules as unsigned numbers.
Therefore, computers need only one common hardware circuit to handle both types of arithmetic.

Overflow:
When two numbers of n digits each are added and the sum occupies n+1 digits, we say that an overflow occurred.
An overflow is a problem in digital computers because the width of registers is finite.
A result that contains n+1 bits cannot be accommodated in a register with a standard length of n bits. For this reason,
many computers detect the occurrence of an overflow, and when it occurs, a corresponding flip-flop is set which can then be
checked by the user.
An overflow may occur if the two numbers added are both positive or both negative.

Example: Two signed binary numbers, +70 and +80, are stored in two 8bit registers.
carries : 0 1 carries: 1 0
+70 0 1000110 -70 1 0111010
+80 0 1010000 -80 1 0110000
+150 1 0010110 -150 0 1101010

Note that the 8 bit result that should have been positive has a negative sign bit and the 8bit result that should have been negative
has a positive sign bit. If, however, the carry out of the sign bit position is taken as the sign bit of the result, the 9 bit answer so
obtained will be correct.
Since the answer cannot be accommodated within 8 bits, we say that an overflow occurred. If the two carries are applied to an
exclusive-OR gate, an overflow will be detected when the output of the gate is equal to 1.

iii) Representation Of Numbers, Operand Of Code And Address


Other binary codes for decimal numbers and alphanumeric characters are sometimes used.
Gray code:: This is an unweighted code. It means that there are no specific weights assigned to the bit position. This code is not
suitable for arithmetic operations, but it is very useful for input-output devices, Analog to digital conversion etc., and the machines
which use Shaft encoders as sensors.
The following table gives the comparison of decimal, binary and gray codes. 4bit Gray code
Decimal Binary Code Gray Code
0 0000 0000
1 0001 0001
2 0010 0011
3 0011 0010
4 0100 0110
5 0101 0111
6 0110 0101
7 0111 0100
8 1000 1100
9 1001 1101
Note: Left most bit is the first binary digit as the first gray code. Then move from left to right and add each adjacent pair of
binary digit to get the next gray code digit, neglect carries if any.
Ex: 1010 = ?
(1) (2) (3) (4)
1 0 1 0

Unit II : Information Representation Page 10


1
Add (1) + (2)  1 + 0 = 1 and Add (2) + (3)  0 +1 = 1 and Add (3) + (4)  1 + 0 = 1 then result is 1111  gray code
BCD(Binary –Coded decimal)
it is based on the idea of converting each decimal digits into its equivalent binary number. It means each decimal is represented b
binary code of 4 bits. The devices such as Electronic calculators, Digital voltmeters, frequency counters, electronic counters, digital
clocks etc, work with BCD numbers. BCD codes have also been used in early computers. Modern computers do not use BCD
numbers as they have to process names and other non numeric data.
Decimal BCD
0 0000
1 0001
2 0010
3 0011
4 0100
5 0101
6 0110
7 0111
8 1000
9 1001
10 0001 0000
11 0001 0001
12 0001 0010
….. ……
77 0111 0111
Hexadecimal Versus BCD
The Hexadecimal system utilizes the full capacity of four binary bits, whereas BCD codes do not utilize the same. The BCD codes
do not utilize the binary codes from 1010 to 1111. In the hexadecimal system an 8 bit word can represent up to FF, that is
11111111 ( 255 decimal) whereas in BCD only up to 10011001 ( 99 decimal). Hence the hexadecimal is a compact form of
representation, and it occupies less memory space, thereby reducing the hardware cost. The arithmetic operations are also simpler
in hexadecimal system.

Alpha numeric Code: ASCII (American standard code for information interchange)
It is the standardized alphanumeric code and most widely used by several computer manufacturers as their computer’s internal
code. It is a 7 bit alphanumeric code which has 2 7 =128 different characters to encode 85 characters. ( 52 lowercse and uppercase
alphabets, 10 numerals and 23 punctuation and others symbols as marked on keyboards printers,video display etc.,)
ASCII code can be classified into 2 types as specified below.
(i) ASCII -7 : 7 bit code, which represents 27 =128 different characters. In 7 bits, the first 3 bit represent zone bit and
next 4 bit represent digit.
(ii) ASCII-8 : 8 bit code, which represent 28 = 256 different characters. In 8 bits, the first 4 bit represent zone bit and
next 4 bit represent digit.
ASCII 7 code for characters
LSB MSB b6b5b4
b3b2b1b0 010 011 100 101 110 111
0000 SPACE 0 @ P - P
0001 ! 1 A Q A Q
0010 “ 2 B R B R
0011 # 3 C S C S
0100 $ 4 D T D T
0101 % 5 E U E U
0110 & 6 F V F V
0111 ‘ 7 G W G W
1000 ( 8 H X H X
1001 ) 9 I Y I Y
1010 * : J Z J Z
1011 + ; K [ K {
1100 ‘ < L \ L |
1101 - = M ] M }
1110 . > N ^ N ~

Unit II : Information Representation Page 11


1111 / ? O _ O Del

For instance, the letter ‘A’ has the bits b6b5b4 of 100 and the bits b3b2b1b0 of 0001. Therefore, A is represented in ASCII code as
100 0001  41 (hexadecimal)
Character ASCII -7 Code Hexadecimal Equivalent
Zone Digit
0 011 0000 30
1 011 0001 31
2 011 0010 32
… … …. ..

A 100 0001 41
B 100 0010 42
C 100 0011 43
… … … …

The 8 bit ASCII-8 codes…..


Character ASCII -8 Code Hexadecimal Equivalent
Zone Digit
0 0101 0000 50
1 0101 0001 51
2 0101 0010 52
… … …. ..

A 0100 0001 A1
B 0100 0010 A2
C 0100 0011 A3
… … … …

iv) Conversion Of Number System


Computers use binary numbers for internal data representation whereas they use decimal
numbers externally. Therefore, there should be some conversion between number systems in
order to represent data in a computer that is originally represented in other number systems.
Some conversion methods are discussed below.
The right most bit is called Least Significant Bit (LSB) and left Most Bit is called Most Significant Bit (MSB).

Ie., 100111

MSB LSB

Conversion from Binary to Decimal

In the binary to decimal conversion, each digit of the binary number is multiplied by its weighted position, and
each of the weighted values is added together to get the decimal number. The binary number system have a base 2, the position
weights are used on the power of 2.

Ex: 100111 = ?
1 x 25 + 0x 24 + 0x 23 + 1x22 + 1x21 + 1x20
1 x 32 + 0x 16 + 0x 8 + 1x4 + 1x2 + 1x1 = 39
100111 = 39  Ans.
Ex- 2: 0.1010 = ?
1 x 2-1 + 0x 2-2 + 1x 2-3 + 0x2-4
1x(1/2) + 0x(1/4) + 1x (1/8) + 0 x (1/16)
1x0.5 + 0x0.25 + 1x 0.125 + 0 x 0.0625
0.1010 = 0.625  Ans.

Unit II : Information Representation Page 12


Ex-3: 1101.1010 = ?
(1 x 23 + 1x 22 + 0x 21 + 1x20 ) + (1 x 2-1 + 0x 2-2 + 1x 2-3 + 0x2-4 )
(1 x 8 + 1x 4 + 0x 2 + 1x1) + (1x0.5 + 0x0.25 + 1x 0.125 + 0 x 0.0625 )
( 8 + 4 + 0 + 1) + (0.5 + 0 + 0. 125 + 0 ) = 13.625
1101.1010 = 13.625  Ans.

Conversion from Decimal to Binary

Conversion from binary to its equivalent decimal and from decimal to its equivalent binary is possible. The method, which is used
for the conversion of decimal into binary, is often called asthe remainder method. This method involves the following steps.

- Begin by dividing the decimal number by 2 (the base of binary number system)

- Note the remainder separately as the rightmost digit of the binary equivalent

- Continually repeat the process of dividing by 2 until quotient is zero and keep writing the remainders after each step of
division (these remainders will either be 0 or 1)- Finally, when no more division can occur, write down the remainders in reverse

Ex: 15 = ?
2 15
2 7 - 1
2 3 - 1
1 - 1

15 = 1111  Ans

Ex 2: 0.625 = ?
0.625 x 2 = 1.25  0.25 with a carry of 1 (MSB)
0.25 x 2 = 0.50  0.50 with a carry of 0
0.50 x 2 = 1.00  0.00 with a carry of 1 (LSB)
0.625 = 0.101

Ex 2: 0.39 = ?
0.39 x 2 = 0.78  0.78 with a carry of 0
0.78 x 2 = 1.56  0.56 with a carry of 1
0.56 x 2 = 1.12  0.12 with a carry of 1
0.39 = 0.011
Note: in this example it is seen that the fraction has not become zero, and that will continue further. For such a case an
approximation is made. For this example, we may take the result up to 3 binary bits after the binary point.

Conversion from Decimal to Octal:

Ex: 3977 = ?
8 3977
8 497 -1
8 62 - 1
7 - 6

3977 = 7 611  Ans


Ex 2: 0.39 = ?
0.39 x 8 = 3.12  0.12 with a carry of 3
0.12 x8 = 0.96  0.96 with a carry of 0

Unit II : Information Representation Page 13


0.96 x 8 = 7.68  0.68 with a carry of 7
0.68 x 8 = 5.44  0.44 with a carry of 5
0.39 = 0.3075
Conversion from Octal to Decimal:
The binary number system has a base 8, the position weights are used on the power of 8.
Ex: 3077 = ?
3 x 83 + 0x 82 + 7x 81 + 7x80
3 x 512 + 0x 64 + 7x 8 + 7x1 = 1599
3077 = 1599  Ans.
Conversion from Binary to Octal :
Ex: 10011.11001 = ?
 010 011 . 110 010
 2 3 6 2
= 23.62

Conversion from Octal to Binary :


Ex1: 37 Ex2: 377.77
= 011 111 011 111 111 . 111 111
=011111 =011111111.111111
Conversion from Decimal to Hexadecimal:

Ex: 39 = ?
16 39
2 - 7
39 = 27  Ans

Ex: 256 = ?
16 256
16 16 - 0
1 - 0

256 = 100  Ans

Ex: 1723.256 = ?
16 1723
16 107 -11
6 - 11

0.256 x 16 = 4.096  0.096 with a carry of 4


0.096 x16 = 1.536  0.536 with a carry of 1
0.536 x 16 = 8.576  0.576 with a carry of 8
0.576 x 16 = 9.216  0.216 with a carry of 9

1723.256 = 6BB.4189  Ans

Conversion from Hexadecimal to Decimal:


The binary number system has a base 16, the position weights are used on the power of 16.
Ex: 39A = ?
3 x 162 + 9x 161 + Ax 160
3 x 256 + 9x 16 + Ax 1
3 x 256 + 9x 16 + 10x 1 = 922 ( i.e., decimal 10 for A Hex)
39A = 922  Ans.

Ex: 3A.2F = ?
3x 161 + Ax 160 . 2 X 16-1 + 15 X 16-2
Unit II : Information Representation Page 14
=48+10 . (2/10) + ( 15 / 162)
= 58.1836
Conversion from Binary to Hexadecimal :
Ex: 11100101110111
=0011 1001 0111 0111
=3 9 7 7
=3977
Ex: 110101001.0010110
=0001 1010 1001 . 0010 1100
=1 A 9 . 2 C

Conversion from Hexadecimal to Binary :


Ex: 39A
=0011 1001 1010
Octal  Binary  Hexadecimal:
7521  Octal
111 101 010 001  Binary
1111 0101 0001  Hexadecimal
Hexadecimal  Octal:
CBAED  Hexadecimal
C B A E D
1100 1011 1010 1110 1101
011 001 011 101 011 101 101
3 1 3 5 3 5 5
CBAED 3135355

Binary to Gray Code:


Ex: 1010 = ?
(1) (2) (3) (4)
1 0 1 0

1
Add (1) + (2)  1 + 0 = 1
Add (2) + (3)  0 +1 = 1
Add (3) + (4)  1 + 0 = 1 then result is 1111  gray code
Gray Code to binary:
Ex: 1111 = ?
(1) (2) (3) (4)
1 1 1 1

1  (5)
Add (5) + (2)  1 +1 =0  (6) note: discard carry 1
Add (6) + (3)  0 +1 = 1  (7)
Add (7) + (4)  1 +1 = 0 note: discard carry 1
then result is 1010  Binary code

Unit II : Information Representation Page 15

You might also like