20
Electronics “ Phys. 324 by Prof. Dr. Ali S. Hennache 1 Digital Electronics ( 04 H ): Introduction to number systems, 1H Logic gates OR, AND, NOT, X-OR, NAND, NOR gates 1H- Truth tables – Positive and negative logic – Logic families and their characteristics 1H –Universal building blocks NAND and NOR gates 1H. Prof. Dr. Ali S. Hennache- Department of Physics - College of Sciences - Al-Imam Muhammad Ibn Saud Islamic University - Riyadh Sept.

Electronics “ Phys. 324 ” by Prof. Dr. Ali S. Hennache 1 Digital Electronics ( 04 H ): Introduction to number systems, 1H Logic gates OR, AND, NOT, X-OR,

Embed Size (px)

Citation preview

Page 1: Electronics “ Phys. 324 ” by Prof. Dr. Ali S. Hennache 1 Digital Electronics ( 04 H ): Introduction to number systems, 1H Logic gates OR, AND, NOT, X-OR,

Prof. Dr. Ali S. Hennache- Department of Physics - College of Sciences - Al-Imam Muhammad Ibn Saud Islamic University - Riyadh Sept. 2012.

1

Electronics “ Phys. 324” by

Prof. Dr. Ali S. Hennache

Digital Electronics ( 04 H ):

Introduction to number systems, 1H Logic gates OR, AND, NOT, X-OR, NAND, NOR gates 1H- Truth tables – Positive and negative logic – Logic families and their characteristics 1H –Universal building blocks NAND and NOR gates 1H.

Page 2: Electronics “ Phys. 324 ” by Prof. Dr. Ali S. Hennache 1 Digital Electronics ( 04 H ): Introduction to number systems, 1H Logic gates OR, AND, NOT, X-OR,

Prof. Dr. Ali S. Hennache- Department of Physics - College of Sciences - Al-Imam Muhammad Ibn Saud Islamic University - Riyadh Sept. 2012.

2

INTRODUCTION

The binary (or base 2) number system is a positional number system that represents numeric values using two symbols - zero (0) and one (1). For this reason, it is said to have a radix of 2. Binary values are stored using transistorized switches in microprocessors and memory chips, and can be manipulated using digital logic circuitry. For this reason, the binary number system is used by computer hardware to carry out all machine-level operations, and to store data in working memory. The bulk storage of non-volatile data on magnetic disk and optical media is also possible largely due to the simple two-state nature of binary values. Binary numbers are expressed as a series of one or more binary digits (bits), occasionally with the suffix 2 to indicate that they are in fact binary (base 2) numbers. Here is the decimal number 170 expressed as a binary number:

101010102

BINARY NUMBERS

Page 3: Electronics “ Phys. 324 ” by Prof. Dr. Ali S. Hennache 1 Digital Electronics ( 04 H ): Introduction to number systems, 1H Logic gates OR, AND, NOT, X-OR,

Prof. Dr. Ali S. Hennache- Department of Physics - College of Sciences - Al-Imam Muhammad Ibn Saud Islamic University - Riyadh Sept. 2012.

3

INTRODUCTION

Binary Decimal Binary Decimal

0000 0 1000 8

0001 1 1001 9

0010 2 1010 10

0011 3 1011 11

0100 4 1100 12

0101 5 1101 13

0110 6 1110 14

0111 7 1111 15

Like the decimal system with which we are familiar, the position of each digit within a binary number determines its value. Whereas each position in a decimal number represents some power of 10, however, each position in a binary number represents a power of 2. The table below shows the numbers 0 to 15 (to base 10) as 4-bit binary numbers (15 is the largest number that can be expressed using four binary digits).

The decimal number 15 expressed as a binary number (1111) is therefore:1x23+1x22+1x21+1x20 (8+4+2+1=15)

Page 4: Electronics “ Phys. 324 ” by Prof. Dr. Ali S. Hennache 1 Digital Electronics ( 04 H ): Introduction to number systems, 1H Logic gates OR, AND, NOT, X-OR,

