0% found this document useful (0 votes)
70 views19 pages

1digital Number System

Digital systems use numeric representation systems like binary, decimal, octal and hexadecimal. Binary uses only two digits, 0 and 1. Octal uses digits 0-7 with 3 binary bits per octal digit. Hexadecimal uses digits 0-9 and A-F, with 4 binary bits per hexadecimal digit. Converting between these systems involves determining the place value of each digit based on its position, and adding or dividing place values as needed to convert between bases. For example, binary 10112 converts to decimal 5 by adding the place values of the 1s (4 + 1 = 5).

Uploaded by

Asha Joshi
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 DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
70 views19 pages

1digital Number System

Digital systems use numeric representation systems like binary, decimal, octal and hexadecimal. Binary uses only two digits, 0 and 1. Octal uses digits 0-7 with 3 binary bits per octal digit. Hexadecimal uses digits 0-9 and A-F, with 4 binary bits per hexadecimal digit. Converting between these systems involves determining the place value of each digit based on its position, and adding or dividing place values as needed to convert between bases. For example, binary 10112 converts to decimal 5 by adding the place values of the 1s (4 + 1 = 5).

Uploaded by

Asha Joshi
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 DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 19

Digital Number System

Part-I

mbering System
ny number systems are in use in digital technology. The most common are the
cimal, binary, octal, and hexadecimal systems. The decimal system is clearly the
st familiar to us because it is a tool that we use every day. Examining some of its
aracteristics will help us to better understand the other systems. In the next few pages
shall introduce four numerical representation systems that are used in the digital
stem. There are other systems, which we will look at briefly.
 Decimal
 Binary
 Octal
 Hexadecimal

cimal System
e decimal system is composed of 10 numerals or symbols. These 10 symbols are 0,
2, 3, 4, 5, 6, 7, 8, 9. Using these symbols as digits of a number, we can express any
antity. The decimal system is also called the base-10 system because it has 10 digits.

3
102 101 100 10-1 10-2 10-3
000 =100 =10 =1 . =0.1 =0.01 =0.001
Least
st Significant Digit Decimal point Significant
Digit

en though the decimal system has only 10 symbols, any number of any magnitude
n be expressed by using our system of positional weighting.

cimal Examples
 3.1410
 5210
 102410
 6400010

nary System
he binary system, there are only two symbols or possible digit values, 0 and 1. This
se-2 system can be used to represent any quantity that can be represented in decimal
other base system.

22 21 20 2-1 2-2 2-3


=4 =2 =1 . =0.5 =0.25 =0.125
Least
st Significant Digit Binary point Significant
Digit

nary Counting
e Binary counting sequence is shown in the table:

22 21 20 Decimal
0 0 0 0
0 0 1 1
0 1 0 2
0 1 1 3
1 0 0 4
1 0 1 5
1 1 0 6
1 1 1 7
0 0 0 8
0 0 1 9
0 1 0 10
0 1 1 11
1 0 0 12
1 0 1 13
1 1 0 14
1 1 1 15

presenting Binary Quantities


digital systems the information that is being processed is usually presented in binary
m. Binary quantities can be represented by any device that has only two operating
tes or possible conditions. E.g.. a switch is only open or closed. We arbitrarily (as we
ine them) let an open switch represent binary 0 and a closed switch represent binary
Thus we can represent any binary number by using series of switches.

pical Voltage Assignment


nary 1: Any voltage between 2V to 5V
nary 0: Any voltage between 0V to 0.8V
t used: Voltage between 0.8V to 2V in 5 Volt CMOS and TTL Logic, this may cause
or in a digital circuit. Today's digital circuits works at 1.8 volts, so this statement may
hold true for all logic circuits.
e can see another significant difference between digital and analog systems. In digital
stems, the exact voltage value is not important; eg, a voltage of 3.6V means the same
a voltage of 4.3V. In analog systems, the exact voltage value is important.

