Welcome to Scribd, the world's digital library. Read, publish, and share books and documents. See more ➡
Standard view
Full view
of .
×
0 of .
Results for:
P. 1
Lecture2 Data Rep

# Lecture2 Data Rep

Ratings: (0)|Views: 336|Likes:

### Availability:

See More
See less

08/09/2010

pdf

text

original

E1.2 Digital Electronics 12.116 October 2008
Lecture 2: Data Representation
Dr Pete Sedcole
Department of E&E EngineeringImperial College Londonhttp://cas.ee.ic.ac.uk/~nps/ (Floyd 2.1 –2.4, 2.8, 2.10 –2.11)(Tocci2.1 2.8)

E1.2 Digital Electronics 12.216 October 2008
In this lecture:
What do we mean by data?How can data be represented electronically?What number systems are usually used, and why?How do number systems in different bases work?How do you convert a number from decimal to binaryand binary to decimal?
E1.2 Digital Electronics 12.316 October 2008
What do we mean by
data
?
It depends on context, but we will say:data = physical representation of informationData can be
stored
–e.g.: computer disk, DVD, SIM cardData can be
transmitted
–e.g.: fax, text messageData can be
processed
–e.g.: cash till
E1.2 Digital Electronics 12.416 October 2008
Electronic representation of data
Information can be complex –e.g.: numbers, music, picturesWhat can we do using electronics? –Set up voltages and currents –Change voltages and currentsA useful device is a switch closed:V = 0 Volts open:V = 5 Volts
5 VoltsSwitchRV

E1.2 Digital Electronics 12.516 October 2008
We can represent information using voltage levelsThe simplest information is TRUE/FALSE –This can be represented by two voltage levels:
5 Volts = TRUE0 Volts = FALSE
A unit of information that has only two possible values isalso called a BIT(short for Binary Digit)Why do we use binary data in electronics? –Simple to implement in hardware: we only needswitches –Good tolerance to noise
E1.2 Digital Electronics 12.616 October 2008
Number systems
E1.2 Digital Electronics 12.716 October 2008
Decimal numbers
Deci= tenThe decimal number system has ten digits:0, 1, 2, 3, 4, 5, 6, 7, 8, 9.The decimalnumber system has a base of 10, witheach digit position weighted by a power of 10:
decimal point10
-4
10
-3
10
-2
10
-1
10
0
10
1
10
2
10
3
o   n   e  s    t    h  o   u  s   a   n   d    t    h  s    t   e   n    t    h  s    h   u   n   d   r   e   d    t    h  s    t   e   n  -    t    h  o   u  s   a   n   d    t    h  s    t    h  o   u  s   a   n   d  s    t   e   n  s    h   u   n   d   r   e   d  s
LSDMSDMSD = mostsignificant digitLSD = leastsignificant digit
E1.2 Digital Electronics 12.816 October 2008
Binary numbers
Bi = twoThe binary number system has two digits:0 and 1.The binarynumber system has a base of 2with eachdigit position weighted by a power of 2:
2
-4
2
-3
2
-2
2
-1
2
0
2
1
2
2
2
3
binary pointMSBLSBMSB = mostsignificant bitLSB = leastsignificant bit

E1.2 Digital Electronics 12.916 October 2008
Binary number system
A binary number uses the digits 0 and 1Subscript
2
indicates the number is in binary notation(base 2)Example: 10011
2
is:
11001
2
0
2
1
2
2
2
3
2
4
1 x 2
4
+ 0 x 2
3
+ 0 x 2
2
+ 1 x 2
1
+ 1 x 2
0
= 19
E1.2 Digital Electronics 12.1016 October 2008
Integers and fractions in binary
Binary numbers can represent fractional values as wellas integers –e.g.: 10011.011
2
10011.011
2
is an 8-bit numberIt is in Q3format –it has 3 bits after the binary pointWhat if we want to represent (19.376)
10
with an 8-bitbinary number?
0
2
-1
1
2
-2
1
2
0
11001
2
-3
2
1
2
2
2
3
2
4
= (19.375)
10

E1.2 Digital Electronics 12.1116 October 2008
Conversion: decimal to binary (method 1)
Express the decimal number as the sum of powers of 21s and 0s written in the corresponding bit positions
Example 1:50
10
= 32 + 18= 32 + 16 + 2= 1x2
5
+ 1x2
4
+ 1x2
1
50
10
= 110010
2
Example 2:338.5
10
= 256 + 82.5= 256 + 64 + 18.5= 256 + 64 + 16 + 2.5= 256 + 64 + 16 + 2 + 0.5= 1x2
8
+ 1x2
6
+ 1x2
4
+ 1x2
1
+ 1x2
-1
338.5
10
= 101010010.1
2E1.2 Digital Electronics 12.1216 October 2008
Conversion: decimal to binary (method 2)
Repeated division
quotientremainder50/2=250LSB25/2=12112/2=606/2=303/2=111/2=01MSB
50
10
= 110010
2

## Activity (2)

### Showing

AllMost RecentReviewsAll NotesLikes