Prof. Dr. Ali S. Hennache- Department of Physics - College of Sciences - Al-Imam Muhammad Ibn Saud Islamic University - Riyadh Sept. 2012.

4

INTRODUCTIONFractions can also be represented using binary digits, as can real (fractional) numbers. Like real numbers to base 10, the fractional part of a binary number follows a period. In the decimal number system we call this a decimal point, but in the binary number system we call it a binary point. In the decimal system, the numeral in the first position following the decimal point is multiplied by 10-1 (0.1), the digit in the second position following the decimal point is multiplied by 10-2 (0.01), and so on. The fractional part of a binary number works on the same principle, except that the digit in the first position following the binary point is multiplied by 2-1 (0.5 to base 10), the digit in the second position following the binary point is multiplied by 2-2 (0.25 to base 10), and so on.

Page 5: Electronics “ Phys. 324 ” by Prof. Dr. Ali S. Hennache 1 Digital Electronics ( 04 H ): Introduction to number systems, 1H Logic gates OR, AND, NOT, X-OR,

Prof. Dr. Ali S. Hennache- Department of Physics - College of Sciences - Al-Imam Muhammad Ibn Saud Islamic University - Riyadh Sept. 2012.

5

INTRODUCTION

• Hardware consists of a few simple building blocks called logic gates: AND, OR, NOT, NAND, NOR, XOR, …• Logic gates are built using transistors NOT gate can be implemented by a single transistor AND gate requires 3 transistors• Transistors are the fundamental devices in computing hardware for example - Pentium consists of 3 million transistors - Compaq Alpha consists of 9 million transistors - Nowadays chips can be builded with more than 100 million transistors

LOGIC GATES

Page 6: Electronics “ Phys. 324 ” by Prof. Dr. Ali S. Hennache 1 Digital Electronics ( 04 H ): Introduction to number systems, 1H Logic gates OR, AND, NOT, X-OR,

Prof. Dr. Ali S. Hennache- Department of Physics - College of Sciences - Al-Imam Muhammad Ibn Saud Islamic University - Riyadh Sept. 2012.

6

AND GATE

Y

X

Z

Z = X & Y

x y z

0 0 00 1 01 0 01 1 1

Logic generally has only 2 states, ON or OFF, represented by 1 or 0. Logic gates react to inputs in certain ways.

The AND gate will only switch on its output Q, if Input A is ON and Input B is ON. This can be shown in a Truth Table, 0=OFF and 1=ON.

Truth Table

Symbol for AND gate

Page 7: Electronics “ Phys. 324 ” by Prof. Dr. Ali S. Hennache 1 Digital Electronics ( 04 H ): Introduction to number systems, 1H Logic gates OR, AND, NOT, X-OR,

Prof. Dr. Ali S. Hennache- Department of Physics - College of Sciences - Al-Imam Muhammad Ibn Saud Islamic University - Riyadh Sept. 2012.

7

AND GATE - EXAMPLE

Logic can be used to control devices according to certain conditions, such as “switch on a fan if it’s hot AND the sun is out”. Look at the diagrams below.

If both inputs are OFF the output is OFF

Even if one input is ON the output is OFF

Only if A =1 and B =1 will the output switch on

Page 8: Electronics “ Phys. 324 ” by Prof. Dr. Ali S. Hennache 1 Digital Electronics ( 04 H ): Introduction to number systems, 1H Logic gates OR, AND, NOT, X-OR,

Prof. Dr. Ali S. Hennache- Department of Physics - College of Sciences - Al-Imam Muhammad Ibn Saud Islamic University - Riyadh Sept. 2012.

8

AND GATE- EXAMPLE

In the figure below, X and Y are two switches which have been connected in series (or just cascaded) with the load LED and source battery. When both switches are closed, current flows to LED.

In the figure, X and Y are two switches which have been connected in parallel, and this is connected in series with the load LED and source battery. When both switches are open, current does not flow to LED, but when any switch is closed then current flows.

AND Gate OR Gate

Page 9: Electronics “ Phys. 324 ” by Prof. Dr. Ali S. Hennache 1 Digital Electronics ( 04 H ): Introduction to number systems, 1H Logic gates OR, AND, NOT, X-OR,