e binary number system is the most important one in digital systems, but several
ers are also important. The decimal system is important because it is universally
ed to represent quantities outside a digital system. This means that there will be
uations where decimal values have to be converted to binary values before they are
ered into the digital system.

additional to binary and decimal, two other number systems find wide-spread
plications in digital systems. The octal (base-8) and hexadecimal (base-16) number
stems are both used for the same purpose- to provide an efficient means for
resenting large binary system.

tal System
e octal number system has a base of eight, meaning that it has eight possible digits:
,2,3,4,5,6,7.

82 81 80 8-1 8-2 8-3


12 =64 =8 =1 . =1/8 =1/64 =1/512
Least
st Significant Digit Octal point Significant
Digit

tal to Decimal Conversion

 2378 = 2 x (82) + 3 x (81) + 7 x (80) = 15910


 24.68 = 2 x (81) + 4 x (80) + 6 x (8-1) = 20.7510
 11.18 = 1 x (81) + 1 x (80) + 1 x (8-1) = 9.12510
 12.38 = 1 x (81) + 2 x (80) + 3 x (8-1) = 10.37510
xadecimal System
e hexadecimal system uses base 16. Thus, it has 16 possible digit symbols. It uses
digits 0 through 9 plus the letters A, B, C, D, E, and F as the 16 digit symbols.

3
162 161 160 16-1 16-2 16-3
=1/25
096 =256 =16 =1 . =1/16 =1/4096
6
Least
Hexa Decimal
st Significant Digit Significant
point
Digit

xadecimal to Decimal Conversion

Part-II

Code Conversion
Converting from one code form to another code form is called code
conversion, like converting from binary to decimal or converting from
hexadecimal to decimal.

Binary-To-Decimal Conversion
Any binary number can be converted to its decimal equivalent simply by
summing together the weights of the various positions in the binary
number which contain a 1.

Binary Decimal
110112
24+23+01+21+20 =16+8+0+2+1
Result 2710
and

Binary Decimal
101101012
27+06+25+24+03+22+01+20 =128+0+32+16+0+4+0+1
Result 18110

You should have noticed that the method is to find the weights (i.e.,
powers of 2) for each bit position that contains a 1, and then to add them
up.

Decimal-To-Binary Conversion

There are 2 methods:

 Reverse of Binary-To-Decimal Method


 Repeat Division

Reverse of Binary-To-Decimal Method

Decimal Binary
4510 =32 + 0 + 8 + 4 +0 + 1
=25+0+23+22+0+20
Result =1011012

Repeat Division-Convert decimal to binary


This method uses repeated division by 2.
Convert 2510 to binary

Division Remainder Binary


25/2 = 12+ remainder of 1 1 (Least Significant Bit)
12/2 = 6 + remainder of 0 0
6/2 = 3 + remainder of 0 0
3/2 = 1 + remainder of 1 1
1/2 = 0 + remainder of 1 1 (Most Significant Bit)
Result 2510 = 110012

The Flow chart for repeated-division method is as follows:


Binary-To-Octal / Octal-To-Binary Conversion

Octal Digit 0 1 2 3 4 5 6 7
Binary
000 001 010 011 100 101 110 111
Equivalent

Each Octal digit is represented by three binary digits.

Example:
100 111 0102 = (100) (111) (010)2 = 4 7 28

Repeat Division-Convert decimal to octal

This method uses repeated division by 8.

Example: Convert 17710 to octal and binary

Division Result Binary


177/8 = 22+ remainder of 1 1 (Least Significant Bit)
22/ 8 = 2 + remainder of 6 6
2/8 = 0 + remainder of 2 2 (Most Significant Bit)
Result 17710 = 2618
Binary = 0101100012

Hexadecimal to Decimal/Decimal to Hexadecimal Conversion


Example:
2AF16 = 2 x (162) + 10 x (161) + 15 x (160) = 68710

Repeat Division- Convert decimal to hexadecimal


