exam for Electronic Engineering

profileJocelyn yang
EE1301Session21-SwitchesNumbers-Class.pdf

3/12/2018

1

EE 1301: MODERN ELECTRONIC TECHNOLOGY

SESSION #21: SWITCHES AND NUMBERS 3/05/2018

Instructor: Joseph Cleveland, Ph.D. Email: [email protected]

Thought for the Day

03/09/2018 EE1301 Modern Electronic Technology 2

3/12/2018

2

Topics

• Counting with 0-9, decimal counting

• Counting with 0-1, binary counting

• Converting binary to decimal

• Expressing numbers and characters in binary format

• Intro to binary arithmetic – addition

• Homework: #6 posted to Canvas – Due 3/23

03/09/2018 EE1301 Modern Electronic Technology 3

03/09/2018 EE1301 Modern Electronic Technology 4

Numbers in On-Off Switch Logic

3/12/2018

3

Base-10 Counting

Number systems are simply ways to count things. Ours is the base-10 system – we have 10 fingers!

0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 …. 19 20 21 22 23 24 25 …. 29

03/09/2018 EE1301 Modern Electronic Technology 5

Base-10 Counting …

• Each column in our number system stands for a power of 10 starting at 100 from the right

• Example: 1,493,895

1 4 9 3 8 9 5

106 105 104 103 102 101 100

= 1x106 + 4x105 + 9x104 + 3x103 +8x102

+ 9x101 + 5x100

= 149389510

03/09/2018 EE1301 Modern Electronic Technology 6

Means: “base 10”

3/12/2018

4

Binary Number System: Base-2

• All computers today use the binary number system – There are ONLY 2 numbers: “0” and “1”.

– Basic states are “OFF” or “ON”, i.e., ‘0’V or ’5V’

– A single binary number is called a Binary digIT, or bit.

– Counting

0 1 2 3 4 5 6 7 810 0 1 10 11 100 101 110 111 10002

03/09/2018 EE1301 Modern Electronic Technology 7

4‐bit number2‐bit number

Switch Configuration for “8”

03/09/2018 EE1301 Modern Electronic Technology 8

1

0

0

0

OFF: No current flow

OFF: No current flow

OFF: No current flow

ON: Current flow

3/12/2018

5

Binary Number System: base-2 …

• In the binary number system, each bit position represents a power of two, starting at the right with 20.

Example: 1 1 1 1 0 0 0 12

03/09/2018 EE1301 Modern Electronic Technology 9

127

+126

+125

+124

+023

+022

+021

+120

128 64 32 16 0 0 0 1

241

Add

Binary Number System: Base-2

• Number of bits and counting range – 8 bits: 00000000 to 11111111  0 to 255

– 10 bits: 0000000000 to 1111111111  0 to 1023

– 32 bits: 00000000000000000000000000000000

to 11111111111111111111111111111111

 0 to 2,147,483,64710

03/09/2018 EE1301 Modern Electronic Technology 10

3/12/2018

6

Binary Number System: base-2 …

• Fractions are represented as base-2 bits to the right of a decimal point

1101.01012 • The fractional part is expressed as inverse

powers of 2

1 1 0 1 . 0 1 0 12

03/09/2018 EE1301 Modern Electronic Technology 11

= 23 + 22 + 0 + 20+

.

02-1 +12-2 +02-3 +12-4

Binary Number System: base-2 …

– How many bits to represent the national debt? $20,856,490,000,000.00:

• 100101111100000000111101011010111111010000000. 1111110101110000101

03/09/2018 EE1301 Modern Electronic Technology 12

45 bits

19 bits for $.00 to $.99

3/12/2018

7

Binary Number System: base-2 …

03/09/2018 EE1301 Modern Electronic Technology 13

Format for a floating point number in a 64-bit word:

.

How do we represent characters?

Binary Codes for Characters

03/09/2018 EE1301 Modern Electronic Technology 14

3/12/2018

8

Binary Codes for Characters …

03/09/2018 EE1301 Modern Electronic Technology 15

Codes 128-255: special graphics characters

Text to Binary

• Hi Mom and Dad. Please send money.

01001000 01101001 00100000 01001101 01101111 01101101 00100000 01100001 01101110 01100100 00100000 01000100 01100001 01100100 00101110 00100000 00100000 01010000 01101100 01100101 01100001 01110011 01100101 00100000 01110011 01100101 01101110 01100100 00100000 01101101 01101111 01101110 01100101 01111001 00101110 00001101 00001010

03/09/2018 EE1301 Modern Electronic Technology 16

3/12/2018

9

Binary Number System: base-2 …

• Operations are performed with binary number groups called words.

• Usual word sizes for digital processors are 8-bit, 16-bit, 32-bit, 64-bit, or 128-bit

Example: a 32-bit instruction

1101 0010 0101 0011 0101 1111 00012

• For a 64-bit processor – Characters: 8-bits for font type & 8 bits for

character

– Numbers: 64 bits

– Instructions: 64 bits 03/09/2018 EE1301 Modern Electronic Technology 17

03/09/2018 EE1301 Modern Electronic Technology 18

Binary Arithmetic On Using Transistor Switches to Process

3/12/2018

10

Addition

Base-10 0 + 1 = 1

1 + 1 = 2 2 + 1 = 3

3 + 1 = 4

4 + 1 = 5

4 + 2 = 6

4 + 6 = 10 ( carry 1)

Base-2 0 + 1 = 1 1 + 1 = 10 (carry 1)

10 + 1 = 11

11 + 1 = 100 (carry 1)

100 + 1 = 101

100 +10 = 110

100 +110 = 1010

03/09/2018 EE1301 Modern Electronic Technology 19

Binary Addition

• Let’s work the following binary addition:

1 0 0 410 + 1 0 0 0 810

1210

03/09/2018 EE1301 Modern Electronic Technology 20

0011

3/12/2018

11

Binary Addition

• Let’s work the following binary addition:

1 1 0 0 1 2510 + 1 1 0 1 1310

3810

03/09/2018 EE1301 Modern Electronic Technology 21

0

1 carry

1

0

1

0

0

1

0

1

1

Binary Addition …

• For addition we need – Switch sets (registers) to hold the numbers

– Adder that recognizes when to carry

– Register to hold the resulting number

• What about subtraction?

03/09/2018 EE1301 Modern Electronic Technology 22

3/12/2018

12

End of Session

03/09/2018 EE1301 Modern Electronic Technology 23