56
Number Systems Decimal (base 10) {0 1 2 3 4 5 6 7 8 9} o Place value gives a logarithmic representation of the number o Ex. 4378 means 4 X 10 3 = 4000 3 X 10 2 = 300 7 X 10 1 = 70 8 X 10 0 = 8 o The place also gives the exponent of the base

Logic Gates project

Embed Size (px)

DESCRIPTION

presentation on logic gates

Citation preview

Page 1: Logic Gates project

Number Systems

Decimal (base 10) {0 1 2 3 4 5 6 7 8 9}o Place value gives a logarithmic representation

of the numbero Ex. 4378 means

4 X 103 = 4000 3 X 102 = 300 7 X 101 = 70 8 X 100 = 8

o The place also gives the exponent of the base

Page 2: Logic Gates project

Example

• 432,600

4 3 2 6 0 0

105

104

103

100

101

102

Powers of ten:

100 = 1 102 = 100 104 = 10000

101 = 10 103 = 1000 105 = 100000

Page 3: Logic Gates project

Binary (base 2) {0 1}Binary Decimal

0 0

1 1

10 2

11 3

100 4

101 5

110 6

111 7

1000 8

1001 9

1010 10

Page 4: Logic Gates project

Example

1 1 0 1 1 0 0 1

27

26

25

20

21

22

24 23

Page 5: Logic Gates project

Decimal Equivalent

1101 1001 1 X 27 = 128 + 1 X 26 = 64 + 0 X 25 = 0 + 1 X 24 = 16 + 1 X 23 = 8 + 0 X 22 = 0 + 0 X 21 = 0 + 1 X 20 = 1 217

Notice how powers of two stand out:

20 = 1

21 = 10

22 = 100

23 = 1000

Page 6: Logic Gates project

Decimal to Binary Conversion

Ex. 575o Find the largest power of two less than the number

o 29 = 512o Subtract that power of two from the number

o 575 – 512 = 63o Repeat steps 1 and 2 for the new result until you reach zero.

o 25 = 32 63 – 32 = 31o 24 = 16 31 – 16 = 15o 23 = 8 15 – 8 = 7o 22 = 4 7 – 4 = 3o 21 = 2 3 – 2 = 1o 20 = 1 1 – 1 = 0

o Construct the numbero 1000111111

Page 7: Logic Gates project

Another Example

144o 27 = 128 144 – 128 = 16o 24 = 16 16 – 16 = 0

Result 10010000

Page 8: Logic Gates project

Hexadecimal (base 16)

{0 1 2 3 4 5 6 7 8 9 A B C D E F} Assignments Dec Hex Dec Hex

0 0 8 8

1 1 9 9

2 2 10 A

3 3 11 B

4 4 12 C

5 5 13 D

6 6 14 E

7 7 15 F

Page 9: Logic Gates project

Example

163

162

160

161

3 B 6 E

3 X 163 = 12288

11 X 162 = 2816

6 X 161 = 96

14 X 160 = 14

15214

Page 10: Logic Gates project

Hexadecimal is Convenient for Binary Conversion

Binary Hex Binary Hex

0 0 1001 9

1 1 1010 A

10 2 1011 B

11 3 1100 C

100 4 1101 D

101 5 1110 E

110 6 1111 F

111 7 1 0000 10

1000 8 Nibble

Page 11: Logic Gates project

Binary to Hex Conversion

Group binary number by fours (nibbles)o 1101 1001 0110

Convert each nibble into hex equivalento 1101 1001 0110

D 9 6

Page 12: Logic Gates project

Decimal to Hex Conversion

Ex. 284o 162 = 256 284 – 256 = 28o 161 = 16 28 - 16 = 12 (Hex C)

oResult 1 1 C

Page 13: Logic Gates project

Another Example with an Extension

1054o 162 = 256

But we have several multiples of 256 in 1054o 1054/256 = 4.12 take integer parto This eliminates 4*256 = 1024

1054 – 1024 = 30

o 161 = 16 30 – 16 = 14 (Hex E)

oResult 4 1 E

Page 14: Logic Gates project

Truth TableBinary Decimal Hexadecimal

0000    0001    0010    0011    0100    0101    0110    0111    1000    1001    1010    1011    1100    1101    1110    1111    

Page 15: Logic Gates project

Truth TableBinary Decimal Hexadecimal0000 0 00001 1 10010 2 20011 3 30100 4 40101 5 50110 6 60111 7 71000 8 81001 9 91010 10 A1011 11 B1100 12 C1101 13 D1110 14 E1111 15 F

Page 16: Logic Gates project

Sexagesimal(Base 60)

Page 17: Logic Gates project

Practice

Convert 212 decimal to binaryo 212 – 27 = 84o 84 – 26 = 20o 20 – 24 = 4o 4 – 22 = 0oResult: 1101 0100

Page 18: Logic Gates project

More Practice

Convert 1101 0010 binary to hexo 0010 = 2o 1101 = 13 = DoResult D2

Page 19: Logic Gates project

Notation

Some books use a subscript to denote the base.o Ex: 1210 = 12 decimal

o 1216 = 12 hex = 18 decimal

Page 20: Logic Gates project

Logic Gates

Page 21: Logic Gates project

Transistors as Switches• VBB voltage controls whether the transistor