This method uses repeated division by 16.

Example: convert 37810 to hexadecimal and binary:

Division Result Hexadecimal


378/16 = 23+ remainder of 10 A (Least Significant Bit)23
23/16 = 1 + remainder of 7 7
1/16 = 0 + remainder of 1 1 (Most Significant Bit)
Result 37810 = 17A16
Binary = 0001 0111 10102

Binary-To-Hexadecimal /Hexadecimal-To-Binary Conversion

Hexadecimal Digit 0 1 2 3 4 5 6 7
Binary Equivalent 0000 0001 0010 0011 0100 0101 0110 0111

Hexadecimal Digit 8 9 A B C D E F
Binary Equivalent 1000 1001 1010 1011 1100 1101 1110 1111

Each Hexadecimal digit is represented by four bits of binary digit.

Example:

1011 0010 11112 = (1011) (0010) (1111)2 = B 2 F16


Octal-To-Hexadecimal Hexadecimal-To-Octal Conversion

 Convert Octal (Hexadecimal) to Binary first.


 Regroup the binary number by three bits per group starting from
LSB if Octal is required.
 Regroup the binary number by four bits per group starting from LSB
if Hexadecimal is required.

Example:

Convert 5A816 to Octal.

Hexadecimal Binary/Octal
5A816 = 0101 1010 1000 (Binary)
= 010 110 101 000 (Binary)
Result = 2 6 5 0 (Octal)
Digital Number System
Part-III

Binary Codes
Binary codes are codes which are represented in binary system with
modification from the original ones. Below we will be seeing the following:

 Weighted Binary Systems


 Non Weighted Codes

Weighted Binary Systems


Weighted binary codes are those which obey the positional weighting
principles, each position of the number represents a specific weight. The
binary counting sequence is an example.

Decimal 8421 2421 5211 Excess-3


0 0000 0000 0000 0011
1 0001 0001 0001 0100
2 0010 0010 0011 0101
3 0011 0011 0101 0110
4 0100 0100 0111 0111
5 0101 1011 1000 1000
6 0110 1100 1010 1001
7 0111 1101 1100 1010
8 1000 1110 1110 1011
9 1001 1111 1111 1100

8421 Code/BCD Code


The BCD (Binary Coded Decimal) is a straight assignment of the binary
equivalent. It is possible to assign weights to the binary bits according to
their positions. The weights in the BCD code are 8,4,2,1.

Example: The bit assignment 1001, can be seen by its weights to represent
the decimal 9 because:

1x8+0x4+0x2+1x1 = 9

2421 Code
This is a weighted code, its weights are 2, 4, 2 and 1. A decimal number is
represented in 4-bit form and the total four bits weight is 2 + 4 + 2 + 1 = 9.
Hence the 2421 code represents the decimal numbers from 0 to 9.

5211 Code
This is a weighted code, its weights are 5, 2, 1 and 1. A decimal number is
represented in 4-bit form and the total four bits weight is 5 + 2 + 1 + 1 = 9.
Hence the 5211 code represents the decimal numbers from 0 to 9.

Reflective Code
A code is said to be reflective when code for 9 is complement for the code
for 0, and so is for 8 and 1 codes, 7 and 2, 6 and 3, 5 and 4. Codes 2421,
5211, and excess-3 are reflective, whereas the 8421 code is not.

Sequential Codes
A code is said to be sequential when two subsequent codes, seen as
numbers in binary representation, differ by one. This greatly aids
mathematical manipulation of data. The 8421 and Excess-3 codes are
sequential, whereas the 2421 and 5211 codes are not.

Non Weighted Codes


Non weighted codes are codes that are not positionally weighted. That is,
each position within the binary number is not assigned a fixed value.

Excess-3 Code
Excess-3 is a non weighted code used to express decimal numbers. The
code derives its name from the fact that each binary code is the
corresponding 8421 code plus 0011(3).

Example: 1000 of 8421 = 1011 in Excess-3

