Download presentation
Presentation is loading. Please wait.
1
Binary Values COSC 1323
2
Why Binary? Electrical devices are most reliable when they are built with 2 states that are hard to confuse: • gate open / gate closed But we don’t physically open gates in electronic circuits. So: Integrated circuit contains logic gates Two inputs (on/1/closed or off/0/closed), a battery (E) and a lightbulb – if either or both gates are closed/on, the lightbulb comes on 4 possible combinations for input: 00, 01, 10, 11
3
Why Binary? Electrical devices are most reliable when they are built with 2 states that are hard to confuse: • gate open / gate closed • full on / full off • fully charged / fully discharged • charged positively / charged negatively • magnetized / nonmagnetized • magnetized clockwise / magnetized ccw These states are separated by a huge energy barrier.
4
Punch Cards hole No hole
hole No hole
5
Jacquard Loom Invented in 1801
The point: binary was useful even before computers.
6
Jacquard Loom Invented in 1801
The point: binary was useful even before computers. Picture on left from David Reed. A Balanced Introduction to Computer Science.
7
Everyday Binary Things
Examples: Light bulb Door locked Refrigerator door closed A/C on Dishes dirty or clean Garage door open Alarm system set
8
Everyday Binary Things
Examples: Light bulb on/off Door locked/unlocked Garage door up/down Refrigerator door open/closed A/C on/off Dishes dirty/clean Alarm set/unset Light bulb Door locked Refrigerator door closed A/C on Dishes dirty or clean Garage door open Alarm system set
9
Binary (Boolean) Logic
If: customer’s account is at least five years old, and customer has made no late payments Then: Approve request for limit increase. Point here: Boolean logic has two values: T and F
10
Number Systems base: number of different digits which can occur in each position of a number Decimal: base 10 digits 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 Binary: base 2 digits 0, 1 Hexadecimal: base 16 digits 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F A for 10, B for 11, etc.
11
Exponential Notation 42 = 4 * 4 = 43 = 4 * 4 * 4 = 103 =
1011 = 100,000,000,000 Picked 10^11 because it’s about the number of neurons in human brain
12
Powers of Two How many champions? How many teams in the championship? How many in the semi-finals? And so forth?
13
Powers of Two
14
Powers of Two 1 2 4 3 8 16 5 32 6 64 7 128 256 9 512 10 1024 11 2048 12 4096 13 8192 14 16384
15
Counting in Binary 0000 0001 0010 0011 0100 0101 ...
16
My Android Phone Ask students which category is bigger? Get them to sort of KB vs MB vs GB.
17
Naming the Quantities 10^15 = 1000^5. 103 = 1000 210 = 1024
18
Morse Code Uses dots and dashes
Similar concept to representing text with bits and bytes
19
Braille
20
Braille With six bits, how many symbols can be encoded?
2^6 = So Braille uses escape characters to indicate a larger alphabet. Top to bottom on left (6 dots): 1,2, 3 On right: 4, 5, 6 Add 2 bits (7 and 8 on bottom): 8 raised – next letter is capitalized, both raised: next value is a number With six bits, how many symbols can be encoded?
21
Binary Strings Can Get Really Long
Long, but why do we care?
22
Binary Strings Can Get Really Long
Long, but why do we care? Colors consist of various amounts of red, green, blue Color represented as RGB value, which is 3 numbers indicating the relative contribution of each of the three primary colors. Each number in triple is on a scale from 0 to 255: 0 means none of that color, 255 means full contribution (255, 255, 0): maximum contribution of red and green, no blue – bright yellow
23
Base 16 (Hexadecimal) 1111 1111 0011 1101 1001 0110 F F 3 D 9 6
Problem: binary strings are long and annoying to deal with for people Flash to hex for colors also hex corresponds to four bits. So two hex symbols is one 8-bit byte.
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.