# SCEN103 Class 17

Bottom of page/ Next Class/ Previous Class

## Being Digital: Counting

"Not everything that counts can be counted, and not everything that can be counted counts." -- Albert Einstein

### "Relearning" to count

• Preparation for study of digital electronics
• 1 + 11 = 100 ?

### Review of decimal scheme

• Most familiar!
• "Place holders" are powers of 10
 Power of 10: Weight: 3 2 1 0 1000 100 10 1 103 102 101 100

• Ten symbols or characters needed:
0, 1, 2, 3, 4, 5, 6, 7, 8, and 9
• Example:
 1998 = (1 x 103) + (9 x 102) + (9 x 10) + 8 = 1000 + 900 + 90 + 8

### Introduction to binary counting

• Base 2 counting
• Motivation -- only 2 states needed:
-- Switch ON or OFF,
-- Circuit CLOSED or OPEN,
-- Current FLOWING or NOT,
-- Voltage HIGH or LOW

• Place holders are powers of 2
 Power of 2: Decimal Weight: 7 6 5 4 3 2 1 0 128 64 32 16 8 4 2 1 27 26 25 24 23 22 21 20

• Example: convert 1100010 to decimal
 Binary Number: Decimal Weight of Placeholders: Contributions to Decimal Number: 0 1 1 0 0 0 1 0 128 64 32 16 8 4 2 1 0 64 32 0 0 0 2 0

Answer: 64 + 32 + 2 = 98

• Correspondence between decimal digit and binary bits
-- "bit" is a contraction of "binary digit"

DecimalBinary
00000
10001
20010
30011
40100
50101
60110
70111
81000
91001

• Can 1 + 11 = 100? Yes, if numbers are binary!

• Hex for short
• Binary numbers can be unwieldy in length
• Place holders are powers of 16
 Power of 16: Weight: 3 2 1 0 4096 256 16 1

• Sixteen symbols or characters needed:
The usual 10 of 0, 1, 2, ... 9 plus A, B, C, D, E, and F
• Correspondence between new hexadecimal digits and decimal/binary
DecimalHexBinary
10A1010
11B1011
12C1100
13D1101
14E1110
15F1111
• 4 bits used to represent a single hex digit
• Example: conversion of 7CE to decimal.  7CE = (7 x 162) + (C x 16) + E = (7 x 256) + (12 x 16) + 14 = 1792 + 192 + 14 = 1998

• If there is any likelihood of confusion, the base of the number system should be indicated by explicitly writing the radix. For example, the answer above, decimal 1998, would be more precisely written as 199810. Hexadecimal numbers are typically indicated by using the subscript H behind the number; in the example above 7CEH was converted to a decimal number. Note that 1998 would be ambiguous if written in a context where the counting base is not clear; is 1998H or 199810 intended?

• Example: conversion of 7CE to binary.  7CE = 0111 1100 1110

### Addition of binary numbers

 1 + 0 = 1 -- No surprise. 1 + 1 = 10 -- Don't forget to carry! 1 + 1 + 1 = 11

### Addition of hex numbers

• Convert to binary first and use rules above.
• Example: B + E = ?

#### Group Activity

• Addition of Hex Numbers
• Find the sum of BAD and 1CE by adding their binary equivalents.
Report as a hexadecimal number.
• Check your answer using decimal arithmetic.
Solution

Comments, suggestions, or requests to ghw@udel.edu.

"http://www.physics.udel.edu/~watson/scen103/99s/clas0319.html"
Last updated March 17, 1999.
Copyright George Watson, Univ. of Delaware, 1996.