Gray Code
The gray code belongs to a class of codes called minimum change codes, in
which only one bit in the code changes when moving from one code to the
next. The Gray code is non-weighted code, as the position of bit does not
contain any weight. The gray code is a reflective digital code which has the
special property that any two subsequent numbers codes differ by only one
bit. This is also called a unit-distance code. In digital Gray code has got a
special place.

Decimal Number 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
10 1010 1111
11 1011 1110
12 1100 1010
13 1101 1011
14 1110 1001
15 1111 1000

Binary to Gray Conversion

 Gray Code MSB is binary code MSB.


 Gray Code MSB-1 is the XOR of binary code MSB and MSB-1.
 MSB-2 bit of gray code is XOR of MSB-1 and MSB-2 bit of binary
code.
MSB-N bit of gray code is XOR of MSB-N-1 and MSB-N bit of binary
code.

Digital Number System


Error Detecting and Correction Codes

nsmission and storage of digital data, error detection and correction is required.
ew examples of codes which permit error detection and error correction after

Detecting Codes
data is transmitted from one point to another, like in wireless transmission, or it is
ored, like in hard disks and memories, there are chances that data may get
ed. To detect these data errors, we use special codes, which are error detection

ty codes, every data byte, or nibble (according to how user wants to use it) is
ed if they have even number of ones or even number of zeros. Based on this
ation an additional bit is appended to the original data. Thus if we consider 8-bit
dding the parity bit will make it 9 bit long.

receiver side, once again parity is calculated and matched with the received parity
and if they match, data is ok, otherwise data is corrupt.

are two types of parity:


Even parity: Checks if there is an even number of ones; if so, parity bit is zero.
When the number of ones is odd then parity bit is set to 1.
Odd Parity: Checks if there is an odd number of ones; if so, parity bit is zero. When
umber of ones is even then parity bit is set to 1.

Sums
arity method is calculated over byte, word or double word. But when errors need to
cked over 128 bytes or more (basically blocks of data), then calculating parity is not
ht way. So we have checksum, which allows to check for errors on block of data.
are many variations of checksum.

Adding all bytes


CRC
Fletcher's checksum
Adler-32

mplest form of checksum, which simply adds up the asserted bits in the data,
detect a number of types of errors. In particular, such a checksum is not changed

Reordering of the bytes in the message


nserting or deleting zero-valued bytes
Multiple errors which sum to zero

le of Checksum : Given 4 bytes of data (can be done with any number of bytes):
2h, 3Fh, 52h

Adding all bytes together gives 118h.


Drop the Carry Nibble to give you 18h.
Get the two's complement of the 18h to get E8h. This is the checksum byte.

st the Checksum byte simply add it to the original group of bytes. This should give
0h.
he carry nibble again giving 00h. Since it is 00h this means the checksum means
es were probably not changed.

Correcting Codes
orrecting codes not only detect errors, but also correct them. This is used normally
ellite communication, where turn-around delay is very high as is the probability of
etting corrupt.

Error correcting codes) are used also in memories, networking, Hard disk, CDROM,
tc. Normally in networking chips (ASIC), we have 2 Error detection bits and 1 Error
ion bit.
ing Code
ing code adds a minimum number of bits to the data transmitted in a noisy channel,
ble to correct every possible one-bit error. It can detect (not correct) two-bits errors
annot distinguish between 1-bit and 2-bits inconsistencies. It can't - in general -
3(or more)-bits errors.

ea is that the failed bit position in an n-bit string (which we'll call X) can be
ented in binary with log2(n) bits, hence we'll try to get it adding just log 2(n) bits.

we set m = n + log2(n) to the encoded string length and we number each bit position
g from 1 through m. Then we place these additional bits at power-of-two positions,
1, 2, 4, 8..., while remaining ones (3, 5, 6, 7...) hold the bit string in the original

e set each added bit to the parity of a group of bits. We group bits this way: we
group for every parity bit, where the following relation holds:

n(bit) AND position(parity) = position(parity)


hat: AND is the bit-wise boolean AND; parity bits are included in the groups; each
belong to one or more groups.)

