Bits, Bytes and Files. CS 1 Introduction to Computers and Computer Technology Rick Graziani Spring 2007. Digitization. Digitize – To represent information with digits or symbols . Digitization does not require any digits, any set of symbols will to.
Une image / un lien ci-dessous est fourni (tel quel) pour télécharger la présentation
Politique de téléchargement : le contenu du site vous est fourni TEL QUEL pour votre information et votre usage personnel ; il ne peut être vendu, concédé sous licence ni partagé sur d’autres sites sans l’accord de son auteur.Le contenu vous est fourni TEL QUEL, pour votre information et votre usage personnel uniquement.Téléchargez la présentation en cliquant sur ce lien.Lors du téléchargement, si vous ne parvenez pas à télécharger une présentation, l’éditeur a peut-être supprimé le fichier de son serveur.Pendant le téléchargement, si vous ne parvenez pas à obtenir une présentation, le fichier a peut-être été supprimé par l’éditeur.
F I N
Plus de contenu associé
Transcription de la présentation
Bits, Bytes and Files CS 1 Introduction to Computers and Computer Technology Rick Graziani Spring 2007
Digitization • Digitize – To represent information with digits or symbols. • Digitization does not require any digits, any set of symbols will to. • We use digits 0 through 9, do digitize a phone number: • (Area code) Prefix – Number • (aaa) ppp – nnnn • We use numbers, but we could have chosen any group of symbols. Rick Graziani graziani@cabrillo.edu
Digitization • The advantage of using digits instead symbols is they can be listed in numerical order. • Symbols can have an order to them, known as collating sequence, such as player encoding for DVD and VCR players. Rick Graziani graziani@cabrillo.edu
Encoding with Dice • Because information can be digitized using any symbols, consider a representation based on using dice. • Encoding - The process of putting information into a specific format (usually digital format). • A die has 6 unique patterns on it. • If we used a single die we could encode, represent, 6 pieces of information. • This would not be enough to represent the entire alphabet. A B C D E F Rick Graziani graziani@cabrillo.edu
Encoding with Dice • Two dice patterns together produce 6 x 6 = 36 different pattern sequences, because each die can be paired with each of 6 different patterns of the other die. • Three dice would produce 6 x 6 x 6 = 216 different pattern sequences. Pairing two dice patterns results in 36 = 6 6 possible pattern sequences. Rick Graziani graziani@cabrillo.edu
Encoding with Dice • If we used two dice to encode information… A B C D … F E G Rick Graziani graziani@cabrillo.edu
Encoding with Dice • Two dice patterns together produce 6 x 6 = 36 different pattern sequences. • Notice that only 26 of the 36 unique pattern sequences are needed for the 26 letters in the alphabet. Rick Graziani graziani@cabrillo.edu
Encoding with Dice • Encode the phrase CABRILLO COLLEGE using two dice. • Choose a sequence for the space. __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ __ Rick Graziani graziani@cabrillo.edu
C A B R I L L space O O L L E C G E space Rick Graziani graziani@cabrillo.edu
Encoding with Dice • The other 10 combinations could be used for numbers 0 through 9. • Or • It could be used for punctuation including an Escape Character or a Shift Key. space Rick Graziani graziani@cabrillo.edu
Encoding with Dice • Using one of the keys as a special character key, like the Shift Key, can double the number of possibilities for all other keys. • Using combinations of two keys, can triple the possible combinations, i.e. Control-Shift-Delete A a b c d e f g h i j k l Shift a m n o p q r s t u v w x y z Shift Rick Graziani graziani@cabrillo.edu
Moving to Bits… • Most fundamental form of information is the presence or absence of a physical phenomenon: • Is something there, or not? • Is light detected, or not? • Is it magnetized, or not? • PandA is the name we use for the fundamental patterns of digital information based on the presence or absence of a physical phenomenon. Rick Graziani graziani@cabrillo.edu
BIT – BInary digiT • In computer technology, the PandA unit is known as a bit. • Bit (Binary Digit) = Basic unit of information, representing one of two discrete states. The smallest unit of information within the computer. • The only thing a computer understands. • Abbreviation: b • Bit has one of two values: 1 (ON) or 0 (OFF) ON OFF Rick Graziani graziani@cabrillo.edu
Bits • Two patterns are known as the state of the bit. • For example, magnetic encoding of information on tapes, floppy disks, and hard disks are done with positive or negative polarity. The boxes illustrate a position where magnetism may be set and sensed; pluses (red) indicate magnetism of positive polarity (1 bit), interpreted as “present” and minuses (blue) (0 bit). 0 1 1 0 1 0 0 0 1 0 1 1 0 1 0 1 Rick Graziani graziani@cabrillo.edu
Bits Analogy: Sidewalk Memory • Memory (temporary or permanent) analogy is like a strip of concrete. • Stone on the sidewalk represents a 1 bit, absence of a stone represents a 0 bit. Sidewalk sections as a sequence of bits (1010 0010). Rick Graziani graziani@cabrillo.edu
Combining Bit Patterns • Using a single bit, with two discrete states, gives only two options (ON or OFF). • Like using multiple dice, combining two or more bits gives us more options. (Bits only have 2 unique patterns, whereas the die had 6). • 1 bit, 2unique patterns: 0 or 1 • 2 bits, 4unique patterns: 00, 01, 10 or 11 • 4 bits, 16unique patterns: 0000, 0001, 0010, 0010, …1111 • 8 bits, 256unique patterns: 00000000, 00000001, 00000010, … 11111111 bit OFF ON die Rick Graziani graziani@cabrillo.edu
Binary Math • Why does 7 bits give you 128 unique bytes? • Why does 8 bits give you 256 unique bytes? Starting with all “off’s” or 0’s 0 0 0 0 0 0 0 0 Add 1 until you get all 1’s (on’s) 1 1 1 1 1 1 1 1 You get 256 unique combinations of 0’s and 1’s Rick Graziani graziani@cabrillo.edu
Binary Math www.thinkgeek.com Rick Graziani graziani@cabrillo.edu
Base 10 (Decimal) Number System Digits (10): 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 Number of: 104 103 102 101 100 10,000’s1,000’s100’s10’s1’s 1 2 3 9 1 0 9 9 1 0 0 Rick Graziani graziani@cabrillo.edu
Base 10 (Decimal) Number System Digits (10): 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 Number of: 104 103 102 101 100 10,000’s1,000’s100’s10’s1’s 4 1 0 8 3 8 2 1 0 0 0 9 1 0 0 1 0 Rick Graziani graziani@cabrillo.edu
Rick’s Number System Rules • All digits start with 0 • A Base-n number system has n number of digits: • Decimal: Base-10 has 10 digits • Binary: Base-2 has 2 digits • Hexadecimal: Base-16 has 16 digits • The first column is always the number of 1’s • Each of the following columns is n times the previous column (n = Base-n) • Base 10: 10,000 1,000 100 10 1 • Base 2: 16 8 4 2 1 • Base 16: 65,536 4,096 256 16 1 Rick Graziani graziani@cabrillo.edu
Base 2 (Binary) Number System Digits (2): 0, 1 Number of: 27 26 25 24 23 22 21 20 128’s64’s32’s16’s8’s4’s2’s1’s Dec. 2 1 0 10 1 0 1 0 17 70 130 255 Rick Graziani graziani@cabrillo.edu
Computers do Binary 0 1 • Bits have two values: OFF and ON • The Binary number system (Base-2) can represent OFF and ON very well since it has two values, 0 and 1 • 0 = OFF • 1 = ON • Understanding Binary to Decimal conversion is critical in networking. • Although we use decimal numbers in networking to display information such as IP addresses (LATER), they are transmitted as OFF’s and ON’s that we represent in binary. Rick Graziani graziani@cabrillo.edu
Binary Math Why does 7 bits give you 128 unique bytes? Starting with all “off’s” or 0’s 0 0 0 0 0 0 0 (decimal 0) Add 1 until you get all 1’s (on’s) 1 1 1 1 1 1 1 (decimal 127) You get 128 unique combinations of 0’s and 1’s With 7 combinations of 2 bits,27 = 128 Number of: 26 25 24 23 22 21 20 64’s32’s16’s8’s4’s2’s1’s Dec. 0 0 0 0 0 0 0 0 127 1 1 1 1 1 1 1 Rick Graziani graziani@cabrillo.edu
Binary Math Why does 8 bits give you 256 unique bytes? Starting with all “off’s” or 0’s 0 0 0 0 0 0 0 0 (decimal 0) Add 1 until you get all 1’s (on’s) 1 1 1 1 1 1 1 1 (decimal 255) You get 256 unique combinations of 0’s and 1’s With 8 combinations of 2 bits,28 = 256 Number of: 27 26 25 24 23 22 21 20 128’s64’s32’s16’s8’s4’s2’s1’s Dec. 0 0 0 0 0 0 0 0 0 255 1 1 1 1 1 1 1 1 Rick Graziani graziani@cabrillo.edu
Digitizing Text • Earliest uses of PandA was to digitize text (keyboard characters). • We will look at digitizing images and video later. • Assigning Symbols in United States: • 26 upper case letters • 26 lower case letters • 10 numerals • 20 punctuation characters • 10 typical arithmetic characters • 3 non-printable characters (enter, tab, backspace) • 95 symbols needed Rick Graziani graziani@cabrillo.edu
ASCII-7 • In the early days, a 7 bit code was used, with 128 combinations of 0’s and 1’s, enough for a typical keyboard. • The standard was developed by ASCII (American Standard Code for Information Interchange) • Each group of 7 bits was mapped to a single keyboard character. 0 = 0000000 1 = 0000001 2 = 0000010 3 = 0000011 … 127 = 1111111 Rick Graziani graziani@cabrillo.edu
Byte Byte = A collection of bits (usually 7 or 8 bits) which represents a character, a number, or other information. • More common: 8 bits = 1 byte • Abbreviation: B Rick Graziani graziani@cabrillo.edu
ASCII-8 • IBM later extended the standard, using 8 bits per byte. • This was known as Extended ASCII or ASCII-8 • This gave 256 unique combinations of 0’s and 1’s. 0 = 00000000 1 = 00000001 2 = 00000010 3 = 00000011 … 255 = 11111111 Rick Graziani graziani@cabrillo.edu
Remember the Dice… 256 possible combinations 2 x 2 x 2 x 2 x 2 x 2 x 2 x 2 = 256 or shown as 16 x 16 = 256 36 possible combinations 6 x 6 = 36 Rick Graziani graziani@cabrillo.edu
Try it! • Write out Cabrillo College (Upper and Lower case) in bits (binary) using the chart above. 0100 0010 0110 0001 … C a Rick Graziani graziani@cabrillo.edu
The answer! 0100 0010 0110 0001 0110 0010 0111 0010 0110 1001 0110 1100 C a b r i l 0110 1100 0110 1111 0010 0000 0100 0010 0110 1111 0110 1100 l o space C o l 0110 1100 0110 0101 0110 0111 0110 0101 l e g e Rick Graziani graziani@cabrillo.edu
Unicode • Although ASCII works fine for English, many other languages need more than 256 characters, including numbers and punctuation. • Unicode uses a 16 bit representation, with 65,536 possible symbols. • Unicode can handle all languages. • www.unicode.org Rick Graziani graziani@cabrillo.edu
RGB Colors and Binary Representation • A monitors screen is divided into a grid of small unit called picture elements or pixels. (See reading from Chapter 1). • The more pixels per inch the better the resolution, the sharper the image. • All colors on the screen are a combination of red, green and blue (RGB), just at various intensities. Rick Graziani graziani@cabrillo.edu
Each Color intensity of red, green and bluerepresented as a quantity from 0 through 255. • Higher the number the more intense the color. • Black has no intensity or no color and has the value (0, 0, 0) • White is full intensity and has the value (255, 255, 255) • Between these extremes is a whole range of colors and intensities. • Grey is somewhere in between (127, 127, 127) Rick Graziani graziani@cabrillo.edu
RGB Colors and Binary Representation • You can use your favorite program that allows you to choose colors to view these various red, green and blue values. Rick Graziani graziani@cabrillo.edu
RGB Colors and Binary Representation • Let’s convert these colors from Decimal to Binary! RedGreenBlue Purple: 172 73 185 Gold:253 249 88 Rick Graziani graziani@cabrillo.edu