looking inside the black box input output cpu storage –secondary - hard drives –primary - ram,...
TRANSCRIPT
Looking Inside the Black Box• Input
• Output
• CPU
• Storage– Secondary - Hard Drives– Primary - RAM, ROM
Storing Data• Computers store Digital Data
• Two type of data– Digital – can be compressed– Analog
• Digital data – stored as digital data
• Text data – stored as ASCII codes (digital)
• Analog data – converted to digital
Storing Data – Binary Numbers• Binary Numbers
Storing Data – Binary Numbers
0 01 12 103 114 1005 1016 1107 1118 10009 100110 1010
11 101112 110013 110114 111015 111116 1000017 1000118 1001019 1001120 10100
Storing Data – Binary Numbers
8 bits 0 = 00000000
1 = 00000001
2 = 00000010
...
254 = 11111110
255 = 11111111
16 bits 0 = 0000000000000000 1 = 0000000000000001 2 = 0000000000000010 ...65534 = 111111111111111065535 = 1111111111111111
Used to store digital data
Storing Data – Hexadecimal
Base 16 0 = 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
•Easy way to represent binary numbers•Easy to convert between hex and binary
Storing Data – ASCII
DIGIT
0
1
2
3
4
5
6
7
8
9
ASCII REPRESENTATION
0101 0000
0101 0001
0101 0010
0101 0011
0101 0100
0101 0101
0101 0110
0101 0111
0101 1000
0101 1001
LETTER
A
B
C
D
E
F
G
H
I
ASCII REPRESENTATION
1010 0001
1010 0010
1010 0011
1010 0100
1010 0101
1010 0110
1010 0111
1010 1000
1010 1001
Used to store text based
32 blank 00100000 65 A 01000001 66 B 01000010 67 C 01000011 68 D 01000100 69 E 01000101 70 F 01000110 71 G 01000111 72 I 01001000 73 I 01001001 74 J 01001010 75 K 01001011 76 L 01001100 77 M 01001101 78 N 01001110 79 O 01001111 80 P 01010000 81 Q 01010001 82 R 01010010 83 S 01010011 84 T 01010100
97 a 01100001 98 b 01100010 99 c 01100011 100 d 01100100 101 e 01100101 102 f 01100110 103 g 01100111 104 h 01101000 105 i 01101001 106 j 01101010 107 k 01101011 108 l 01101100 109 m 01101101 110 n 01101110 111 o 01101111 112 p 01110000 113 q 01110001 114 r 01110010 115 s 01110011 116 t 01110100 117 u 01110101
ASCII• Full ASCII Table
http://www.micron.com/education/present/binary/html/ascii.html
F o u r a n d s e v e n
70 111 117 114 32 97 110 100 32 115 101 118 101 110 32
Storing Data – Analog Data• Must be converted to Digital
• Sample demo
Converting Between Number Systems
• Binary to Decimal
• Decimal to Binary
• Binary to Hex
• Hex to Binary
Converting Between Number Systems
Decimal
107 106 105 104 103 102 101 100
10000000 1000000 100000 10000 1000 100 10 1
Binary
27 26 25 24 23 22 21 20
128 64 32 16 8 4 2 1
Converting Between Number Systems
Binary >Decimal
10010011 > decimal
11111111 > decimal
Decimal > Binary
128 > binary
100 > binary
Hex > Binary
1A > binary
0F > binary
Binary > Hex
10010011 > hex
11111111 > hex
ASCII > Decimal
A > decimal
a > decimal
Decimal > ASCII
01001111 > ascii
01011010 > ascii
Coding Data for Processing by a Computer
• Pixels
• Data Compression– Lossy - examples– Lossless - examples– ?Examples of file types
Data CompressionBinary Data00000000 00000000 00000000 00000000 00001111 11111111 11111111 11111111 11111111
11111111 11111111 11111111
0 0 0 0 16 255 255 255 255 255 255 255 \
12 bytes
Compressed Data 4,0 16 7,255
5 bytes
Compression Examples BMP (422kb)
Compression ExamplesJPG 10% (66kb)
Compression Examples JPG 85% (15kb)
Compression - LZ• Lempel – Ziv
• WinZip
• Dictionary to eliminate redundancy
From - HowStuffWorks.com
Compression - LZ• Example
– "Ask not what your country can do for you -- ask what you can do for your country.“ = 79 chrs
– Dictionary: 1.ask 2.what 3.your 4.country 5.can 6.do 7.for 8.you
“1 not 2 3 4 5 6 7 8 -- 1 2 8 5 6 7 3 4" = 37 chrs
From - HowStuffWorks.com
Compression - LZ• Plus Dictionary = 37, Total = 74 vs 79
• Real LZ uses patterns not words1. ask__ 2. what__ 3. you 4. r__country 5. __can__do__for__you
"1not__2345--12354." = 16 chrs • Dictionary = 41, Total = 57
From - HowStuffWorks.com