Prof. Dr. Ali S. Hennache- Department of Physics - College of Sciences - Al-Imam Muhammad Ibn Saud Islamic University - Riyadh Sept. 2012.

9

TEST

A B Q

0 0

0 1

1 0

1 1

NOT

ORA

B

Q

NANDA

B

Q

NORA

B

Q

XORA

B

Q

A Q

RULE: Q = 0 if A OR B =1

A B Q

0 0

0 1

1 0

1 1

RULE: Q = 0 if A AND B =1

A B Q

0 0

0 1

1 0

1 1

ANDA

B

Q

RULE: Q = 1 if A AND B =1 RULE: Q = 1 if A OR B =1

A B Q

0 0

0 1

1 0

1 1

A B Q

0 0

0 1

1 0

1 1

A Q

0

1

RULE: Q = 0 if A =1

Q = 1 if A OR B =1, but NOT both

work out the truth tables for these gates. The solution will be given in the next lecture

Page 10: Electronics “ Phys. 324 ” by Prof. Dr. Ali S. Hennache 1 Digital Electronics ( 04 H ): Introduction to number systems, 1H Logic gates OR, AND, NOT, X-OR,

Prof. Dr. Ali S. Hennache- Department of Physics - College of Sciences - Al-Imam Muhammad Ibn Saud Islamic University - Riyadh Sept. 2012.

10

POSITIVE AND NEGATIVE LOGIC

• Low voltage level: < 0.4V• High voltage level: > 2.4V• Positive logic:

∗ Low voltage represents 0 ∗ High voltage represents 1

• Negative logic: ∗ High voltage represents 0 ∗ Low voltage represents 1

Page 11: Electronics “ Phys. 324 ” by Prof. Dr. Ali S. Hennache 1 Digital Electronics ( 04 H ): Introduction to number systems, 1H Logic gates OR, AND, NOT, X-OR,

Prof. Dr. Ali S. Hennache- Department of Physics - College of Sciences - Al-Imam Muhammad Ibn Saud Islamic University - Riyadh Sept. 2012.

11

DIODE GATES

Diode-Resistor AND Gate Diode-Resistor OR Gate

Some logic gates can be produced with just diodes and resistors (called diode resistor logic or DRL).

Page 12: Electronics “ Phys. 324 ” by Prof. Dr. Ali S. Hennache 1 Digital Electronics ( 04 H ): Introduction to number systems, 1H Logic gates OR, AND, NOT, X-OR,

Prof. Dr. Ali S. Hennache- Department of Physics - College of Sciences - Al-Imam Muhammad Ibn Saud Islamic University - Riyadh Sept. 2012.

12

LOGIC CHIPS USING TRANSISTORS• Basic building block: Transistor• Three connection points

∗ Base ∗ Emitter ∗ Collector

