COSY Topic 4-1 Representation of Data.ppt

Full Transcript

Computer Systems COSY Topic 4-1 Fundamentals of Data representation Data Representation How do computers represent data?  Most computers are digital  Recognize only two discrete states: on or o...

Computer Systems COSY Topic 4-1 Fundamentals of Data representation Data Representation How do computers represent data?  Most computers are digital  Recognize only two discrete states: on or off  Use a binary system to recognize two states  Use number system with two unique digits: 0 and 1, called bits (short for binary digits)  Smallest unit of data computer can process Bits Circuits inside computers work with electricity. These circuits react to the presence or absence of voltages (the difference in electrical energy between two points of a circuit). Bits To understand how circuits work we represent the presence of a voltage as “1” and the absence of a voltage as “0”. We refer to each 0 and each 1 as a “bit” (short for binary digits) The bit is the basic unit of information on a computer. Data Representation What is a byte?  Eight bits grouped together as a unit  Provides enough different combinations of 0s and 1s to represent 256 individual characters  Numbers  Uppercase and lowercase letters  Punctuation marks Decimal Representation Decimal number system is base 10  0, 1, 2, 3, 4, 5, 6, 7, 8, 9  Uses 10 numbers 23,625 Power of 10 representation 104 103 102 101 100 Decimal 10000 1000 100 10 1 representation Base 10 20,000 3,000 600 20 5 representation Converting Binary to Decimal Binary number system is base 2  0, 1  Uses 2 numbers 10010001 = 145 Base 2 representation 27 26 25 24 23 22 21 20 Decimal 128 64 32 16 8 4 2 1 representation Base 2 1 0 0 1 0 0 0 1 representation Converting Decimal to Binary Convert decimal 35 to binary 1. Using 8 bits, find largest power of 2 that will “fit” into 35 2. Place a 1 into that slot 3. If the # doesn’t fit, place a 0 into that slot Power of 2 representation 27 26 25 24 23 22 21 20 Decimal 128 64 32 16 8 4 2 1 representation Base 2 representation 0 0 1 0 0 0 1 1 35 = 00100011 Denary to Binary Still quite easy! To convert 113 to binary Biggest number in table that is less than 113 is 64 128 64 32 16 8 4 2 1 1 113 - 64 = 49 Denary to Binary To convert 113 to binary Biggest number in table that is less than 49 is 32 128 64 32 16 8 4 2 1 1 1 49 - 32 = 17 Denary to Binary To convert 113 to binary Biggest number in table that is less than 17 is 16 128 64 32 16 8 4 2 1 1 1 1 17 - 16 = 1 Denary to Binary To convert 113 to binary Biggest number in table that is less than or equal to 1 is 1 128 64 32 16 8 4 2 1 1 1 1 0 0 0 1 113 = 1110001 Denary to Binary Still quite easy! To convert 113 to binary Biggest number in table that is less than 113 is 64 128 64 32 16 8 4 2 1 1 113 - 64 = 49 Denary to Binary To convert 113 to binary Biggest number in table that is less than 49 is 32 128 64 32 16 8 4 2 1 1 1 49 - 32 = 17 Denary to Binary To convert 113 to binary Biggest number in table that is less than 17 is 16 128 64 32 16 8 4 2 1 1 1 1 17 - 16 = 1 Denary to Binary To convert 113 to binary Biggest number in table that is less than or equal to 1 is 1 128 64 32 16 8 4 2 1 1 1 1 0 0 0 1 113 = 1110001 Decimal to binary conversions (algorithmic) 98 MOD 2 0 98 DIV 2 49 49 MOD 2 1 49 DIV 2 24 24 MOD 2 0 24 DIV 2 12 12 MOD 2 0 12 DIV 2 6 6 MOD 2 0 6 DIV 2 3 3 MOD 2 1 3 DIV 2 1 1 MOD 2 1 1 DIV 2 0 To convert 98: Reading from the bottom we get 1100010, which is the binary equivalent of 98. Convert Binary to Decimal 1. Choose an 8 bit binary number = 10101110 2. Write the binary digits under the correct column 3. For each column with a 1, you will add that decimal value 4. You will not add the values of the columns you entered 0 Power of 2 representation 27 26 25 24 23 22 21 20 Decimal 128 64 32 16 8 4 2 1 representation Base 2 1 0 1 0 1 1 1 0 representation 128 + 32 + 8 + 4 + 2 = 174 10101110 = 174 Data Representation What are three popular coding systems to represent data?  ASCII—American Standard Code for Information Interchange  EBCDIC—Extended Binary Coded Decimal Interchange Code  Unicode—coding scheme capable of representing all world’s languages ASCII Symbol EBCDIC 00110000 0 11110000 00110001 1 11110001 00110010 2 11110010 00110011 3 11110011 Data Representation How is a letter converted to binary form and back? Step 1. The user presses Step 2. the capital letter An electronic signal for the D (shift+D key) capital letter D is sent to the on the keyboard. system unit. Step 4. Step 3. After processing, the binary The signal for the capital letter D code for the capital letter D is is converted to its ASCII binary converted to an image, and code (01000100) and is stored in displayed on the output device. memory for processing. Memory Seat #2B4 Seat #2B3 What is memory?  Electronic components that store instructions, data, and results  Consists of one or more chips on motherboard or other circuit board  Each byte stored in unique location called an address, similar to addresses on a passenger train Memory  Stores three basic categories of items: 1. OS and system software 2. Application programs 3. Data and information  Byte is basic storage unit in memory  To access data or instructions in memory, computer references the address that contain the bytes of data  Manufacturers state the size of memory and storage devices in terms of number of bytes available Memory How is memory measured?  By number of bytes available for storage  KB = 1024 bytes Term Abbreviation Approximate Size Kilobyte KB or K 1 thousand bytes Megabyte MB 1 million bytes Gigabyte GB 1 billion bytes Terabyte TB 1 trillion bytes Name Abbr. Size Kilo K 2^10 = 1,024 Mega M 2^20 = 1,048,576 Giga G 2^30 = 1,073,741,824 Tera T 2^40 = 1,099,511,627,776 Peta P 2^50 = 1,125,899,906,842,624 Exa E 2^60 = 1,152,921,504,606,846,976 Zetta Z 2^70 = 1,180,591,620,717,411,303,424 Yotta Y 2^80 = 1,208,925,819,614,629,174,706,176

Use Quizgecko on...
Browser
Browser