Computer Fluency Binary Systems
Humans Decimal Numbers (base 10) Decimal Numbers (base 10) Sign-Magnitude (-324) Sign-Magnitude (-324) Decimal Fractions (23.27) Decimal Fractions (23.27) Letters for text Letters for text
Computers Binary Numbers (base 2) Binary Numbers (base 2) Two’s complement and sign-magnitude Two’s complement and sign-magnitude Binary fractions and floating point Binary fractions and floating point ASCII codes for characters (A 65) ASCII codes for characters (A 65)
Why binary? Computers are ‘electronic’ and use the presence or absence of electricity to provide values Computers are ‘electronic’ and use the presence or absence of electricity to provide values Using decimal would require 10 distinct and reliable voltage levels for each digit. Using decimal would require 10 distinct and reliable voltage levels for each digit. This is not feasible with reasonable reliability and financial constraints. This is not feasible with reasonable reliability and financial constraints. Everything in computer is stored using binary: numbers, text, programs, pictures, sounds, videos,... Everything in computer is stored using binary: numbers, text, programs, pictures, sounds, videos,...
Transistor A transistor is an electronic switch (on/off) and is the basic unit of modern computer processors A transistor is an electronic switch (on/off) and is the basic unit of modern computer processors Two steady states based on voltage levels Two steady states based on voltage levels As of 2015, the highest transistor count in a commercially available CPU (in one chip) is over 4.3 billion transistors, in Intel's 15-core Xeon Ivy Bridge-EX. As of 2015, the highest transistor count in a commercially available CPU (in one chip) is over 4.3 billion transistors, in Intel's 15-core Xeon Ivy Bridge-EX. Change states in billionth of sec Change states in billionth of sec Intel Makes the 3D Transistor Intel Makes the 3D Transistor Intel Makes the 3D Transistor Intel Makes the 3D Transistor
Binary Representations Binary values are represented abstractly by: Binary values are represented abstractly by: digits 0 and 1 digits 0 and 1 words (symbols) False (F) and True (T) words (symbols) False (F) and True (T) words (symbols) Low (L) and High (H) words (symbols) Low (L) and High (H) and words Off and On. and words Off and On. OR …..OR …..
Morse Code Morse Code Binary communications are not a new concept
Decimal: Non-negatives Base 10 Base 10 Uses decimal digits: 0,1,2,3,4,5,6,7,8,9 Uses decimal digits: 0,1,2,3,4,5,6,7,8,9 Positional System - position gives power of the base Positional System - position gives power of the base Example: 3845 = 3x x x x10 0 Example: 3845 = 3x x x x10 0 Positions: … Positions: …543210
Binary: Non-negatives Base 2 Base 2 Uses binary digits (bits): 0,1 Uses binary digits (bits): 0,1 Positional system Positional system Example: 1101 = 1x x x x2 0 Example: 1101 = 1x x x x2 0
Powers of 2: 2 n n2n2n It will be convenient to remember these powers
Base Two The important details about base 2 are that the symbols that you use are 0 and 1. The place values in base 2 are (going from smallest to largest): 2 0 (1) 2 1 (2)2 (4) 2 3 (8) 2 4 (16) 2 5 (32) Change the base 2 number to a base 10 (decimal) number 1 = 1 1 2 = 2 0 4 = 0 0 8 = 0 1 16 = 16 1 32 = Change the base 10 (decimal) number 47 to a base 2 (binary) number. 47 2 = 23 remainder 1 23 2 = 11 remainder1 11 2 = 5 remainder1 5 2 = 2 remainder1 2 2 = 1 remainder0 1 2 = 0 remainder1 47 = Binary Point
Conversions ExternalInternal (Human) (Computer) A ExternalInternal (Human) (Computer) A Humans want to see and enter numbers in decimal. Humans want to see and enter numbers in decimal. Computers must store and compute with bits. Computers must store and compute with bits.
Binary to Decimal Conversion Algorithm: Algorithm: Expand binary number using positional scheme.Expand binary number using positional scheme. Perform computation using decimal arithmetic.Perform computation using decimal arithmetic. Example: 1x x x x x2 0 = = = Example: 1x x x x x2 0 = = = 25 10
Binary Addition One bit numbers: | | 1 10 One bit numbers: | | 1 10 Example (53) (45) (98) Example (53) (45) (98)
Special Powers of (=1024) is Kilo, denoted "K" 2 20 (=1,048,576) is Mega, denoted "M" 2 30 (1,073, 741,824) is Giga, denoted "G" 2 40 (1,099,511,627,776 ) is Tera, denoted “T" Reminder: 8 bits (b) are also called a byte (B) Exercise: what is the most memory (RAM) a 32-bit processor can access? equals what in decimal?
Octal Numbers Base 8 Digits 0,1,2,3,4,5,6,7 Base 8 Digits 0,1,2,3,4,5,6,7 Number does not have so many digits as binary Number does not have so many digits as binary Easy to convert to and from binary Easy to convert to and from binary Often used by people who need to see the internal representation of data, programs, etc. Often used by people who need to see the internal representation of data, programs, etc.
Octal Conversions Octal to Binary Octal to Binary Simply convert each octal digit to a three bit binary number. Simply convert each octal digit to a three bit binary number. Example: = Example: = Binary to Octal Binary to Octal Starting at right, group into 3 bit sections Starting at right, group into 3 bit sections Convert each group to an octal digit Convert each group to an octal digit Example = = Example = =
Hexadecimal Base 16 Digits 0,…,9,A,B,C,D,E,F Base 16 Digits 0,…,9,A,B,C,D,E,F Hexadecimal Binary Hexadecimal Binary Just like Octal, only use 4 bits per digit. Just like Octal, only use 4 bits per digit. Example: 98C3 16 = Example: 98C3 16 = Example = = 34EB Example = = 34EB
ASCII Character Codes American Standard Code for Information Interchange (ASCII) American Standard Code for Information Interchange (ASCII) This code is a standard used to represent information sent as character-based data. The Extended ASCII set uses 8-bits to represent: This code is a standard used to represent information sent as character-based data. The Extended ASCII set uses 8-bits to represent: 224 Graphic printing characters.224 Graphic printing characters. 32 Non-printing characters32 Non-printing characters Some non-printing characters are used for text format (e.g. BS = Backspace, CR = carriage return) Some non-printing characters are used for text format (e.g. BS = Backspace, CR = carriage return) ASCII Table - ASCII Table -