1 groups bits 1, 3, 5, 7... while bit 2 groups bits 2, 3, 6, 7, 10... , bit 4 groups bits 4,
12, 13... and so on.

by definition, X (the failed bit position defined above) is the sum of the incorrect
bits positions (0 for no errors).

derstand why it is so, let's call X n the nth bit of X in binary representation. Now
er that each parity bit is tied to a bit of X: parity1 -> X 1, parity2 -> X2, parity4 -> X3,
-> X4 and so on - for programmers: they are the respective AND masks -. By
uction, the failed bit makes fail only the parity bits which correspond to the 1s in X,
h bit of X is 1 if the corresponding parity is wrong and 0 if it is correct.

hat the longer the string, the higher the throughput n/m and the lower the probability
o more than one bit fails. So the string to be sent should be broken into blocks
length depends on the transmission channel quality (the cleaner the channel, the
the block). Also, unless it's guaranteed that at most one bit per block fails, a
um or some other form of data integrity check should be added.
numeric Codes
nary codes that can be used to represent all the letters of the alphabet, numbers
athematical symbols, punctuation marks, are known as alphanumeric codes or
ter codes. These codes enable us to interface the input-output devices like the
ard, printers, video displays with the computer.

Code
stands for American Standard Code for Information Interchange. It has become a
standard alphanumeric code for microcomputers and computers. It is a 7-bit code
enting 27 = 128 different characters. These characters represent 26 upper case
(A to Z), 26 lowercase letters (a to z), 10 numbers (0 to 9), 33 special characters
mbols and 33 control characters.

bit code is divided into two portions, The leftmost 3 bits portion is called zone bits
e 4-bit portion on the right is called numeric bits.

it version of ASCII code is known as USACC-II 8 or ASCII-8. The 8-bit version can
ent a maximum of 256 characters.

C Code
C stands for Extended Binary Coded Decimal Interchange. It is mainly used with
omputer systems like mainframes. EBCDIC is an 8-bit code and thus accomodates
256 characters. An EBCDIC code is divided into two portions: 4 zone bits (on the
d 4 numeric bits (on the right).

Part-V

Floating
Point
Numbers
A real number or floating point number is a number which
has both an integer and a fractional part. Examples for
real real decimal numbers are 123.45, 0.1234, -0.12345,
etc. Examples for real binary numbers are 1100.1100,
0.1001, -1.001, etc. In general, floating point numbers
are expressed in exponential notation.
   
For example the decimal number
 30000.0 can be written as 3 x 104.
 312.45 can be written as 3.1245 x 102.

   
Similarly, the binary number 1010.001 can be written as
1.010001 x 103.
   
The general form of a number N can be expressed as
   
N = ± m x b±e.
   
Where m is mantissa, b is the base of number system
and e is the exponent. A floating point number is
represented by two parts. The number first part, called
mantissa, is a signed fixed point number and the second
part, called exponent, specifies the decimal or binary
position.
   
   
   
  Binary Representation of Floating Point Numbers
A floating point binary number is also represented as in
the case of decimal numbers. It means that mantissa and
exponent are expressed using signed magnitude notation
in which one bit is reserved for sign bit.
   
Consider a 16-bit word used to store the floating point
numbers; assume that 9 bits are reserved for mantissa
and 7 bits for exponent and also assume that the
mantissa part is represented in fraction system. This
implies the assumed binary point is at the mantissa sign
bit immediate right.
   

   
  Example
A binary number 1101.01 is represented as
Mantissa = 110101 = (1101.01)2 = 0.110101 X 24
   
Exponent = (4)10
Expanding mantissa to 8 bits we get 11010100
Binary representation of exponent (4)10 = 000100
   
The required representation is
   

   
   
   
   

You might also like