conducts in a common base configuration.

• Logic circuits can be built

Page 22: Logic Gates project

Boolean Algebra

Page 23: Logic Gates project

AND

In order for current to flow, both switches must be closed¤ Logic notation AB = C

(Sometimes AB = C)

A B C

0 0 0

0 1 0

1 0 0

1 1 1

Page 24: Logic Gates project

OR

Current flows if either switch is closed¤ Logic notation A + B = C

A B C

0 0 0

0 1 1

1 0 1

1 1 1

Page 25: Logic Gates project

Properties of AND and OR

Commutationo A + B = B + Ao A B = B A

Same as

Same as

Page 26: Logic Gates project

Commutation Circuit

A + B B + A

A B B A

Page 27: Logic Gates project

Properties of AND and OR

Associative PropertyA + (B + C) = (A + B) + C

A (B C) = (A B) C

=

Page 28: Logic Gates project

Properties of AND and OR

Distributive PropertyA + B C = (A + B) (A + C)

A + B CA B C Q

0 0 0 0

0 0 1 0

0 1 0 0

0 1 1 1

1 0 0 1

1 0 1 1

1 1 0 1

1 1 1 1

Page 29: Logic Gates project

Distributive Property

(A + B) (A + C)

A B C Q

0 0 0 0

0 0 1 0

0 1 0 0

0 1 1 1

1 0 0 1

1 0 1 1

1 1 0 1

1 1 1 1

Page 30: Logic Gates project

Binary Addition

A B S C(arry)

0 0 0 0

1 0 1 0

0 1 1 0

1 1 0 1

Notice that the carry results are the same as AND

C = A B

Page 31: Logic Gates project

Inversion (NOT)

A Q

0 1

1 0Logic:

AQ

Page 32: Logic Gates project

Exclusive OR (XOR)

Either A or B, but not both

This is sometimes called the inequality detector, because the result will be 0 when the inputs are the same and 1 when they are different.

The truth table is the same as for S on Binary Addition. S = A B

A B S

0 0 0

1 0 1

0 1 1

1 1 0

Page 33: Logic Gates project

Getting the XOR

A B S

0 0 0

1 0 1

0 1 1

1 1 0

Two ways of getting S = 1

BAor BA

Page 34: Logic Gates project

Circuit for XOR

Accumulating our results: Binary addition is the result of XOR plus AND

BA BABA

Page 35: Logic Gates project

Half Adder

Called a half adder because we haven’t allowed for any carry bit on input. In elementary addition of numbers, we always need to allow for a carry from one column to the next.

18

25

4

3 (plus a carry)

Page 36: Logic Gates project

Half Adder

Page 37: Logic Gates project

Full Adder

INPUTS OUTPUTS

A B CIN COUT S

0 0 0 0 0

0 0 1 0 1

0 1 0 0 1

0 1 1 1 0

1 0 0 0 1

1 0 1 1 0

1 1 0 1 0

1 1 1 1 1

Page 38: Logic Gates project

Full Adder Circuit

Page 39: Logic Gates project

Chaining the Full Adder

Possible to use the same scheme for subtraction by

noting that

A – B = A + (-B)

Page 40: Logic Gates project

Binary CountingUse 1 for ON

Use 0 for OFF

= 00101011

So our example has 25 + 23 + 21 + 20 = 32 + 8 + 2 + 1 = 43

Page 41: Logic Gates project

Counting in Binary

1 1 11 1011 21 10101

2 10 12 1100 22 10110

3 11 13 1101 23 10111

4 100 14 1110 24 11000

5 101 15 1111 25 11001

6 110 16 10000 26 11010

7 111 17 10001 27 11011

8 1000 18 10010 28 11100

9 1001 19 10011 29 11101

10 1010 20 10100 30 11110

Page 42: Logic Gates project

NAND (NOT AND)

A B Q

0 0 1

0 1 1

1 0 1

1 1 0

BAQ

Page 43: Logic Gates project

NOR (NOT OR)

A B Q

0 0 1

0 1 0

1 0 0

1 1 0

BAQ

Page 44: Logic Gates project

DeMorgan’s Theorem

A NAND gate is equivalent to an inversion followed by an OR

A NOR gate is equivalent to an inversion followed by and AND

Page 45: Logic Gates project

DeMorgan Truth Table

NAND NOR

Page 46: Logic Gates project

Exclusive NOR

A B Q

0 0 1

0 1 0

1 0 0

1 1 1

Equality Detector

BAQ

Page 47: Logic Gates project

Summary

Summary for all 2-input gates

Inputs Output of each gate

 A   B  AND NAND  OR  NOR XOR XNOR

0 0 0 1 0 1 0 1

0 1 0 1 1 0 1 0

1 0 0 1 1 0 1 0

1 1 1 0 1 0 0 1

Page 48: Logic Gates project

Logic Gates and Symbols

AND

NAND

Page 49: Logic Gates project

More Gates and Symbols

NOR

NOT

OR

Page 50: Logic Gates project

And More

XOR

NXOR

Page 51: Logic Gates project

Multi-input Gates

Page 52: Logic Gates project

Three input OR

Page 53: Logic Gates project

Logic Gate ICs

Page 54: Logic Gates project

Example 7400

Page 55: Logic Gates project

More ICs

Page 56: Logic Gates project

And More