Post on 30-Dec-2015
transcript
Chapter 8
Fluency with Information Technology4th edition
by Lawrence Snyder(slides by Deborah Woodall : woodall@mc.edu)
1
Computer Circuits
Computer circuits can be in one of two stateslow or high
Also known as:0 and 1off and onfalse and trueno and yesabsence and presence
2
Discrete Values
These two states of a circuit are said to be
discrete or distinct
3
Two States
• Low voltage in RAM, VRAM, or the CPU corresponds to– Demagnetized spot – Hard drive– Bump – CD or DVD
• High voltage in RAM, VRAM, or the CPU corresponds to– Magnetized spot – Hard drive– Land – CD or DVD
• Everything must be encoded into a representation using these two states (written as 0's and 1's).
4
Bits
• Each circuit is more commonly called a bit where bit is short for binary digit
• Why? The only digits in the binary number system are
0 and 1 which fit in perfectly with the two state
nature of a computer.
5
Number Systems
• Decimal number system– We know this!– base 10– 10 symbols 0 - 9– e.g. 1375, also written
(1 * 103) + (3 * 102) + (7 * 101) + (5 * 100)
• Binary number system– What is this?– base 2– 2 symbols 0 – 1– e.g. 1001, also written
(1 * 23) + ( 0 * 22) + (0 * 21) + ( 1 * 20)
6
Number Systems
• Decimal number system– We know this!– base 10– 10 symbols 0 - 9– e.g. 1375, also written
(1 * 103) + (3 * 102) + (7 * 101) + (5 * 100)
• Binary number system– What is this?– base 2– 2 symbols 0 – 1– e.g. 1001, also written
(1 * 23) + ( 0 * 22) + (0 * 21) + ( 1 * 20)
7
Encoding Text
• How many bits, minimum, would it take to encode…?
26 lowercase letters and 10 digits 36 total characters
8
Powers of 2This many bits Will encode this many
items
1 21 = 2
2 22 = 4
3 23 = 8
4 24 = 16
5 25 = 32
6 26 = 64
7 27 = 128
8 28 = 256
n 2n
9
Encoding Text
How many bits would it take to encode…? 26 lower case letters 26 upper case letters 10 digits 10 arithmetic characters 20 punctuation characters 3 non-printable characters 95 characters
10
How Many Bits to Encode 95 Characters?
11
This many bits Will encode this many items
1 21 = 2
2 22 = 4
3 23 = 8
4 24 = 16
5 25 = 32
6 26 = 64
7 27 = 128
8 28 = 256
n 2n
Encoding Text
• The original ASCII code was a 7-bit code.
• A widely used encoding scheme today is the Extended ASCII code or ISO-8859-1
• The Extended ASCII code is an 8-bit code.
• So, the code for one character will fit exactly into one byte.
12
ASCII code p. 235
• What is the ASCII code for each character?• H• &• 3
• What ASCII character is represented by each code?
• 0110 1010• 0011 1111• 1111 0001
13
ASCII Code
• The ASCII code is for encoding text only.
• ASCII 62 is 0011 0110 0011 0010
• The number 62 is 0000 0000 0011 1110
• The computer cannot do arithmetic with ASCII digits.
14
Encoding Text• Becoming more wide spread is a new multibyte (one
to four bytes) code called the Unicode
• It can handle all symbols in all languages
• To see other languages go to http://www.unicode.org/standard/WhatIsUnicode.html
15
कम्प्यू�टर, मू�ल रूप से , नं�बर� से सेम्ब�ध रखते हैं�। यू प्रत्यू क अक्षर और वर्ण क लिलए एक नं�बर निनंध$ रिरते करक अक्षर और वर्ण से�ग्रनिहैंते करते हैं�। यू�निनंक'ड क$ आनिवष्क$र हैं'नं से पहैंल , ऐसे नं�बर दे नं क लिलए से�कड� निवभि.न्न से�क ते लिलनिप
प्रर्ण$लिलयू$� थीं1। निकसे2 एक से�क ते लिलनिप मू3 पयू$ प्ते अक्षर नंहैं1 हैं' सेकते हैं� : उदे$हैंरर्ण क लिलए, यू�र'निपयू से�घ क' अक ल हैं2, अपनं2 से.2 .$षा$ऒं क' कवर करनं क लिलए अनं क निवभि.न्न से�क ते लिलनिपयू� क9 आवश्यूकते$ हैं'ते2 हैं;। अ�ग्र जी2 जी;से2 .$षा$ क लिलए .2, से.2 अक्षर�, निवर$मूलि=न्हैं� और से$मू$न्यू प्रयू'ग क तेकनं2क9 प्रते2क� हैं ते@ एक हैं2 से�क ते लिलनिप पयू$ प्ते
नंहैं1 थीं2।
Encoding Other Things
In chapter 11 we will look at encoding numbers, images and video.
16
Do you remember color codes?
Would you rather type this color code? 3 E C 5 A 7
Or this? 0011 1110 1100 0101 1010 0111
17
Hexadecimal
• Since the earliest days of computing, two hexadecimal digits have been used as a shorthand notation for 8 bits (one byte)
• If two hexadecimal digits symbolize one byte, then one hexadecimal digit must correspond in some way to 4 bits
18
Hexadecimal
• Base 16
• 16 symbols for building numbers: (0 – 9, A – F)
• Examples of hexadecimal numbers:• 387• 4AFFCC
19
Hexadecimal – Binary Equivalents0 0000
1 0001
2 0010
3 0011
4 0100
5 0101
6 0110
7 0111
8 1000
9 1001
A 1010
B 1011
C 1100
D 1101
E 1110
F 1111
• What would be the hexadecimal shorthand for this 2 byte binary code?
0011 1100 1111 0110
answer: 3CF6
• What would the one byte binary code that corresponds to this hexadecimal shorthand?
B5
answer: 1011 0101
20
Hexadecimal – Binary Equivalents0 0000
1 0001
2 0010
3 0011
4 0100
5 0101
6 0110
7 0111
8 1000
9 1001
A 1010
B 1011
C 1100
D 1101
E 1110
F 1111
• First column of bits: 8 zeros, 8 ones• Second column of bits: 4 zeros, 4 ones• Third column of bits: 2 zeros, 2 ones• Fourth column of bits: 1 zero, 1 one
21
Tags: A Higher Level of Encoding
• HTML tags are also a form of encoding– Formatting– Special non-text items
• Tags can also be used to encode – Structure– See the Oxford English Dictionary example in the
chapter
22