• Transistor can operate ∗ Linear mode ( used in amplifiers) ∗ Switching mode (used to implement digital circuits

Page 13: Electronics “ Phys. 324 ” by Prof. Dr. Ali S. Hennache 1 Digital Electronics ( 04 H ): Introduction to number systems, 1H Logic gates OR, AND, NOT, X-OR,

Prof. Dr. Ali S. Hennache- Department of Physics - College of Sciences - Al-Imam Muhammad Ibn Saud Islamic University - Riyadh Sept. 2012.

13

2 INPUT NANDLogic gates normally come packaged in integrated circuits, but to study the internal works of them you need to be able to build them using discrete components. This is a great exercise for those interested in digital electronic circuits for beginners, specially if you like to learn exactly how things work internally.

Page 14: Electronics “ Phys. 324 ” by Prof. Dr. Ali S. Hennache 1 Digital Electronics ( 04 H ): Introduction to number systems, 1H Logic gates OR, AND, NOT, X-OR,

Prof. Dr. Ali S. Hennache- Department of Physics - College of Sciences - Al-Imam Muhammad Ibn Saud Islamic University - Riyadh Sept. 2012.

14

TRANSISTOR AND GATE

The simplest logic gate can be built using only one transistor: the NOT gate. To build it you need to configure the transistor to be in open collector mode, so that when voltage is applied at the base, the transistor switches on and connects to ground, effectively inverting the input applied at the base.

AND gate - Here you need to connect two transistors in a way that the output is high only when both inputs are high.

Page 15: Electronics “ Phys. 324 ” by Prof. Dr. Ali S. Hennache 1 Digital Electronics ( 04 H ): Introduction to number systems, 1H Logic gates OR, AND, NOT, X-OR,

Prof. Dr. Ali S. Hennache- Department of Physics - College of Sciences - Al-Imam Muhammad Ibn Saud Islamic University - Riyadh Sept. 2012.

15

AND GATE THREE TRANSISTORS

Page 16: Electronics “ Phys. 324 ” by Prof. Dr. Ali S. Hennache 1 Digital Electronics ( 04 H ): Introduction to number systems, 1H Logic gates OR, AND, NOT, X-OR,

Prof. Dr. Ali S. Hennache- Department of Physics - College of Sciences - Al-Imam Muhammad Ibn Saud Islamic University - Riyadh Sept. 2012.

16

TRANSISTOR OR GATE

OR gate - This is simpler, you connect them in a way that when either input is high the output will be high.

Page 17: Electronics “ Phys. 324 ” by Prof. Dr. Ali S. Hennache 1 Digital Electronics ( 04 H ): Introduction to number systems, 1H Logic gates OR, AND, NOT, X-OR,

Prof. Dr. Ali S. Hennache- Department of Physics - College of Sciences - Al-Imam Muhammad Ibn Saud Islamic University - Riyadh Sept. 2012.

17

2 INPUT NANDLogic gates normally come packaged in integrated circuits, but to study the internal works of them you need to be able to build them using discrete components. This is a great exercise for those interested in digital electronic circuits for beginners, specially if you like to learn exactly how things work internally.

Page 18: Electronics “ Phys. 324 ” by Prof. Dr. Ali S. Hennache 1 Digital Electronics ( 04 H ): Introduction to number systems, 1H Logic gates OR, AND, NOT, X-OR,

Prof. Dr. Ali S. Hennache- Department of Physics - College of Sciences - Al-Imam Muhammad Ibn Saud Islamic University - Riyadh Sept. 2012.

18

TRANSISTOR NAND GATEIt is a simple matter to make a NAND gate out of transistors and a resistor:

The resistors on the inputs limit the base-emitter current to just enough to turn the transistors on. It is important to understand that the inputs are not connected to the output, they only determine whether the output is connected to +5V or 0 V. You can see that this circuit performs the NAND operation. If both transistors are on (both inputs +5V or 1) the output will be connected to ground (be at 0V or 0). If either transistor is off, the output is connected through the resistor to +5V. Here is the circuit behavior presented as a truth table:

In 1 = 1,In 2 = 1, Out = 0

In 1 = 1In 2 = 0, Out = 1

Page 19: Electronics “ Phys. 324 ” by Prof. Dr. Ali S. Hennache 1 Digital Electronics ( 04 H ): Introduction to number systems, 1H Logic gates OR, AND, NOT, X-OR,

Prof. Dr. Ali S. Hennache- Department of Physics - College of Sciences - Al-Imam Muhammad Ibn Saud Islamic University - Riyadh Sept. 2012.

19

TRANSISTOR NOT GATENOT gate - This is the simplest one to build, as mentioned in the introduction, you only need one transistor for this one.

In = high, switch is closed so current flows to ground Out is low.

control high allows current to flow -switch is closed (on) control low stops current flow switch is open (off)

Page 20: Electronics “ Phys. 324 ” by Prof. Dr. Ali S. Hennache 1 Digital Electronics ( 04 H ): Introduction to number systems, 1H Logic gates OR, AND, NOT, X-OR,

Prof. Dr. Ali S. Hennache- Department of Physics - College of Sciences - Al-Imam Muhammad Ibn Saud Islamic University - Riyadh Sept. 2012.

20

TRANSISTOR NOR GATE

In 1 = 1, Out = 0

In 2 = 1, Out = 0

In 1 = 0In 2 = 0, Out = 1