In this topic…

1 / 18

# In this topic… - PowerPoint PPT Presentation

I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.

## In this topic…

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript

Today's AgendaStarting the topicRepresenting Information as Bit PatternsWhat we intend to do today1. ASCII codes2. Representing Numeric Values3. Binary to Decimal conversions and vice versa4. Addition in Binary5. Fraction in Binary RRM related to this topic will be made available through CR.The presentation is quite long hence questions to be entertained at the end of the lecture

In this topic…

We will now consider how information is represented within machines in the form of bit patterns, focusing on popular methods for coding text, numerical data and images.Each of these systems has repercussions.Our goal is to understand these techniques.

• Representing Text
• Information in the form of text is normally represented by means of a code in which each of the different symbols in the text (such as letters of the alphabet or punctuation marks) is assigned a unique bit pattern.
• The text is then represented as a long string of bits in which the successive patterns represent the successive symbols in the text.

01001000

01100101

01101100

01101100

01101111

H

e

l

l

o

• ASCII
• Original ASCII - This code uses bit patterns of length 7 to represent the uppercase and lower case letters of the English alphabet, punctuation symbols, the digits 1 through 9 and certain control characters e-g line feeds, carriage returns and tabs.
• New ASCII - Today is often extended to an “eight bit per symbol” format by adding a 0 at the most significant end of each of the seven bit patterns.
• This technique not only produces a code in which each pattern fits conveniently into a typical byte size memory cell but also provides 128 additional bit patterns (those obtained by assigning the extra bit the value 1) that can represent symbols excluded in the original ASCI.
• The following diagram shows the message “hello” in ASCII
Other Codes
• Unicode – uses a unique pattern of 16 bits to represent each symbol. As a result, Unicode consists of 65536 different bit patterns enough to allow the most Chinese and Japanese symbols to be represented
• ISO- A code that will probably compete with Unicode is being developed by the International Organization for Standardization (also known as ISO). Using 32 bits to represent symbols, this code has the potential to represent more than 17 million symbols.
Representing Numeric Values
• Problems with representing numeric values using ACII
• Suppose we want to store the number 25, if we insist on storing it as coded symbols in ASCII (using 1 byte per symbol) we need a total of 16 bits.
• More over the largest number we can store using 16 bits is 99
• A more efficient approach is to store the value in its base 2 or binary representation.
• Binary Representation
• Using the above we represent numeric values using 0s and 1s
• Decimal System
• Recall
• Each position in representation is associated with a quantity
• In 375, 5 is in the position associated with the quantity one, 7 is in the position associated with the quantity ten, 3 is in the position associated with the quantity hundred.
• Each quantity is 10 times that of the quantity to its right.
• The value represented by the entire expression is obtained by multiplying the value of each digit by the quantity associated with that digits position and then adding those products.
• 375=(3*hundred)+(7*10)+(5*1)
Binary Representation
• The position of each digit in binary is also associated with a quantity except that the quantity associated with each position is twice the quantity associated with the position to its right
• The right-most digit in a binary representation is associated with the quantity one ( 20 ), the next position to the left is associated with( 21 ), the next is associated with a 4 ( 22 ), the next is associated with an eight ( 23 ), and so on.

Base ten system Base two system

3 7 5 positions quantity 1 0 1 1 positions quantity

One

Two

Four

Eight

One

Ten

Hundred

We multiply the values of each digit by the quantity associated with its position and add the results. For example, the value represented by 100101 is 37 as shown in the diagram

Value of bit

Positions quantity

1 0 0 1 0 1

1 * one = 1

0 * two = 0

1 * four = 4

0 * eight = 0

0 * sixteen = 0

1* thirty-two= 32

= 37

Binary Notation uses only 1 and 0 therefore this multiply-and-add process
• reduces merely to adding the quantities associated with the positions occupied by the 1’s.
• Thus the binary pattern 1011 represents the value eleven, because the 1s are found in the positions associated with the quantities one, two and eight.
• Note that the sequence of binary representations obtained by counting from zero to eight is the following
• 0
• 1
• 10
• 11
• 100
• 101
• 110
• 111
• 1000
Recall storing of numbers (using ASCII)
• Now recall our original problem of storing numeric data. Using binary notation, in one byte we can store any integer between 0 and 255 (00000000 to 11111111)
• And given 2 bytes, we can store integers from 0 to 65535.
• This is a drastic improvement over the ability to store only integers from 0 to 99 (in ASCII, using one byte per symbol)
• For this and other reasons, it is common to store numeric information in a form of binary notation rather than coded symbols.
• More on Binary notation
• A form of binary notatio implies variations of the binary system that will be discussed later
• e-g twos complement notation (for storing whole numbers because it provides a convenient method for representing negative numbers as well as positive)
• Floating point representation with numbers with fractional parts such as 4 ¾ or ¾
• Conclusion
• Thus a particular value such as 25 may be represented by several different bit patterns (coded characters, 2’s complement notation, or in floating point notation); conversely a particular bit pattern maybe given different interpretations
Exercise time (7 min)

00111010

+00011011

• Convert 101010 and 11111 to decimal
• Convert 32 and 15 to binary
Fractions in Binary
• To extend the binary notation to accommodate fractional values, we use the radix point in the same role as the decimal point in decimal notation.
• That is the digits to the left of the point represent the integer part of the value and are interpreted as in the binary system discussed previously
• The digits to its right represent the fractional part of the value and are interpreted in a manner similar to other bits, except that their positions are assigned fractional quantities
• The first position to the right of the radix is assigned a ½, the next is assigned a quantity1/4, the next 1/8 and so on
• Each position is assigned a quantity twice the size of the one to its right.
• With these quantities assigned, decoding a binary representation containing a radix point requires the same procedure as used without a radix point.
• To add binary representations having radix points, we merely align the radix points and apply the same addition process as before. For example 10.011 added to 100.11 produces 111.001