# Logic Gates. Transistors as Switches ¡V BB voltage controls whether the transistor conducts in a common base configuration. ¡Logic circuits can be built.

## Presentation on theme: "Logic Gates. Transistors as Switches ¡V BB voltage controls whether the transistor conducts in a common base configuration. ¡Logic circuits can be built."— Presentation transcript:

Logic Gates

Transistors as Switches ¡V BB voltage controls whether the transistor conducts in a common base configuration. ¡Logic circuits can be built

AND ¡In order for current to flow, both switches must be closed ¤Logic notation A B = C (Sometimes AB = C) ABC 000 010 100 111

OR ¡Current flows if either switch is closed ¤Logic notation A + B = C ABC 000 011 101 111

Properties of AND and OR ¡Commutation ¤A + B = B + A ¤A B = B A Same as

Properties of AND and OR ¡Associative Property ¤A + (B + C) = (A + B) + C ¤A (B C) = (A B) C =

Properties of AND and OR ¡Distributive Property ¤A + B C = (A + B) (A + C) ¤A + B C ABCQ 0000 0010 0100 1001 1011 1101 1111

Distributive Property ¡(A + B) (A + C) ABCQ 0000 0010 0100 1001 1011 1101 1111

Binary Addition ABSC(arry) 0000 1010 0110 1101 Notice that the carry results are the same as AND C = A B

Inversion (NOT) AQ 01 10 Logic:

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 ABS 000 101 011 110

Getting the XOR ABS 000 101 011 110 Two ways of getting S = 1

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

Half Adder Called a half adder because we havent 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)

Full Adder INPUTSOUTPUTS ABC IN C OUT S 00000 00101 01001 01110 10001 10110 11010 11111

Chaining the Full Adder Possible to use the same scheme for subtraction by noting that A – B = A + (-B)

Binary Counting Use 1 for ON Use 0 for OFF = 00101011 Binary Counter So our example has 2 5 + 2 3 + 2 1 + 2 0 = 32 + 8 + 2 + 1 = 43

Counting in Binary 111110112110101 2101211002210110 3111311012310111 41001411102411000 51011511112511001 611016100002611010 711117100012711011 8100018100102811100 9100119100112911101 10101020101003011110

NAND (NOT AND) ABQ 001 011 101 110

NOR (NOT OR) ABQ 001 010 100 110

Exclusive NOR ABQ 001 010 100 111 Equality Detector

Summary Summary for all 2-input gates InputsOutput of each gate A B ANDNAND OR NORXORXNOR 00010101 01011010 10011010 11101001

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

Example ¡432,600 4 3 2 6 0 0 10 5 10 4 10 3 10 0 10 1 10 2 Powers of ten: 10 0 = 110 2 = 10010 4 = 10000 10 1 = 1010 3 = 100010 5 = 100000

Binary (base 2) {0 1} BinaryDecimal 00 11 102 113 1004 1015 1106 1117 10008 10019 101010

Example 1 1 0 1 1 0 0 1 2727 2626 2525 2020 2121 2 2424 2323

Decimal Equivalent ¡1101 1001 1 X 2 7 = 128 + 1 X 2 6 = 64 + 0 X 2 5 = 0 + 1 X 2 4 = 16 + 1 X 2 3 = 8 + 0 X 2 2 = 0 + 0 X 2 1 = 0 + 1 X 2 0 = 1 217 Notice how powers of two stand out: 2 0 = 1 2 1 = 10 2 2 = 100 2 3 = 1000

Decimal to Binary Conversion ¡Ex. 575 ¤Find the largest power of two less than the number ۞ 2 9 = 512 ¤Subtract that power of two from the number ۞ 575 – 512 = 63 ¤Repeat steps 1 and 2 for the new result until you reach zero. ۞ 2 5 = 32 63 – 32 = 31 ۞ 2 4 = 16 31 – 16 = 15 ۞ 2 3 = 8 15 – 8 = 7 ۞ 2 2 = 4 7 – 4 = 3 ۞ 2 1 = 2 3 – 2 = 1 ۞ 2 0 = 1 1 – 1 = 0 ¤Construct the number ۞ 1000111111

Another Example ¡144 ¤2 7 = 128 144 – 128 = 16 ¤2 4 = 16 16 – 16 = 0 ¡Result 10010000

Hexadecimal (base 16) ¡ {0 1 2 3 4 5 6 7 8 9 A B C D E F} ¡ Assignments DecHexDecHex 0088 1199 2210A 3311B 4412C 5513D 6614E 7715F

Example 16 3 16 2 16 0 16 1 3 B 6 E 3 X 16 3 = 12288 11 X 16 2 = 2816 6 X 16 1 = 96 14 X 16 0 = 14 15214

Hexadecimal is Convenient for Binary Conversion BinaryHexBinaryHex 00100129 111010A 1021011B 1131100C 10041101D 10151110E 11061111F 11171 000010 10008 Nibble

Binary to Hex Conversion ¡ Group binary number by fours (nibbles) ¤1101 1001 0110 ¡Convert each nibble into hex equivalent ¤1101 1001 0110 D 9 6

Decimal to Hex Conversion ¡ Ex. 284 ¤16 2 = 256 284 – 256 = 28 ¤16 1 = 16 28 - 16 = 12 (Hex C) ¤Result 1 1 C

Another Example with an Extension ¡ 1054 ¤16 2 = 256 ۞ But we have several multiples of 256 in 1054 –1054/256 = 4.12 take integer part –This eliminates 4*256 = 1024 ۞ 1054 – 1024 = 30 ¤16 1 = 16 30 – 16 = 14 (Hex E) ¤Result 4 1 E

Download ppt "Logic Gates. Transistors as Switches ¡V BB voltage controls whether the transistor conducts in a common base configuration. ¡Logic circuits can be built."

Similar presentations