How a Computer Works
Part 3: Basis of Computer Language – Binary and Hexadecimals
Chip and Bits
• Chips store memory and are used for processing and data transfer.
• Data comes in the form of millions of switches – either on or off. When on, electrical impulse
is sent along bus lines. When off, no electricity is sent.
• Chips are made up of millions of points with bus lines between (transistors).
On/off à complexity?
• On and off are only two pieces of data, so how can a computer store, transfer, and process
more complex data?
Hint: Think about our number system, 0 to 9 and how many numbers are possible.
Decimals and Binary
• On and off can be thought of as 0 and 1.
• 0 and 1 are known as bits or BInary digiT.
Decimal Binary = Base 2
(0 to 9 number system) ( 0 & 1 = only digits)
0 000
1 001
2 010
3 011
4 100
5 101
Large numbers in Binary
Break down binary “word” into powers of 2. Examples
Groups of
4 3
Decimal 2 (16) 2 (8) 22 (4) 21 (2) 20 (1) Binary
5 0 0 1 0 1 1012
15 0 1 1 1 1 11112
22 1 0 1 1 0 101102
Characters in Binary
• ASCII = American Standard Code for Information Exchange
• Used for English characters
• Each letter has a decimal value
Decimal Binary ASCII
32 100000 Space
65 1000001
97 1100001
Practice. Show work.
90
58
122
Punch Cards and Rolls Store Data
• Punch = 1, no punch = 0
• Each row is one binary value
• Multiple rows spell a “word”
• Punch cards were originally used in the 1700s to run mechanized looms for making textiles of
different patterns
Modern Discs and CDs
• Data = Pits of different depths
• A laser reads depth changes across the disc and equates that to 0 (no depth change) or 1 (depth
change)
Hexidecimals
• Binary has a base of 2
• Decimal has a base of 10
• Hexidecimal has a base of 16
• Useful for very long numbers or data with a large range (like color and addresses in memory)
Converting Binary to Hexidecimal
• Starting from the right end of the number, group the binary
number in sets of 4 digits.
• Convert each four digits into a decimal value.
• Convert each decimal to a hexidecimal using the 0 to 15
chart.
Ex. Convert the binary number to hexadecimal
1001111010110101102
Step one: write in groups of 4 digits, starting from the right
10 0111 1010 1101 01102 = x16
210 710 ______ ______ ______
216 716 ______ ______ ______
x16 =
Each set of 4 digits is
treated as its own number.
For example 1011 would be
1*23 + 0*22 +1*21 +1*20
Practice:
1) Convert 11010101102 to
a) Decimal b) Hexidecimal
2) Convert A7E16 to
a) Decimal b) Binary
Write Your Name in ASCII
Using the ASCII table, write your first and last name using ASCII up to 12 characters. Use both uppercase
and lowercase letters and spaces as appropriate.
Letter Decimal Binary Conversion (ASCII)
26 (64) 25 (32) 24 (16) 23 (8) 22 (4) 21 (2) 20 (1)
N 78 1 0 0 1 1 1 0