0% found this document useful (0 votes)
3 views

Digital Electronics-Lecture1+2-Number system_Logic gates[2025]

The document provides an overview of digital electronics, explaining the differences between analog and digital systems, the use of binary digits, and various digital waveforms. It covers basic logic functions, system functions, integrated circuits, and measurement instruments, as well as programmable logic devices. Additionally, it includes key terms and examples related to number systems and their operations.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

Digital Electronics-Lecture1+2-Number system_Logic gates[2025]

The document provides an overview of digital electronics, explaining the differences between analog and digital systems, the use of binary digits, and various digital waveforms. It covers basic logic functions, system functions, integrated circuits, and measurement instruments, as well as programmable logic devices. Additionally, it includes key terms and examples related to number systems and their operations.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 124

Digital Electronics

Introduction
Analog Quantities
Most natural quantities that we see are analog and vary
continuously.

Temperature
(°F)

100
95
90
85
80
75
70
Time of day
1 2 3 4 5 6 7 8 9 10 11 12 1 2 3 4 5 6 7 8 9 10 11 12
A .M . P.M .

Digital systems can process, store, and transmit data more


efficiently but can only assign discrete values to each point.

2
Introduction
Analog and Digital Systems

Many systems use a mix of analog and digital electronics to


take advantage of each technology. A typical CD player
accepts digital data from the CD drive and converts it to an
analog signal for amplification.
CD drive

10110011101 Digital-to-analog Linear amplifier


Digital data converter Analog
reproduction
of music audio Speaker
signal
Sound
waves

3
Introduction
Binary Digits and Logic Levels

Digital electronics uses circuits that have two states, which


are represented by two different voltage levels called HIGH
and LOW. The voltages represent numbers in the binary
system.
VH(max)
In binary, a single number is HIGH
called a bit (for binary digit). A VH(min)

bit can have the value of either Invalid


VL(max)
a 0 or a 1, depending on if the
voltage is HIGH or LOW. LOW
VL(min)

4
Introduction

Digital Waveforms

Digital waveforms change between the LOW and HIGH


levels. A positive going pulse is one that goes from a
normally LOW logic level to a HIGH level and then back
again. Digital waveforms are made up of a series of pulses.
HIGH HIGH
Rising or Falling or Falling or Rising or
leading edge trailing edge leading edge trailing edge

LOW LOW
t0 t1 t0 t1

(a) Positive–going pulse (b) Negative–going pulse

5
Introduction

Pulse Definitions

Actual pulses are not ideal but are described by the rise time,
fall time, amplitude, and other characteristics.
Overshoot
Ringing
Droop
90%
Amplitude tW
50%
Pulse width

10%
Ringing

Base line Undershoot


tr tf
Rise time Fall time

6
Introduction

Periodic Pulse Waveforms

Periodic pulse waveforms are composed of pulses that repeats


in a fixed interval called the period. The frequency is the rate
it repeats and is measured in hertz.
1 1
f = T=
T f

The clock is a basic timing signal that is an example of a


periodic wave.
Example What is the period of a repetitive wave if f = 3.2 GHz?
1 1
Solution T= =
f 3.2 GHz
= 313 ps

7
Introduction

Pulse Definitions

In addition to frequency and period, repetitive pulse waveforms


are described by the amplitude (A), pulse width (tW) and duty
cycle. Duty cycle is the ratio of tW to T.
Volts

Pulse
width
Amplitude (A)
(tW)

Time
Period, T

8
Introduction
Timing Diagrams

A timing diagram is used to show the relationship between


two or more digital waveforms,
Clock

A diagram like this can be observed


directly on a logic analyzer.

9
Introduction
Serial and Parallel Data

Data can be transmitted by either serial transfer or parallel


transfer.
1 0 1 1 0 0 1 0
t0 t1 t2 t3 t 4 t5 t6 t7
Computer Modem

1
Computer Printer
0

0
t0 t1

10
Introduction
Basic Logic Functions

AND True only if all input conditions


are true.

OR True only if one or more input


conditions are true.

NOT Indicates the opposite condition.

11
Introduction
Basic System Functions
And, or, and not elements can be combined to form
various logic functions. A few examples are:

The comparison function A


Comparator
A> B

Two
binary A= B Outputs
numbers
B
A< B

Basic arithmetic functions Adder


A
Two Σ Sum
binary
numbers Carry out
Cout
B
Carry in Cin

12
Introduction
Basic System Functions
HIGH
9 Encoder
8
7
6 Binary code
5 for 9 used for
4 storage and/or
The encoding function 3 computation
2
7 8 9 1
4 5 6 0
1 2 3
0 . +/–
Calculator keypad

The decoding function


Decoder

Binary input

7-segment display
13
Introduction
Basic System Functions

The data selection function


Multiplexer Demultiplexer
A D
Data from Data from Data from Data from
A to D B to E C to F A to D
∆t1 ∆t1
∆ t1 ∆ t2 ∆ t3 ∆t 1
B E
∆t2 ∆t2
∆t3 ∆t3
C F

Switching Switching
sequence sequence
control input control input

14
Summary
Introduction
Basic System Functions

The counting function

Counter Parallel
output lines Binary Binary Binary Binary Binary
code code code code code
1 2 3 4 5 for 1 for 2 for 3 for 4 for 5
Input pulses Sequence of binary codes that represent
the number of input pulses counted.

…and other functions such as code conversion


and storage.

15
Introduction
Basic System Functions

One type of storage function is the shift register,


that moves and stores data each time it is clocked.
Serial bits
on input line
Initially, the register contains onlyinvalid
0101 0 0 0 0 data or all zeros as shown here.

First bit (1) is shifted serially into the


010 1 0 0 0 register.

Second bit (0) is shifted serially into


01 0 1 0 0 register and first bit is shifted right.

Third bit (1) is shifted into register and


0 1 0 1 0 the first and second bits are shifted right.

Fourth bit (0) is shifted into register and


0 1 0 1 the first, second, and third bits are shifted
right. The register now stores all four bits
and is full.

16
Introduction
Integrated Circuits

Cutaway view of DIP (Dual-In-line Pins) chip:


Plastic
Chip case

Pins

The TTL series, available as DIPs are popular


for laboratory experiments with logic.

17
Introduction
Integrated Circuits

An example of laboratory prototyping is shown. The circuit


is wired using DIP chips and tested.

DIP chips
In this case, testing can
be done by a computer
connected to the system.

18
Introduction
Integrated Circuits

DIP chips and surface mount chips

Pin 1

Dual in-line package Small outline IC (SOIC)

19
Introduction
Integrated Circuits

Other surface mount packages:

Plastic Leaded Chip


Carrier Packages
(PLCC)
End view End view End view

SOIC PLCC

http://www.intersil.com/design/packages/
20
Introduction
Test and Measurement Instruments
The front panel controls for a general-purpose oscilloscope
can be divided into four major groups.

VERTICAL HORIZONTAL TRIGGER


CH 1 CH 2 BOTH SLOPE
Ð +

POSITION POSITION POSITION LEVEL

VOLTS/DIV VOLTS/DIV SEC/DIV SOURCE


CH 1
CH 2
EXT
5V 2 mV 5V 2 mV 5s 5 ns
LINE
COUPLING COUPLING
AC-DC-GND AC-DC-GND TRIG COUP
DC AC

DISPLAY
PROBE COMP CH 1 CH 2 EXT TRIG
5V

INTENSITY

21
Introduction
Test and Measurement Instruments
The logic analyzer can display multiple channels of digital
information or show data in tabular form.

22
Introduction
Test and Measurement Instruments OFF V
Hz

The DMM can make three basic mV

electrical measurements. 10 A
A Range
Autorange
Touch/Hold
1s
1s

Voltage
40 m A COM

Fused

Resistance
Current

In digital work, DMMs are useful for checking power


supply voltages, verifying resistors, testing continuity,
and occasionally making other measurements.

23
Introduction
Programmable Logic

Programmable logic devices (PLDs) are an alternative to


fixed function devices. The logic can be programmed for a
specific purpose. In general, they cost less and use less
board space that fixed function devices.
A PAL device is a form of PLD that uses a
combination of a programmable AND array and a
fixed OR array:

Fixed OR
Programmable array and
AND array output logic

24
Selected Key Terms

Analog Being continuous or having continuous values.


Digital Related to digits or discrete quantities; having a set
of discrete values.
Binary Having two values or states; describes a number
system that has a base of two and utilizes 1 and 0
as its digits.
Bit A binary digit, which can be a 1 or a 0.
Pulse A sudden change from one level to another,
followed after a time, called the pulse width, by a
sudden change back to the original level.

25
Selected Key Terms

Clock A basic timing signal in a digital system; a periodic


waveform used to synchronize actions.
Gate A logic circuit that performs a basic logic
operations such as AND or OR.
NOT A basic logic function that performs inversion.
AND A basic logic operation in which a true (HIGH)
output occurs only when all input conditions are
true (HIGH).
OR A basic logic operation in which a true (HIGH)
output occurs when when one or more of the input
conditions are true (HIGH).
26
Selected Key Terms

Fixed-function A category of digital integrated circuits having


logic functions that cannot be altered.
Programmable A category of digital integrated circuits capable of
logic being programmed to perform specified functions.

27
1. Compared to analog systems, digital systems
a. are less prone to noise
b. can represent an infinite number of values
c. can handle much higher power
d. all of the above

28
© 2008 Pearson Education
2. The number of values that can be assigned to a bit are
a. one
b. two
c. three
d. ten

29
© 2008 Pearson Education
3. The time measurement between the 50% point on the
leading edge of a pulse to the 50% point on the trailing edge
of the pulse is called the
a. rise time
b. fall time
c. period
d. pulse width

30
© 2008 Pearson Education
4. The time measurement between the 90% point on the
trailing edge of a pulse to the 10% point on the trailing edge of
the pulse is called the
a. rise time
b. fall time
c. period
d. pulse width

31
© 2008 Pearson Education
5. The reciprocal of the frequency of a clock signal is the
a. rise time
b. fall time
c. period
d. pulse width

32
© 2008 Pearson Education
6. If the period of a clock signal is 500 ps, the frequency is
a. 20 MHz
b. 200 MHz
c. 2 GHz
d. 20 GHz

33
© 2008 Pearson Education
7. AND, OR, and NOT gates can be used to form
a. storage devices
b. comparators
c. data selectors
d. all of the above

34
© 2008 Pearson Education
8. A shift register is an example of a
a. storage device
b. comparator
c. data selector
d. counter

35
© 2008 Pearson Education
9. A device that is used to switch one of several input lines to
a single output line is called a
a. comparator
b. decoder
c. counter
d. multiplexer

36
© 2008 Pearson Education
10. For most digital work, an oscilloscope should be coupled
to the signal using
a. ac coupling
b. dc coupling
c. GND coupling
d. none of the above

37
© 2008 Pearson Education
Answers:
1. a 6. c
2. b 7. d
3. d 8. a
4. b 9. d
5. c 10. b

38
Number systems, operations, and codes
Decimal Numbers

The position of each digit in a weighted number system is


assigned a weight based on the base or radix of the system.
The radix of decimal numbers is ten, because only ten
symbols (0 through 9) are used to represent any number.
The column weights of decimal numbers are powers
of ten that increase from right to left beginning with 100 =1:
…105 104 103 102 101 100.
For fractional decimal numbers, the column weights
are negative powers of ten that decrease from left to right:
102 101 100. 10-1 10-2 10-3 10-4 …

39
Number systems,
Summary
operations, and codes
Decimal Numbers

Decimal numbers can be expressed as the sum of the


products of each digit times the column value for that digit.
Thus, the number 9240 can be expressed as
(9 x 103) + (2 x 102) + (4 x 101) + (0 x 100)
or
9 x 1,000 + 2 x 100 + 4 x 10 + 0 x 1

Example Express the number 480.52 as the sum of values of each


digit.
Solution
480.52 = (4 x 102) + (8 x 101) + (0 x 100) + (5 x 10-1) +(2 x 10-2)

40
Number systems, operations, and codes
Binary Numbers

For digital systems, the binary number system is used.


Binary has a radix of two and uses the digits 0 and 1 to
represent quantities.
The column weights of binary numbers are powers of
two that increase from right to left beginning with 20 =1:
…25 24 23 22 21 20.
For fractional binary numbers, the column weights
are negative powers of two that decrease from left to right:
22 21 20. 2-1 2-2 2-3 2-4 …

41
Number systems, operations, and codes
Decimal Binary
Binary Numbers Number Number

A binary counting sequence for numbers 0 0000


1 0001
from zero to fifteen is shown. 2 0010
Notice the pattern of zeros and ones in 3 0011
each column. 4 0100
5 0101
Digital counters frequently have this 6 0110
same pattern of digits: 7 0111
8 1000
Counter 0 1 0 1 0 1 0 1 0 1 Decoder
9 1001
0 0 1 1 0 0 1 1 0 0
10 1010
0 0 0 0 1 1 1 1 0 0
11 1011
0 0 0 0 0 0 0 0 1 1 12 1100
13 1101
14 1110
15 1111 42
Number systems, operations, and codes
Binary Conversions

The decimal equivalent of a binary number can be


determined by adding the column values of all of the bits
that are 1 and discarding all of the bits that are 0.
Example Convert the binary number 100101.01 to decimal.
Solution Start by writing the column weights; then add the
weights that correspond to each 1 in the number.
25 24 23 22 21 20. 2-1 2-2
32 16 8 4 2 1 . ½ ¼
1 0 0 1 0 1. 0 1
32 +4 +1 +¼ = 37¼

43
Number systems, operations, and codes
Binary Conversions

You can convert a decimal whole number to binary by


reversing the procedure. Write the decimal weight of each
column and place 1’s in the columns that sum to the decimal
number.
Example Convert the decimal number 49 to binary.
Solution Write down column weights until the last number is
larger than the one you want to convert.

2 6 25 24 23 22 21 2 0.
64 32 16 8 4 2 1.
0 1 1 0 0 0 1.

44
Number systems, operations, and codes
Binary Conversions

You can convert a decimal fraction to binary by repeatedly


multiplying the fractional results of successive
multiplications by 2. The carries form the binary number.

Example Convert the decimal fraction 0.188 to binary by


repeatedly multiplying the fractional results by 2.
Solution 0.188 x 2 = 0.376 carry = 0 MSB
0.376 x 2 = 0.752 carry = 0
0.752 x 2 = 1.504 carry = 1
0.504 x 2 = 1.008 carry = 1
0.008 x 2 = 0.016 carry = 0
Answer = .00110 (for five significant digits)

45
Number systems, operations, and codes
Binary Conversions

You can convert decimal to any other base by repeatedly


dividing by the base. For binary, repeatedly divide by 2:

Example Convert the decimal number 49 to binary by


repeatedly dividing by 2.
Solution You can do this by “reverse division” and the
answer will read from left to right. Put quotients to
the left and remainders on top.
Answer: 1 1 0 0 0 1 remainder
0 1 3 6 12 24 49 2
Continue until the Decimal
Quotient base
last quotient is 0 number

46
Number systems, operations, and codes
Binary Addition

The rules for binary addition are


0+0=0 Sum = 0, carry = 0
0+1=0 Sum = 1, carry = 0
1+0=0 Sum = 1, carry = 0
1 + 1 = 10 Sum = 0, carry = 1
When an input carry = 1 due to a previous result, the rules
are
1 + 0 + 0 = 01 Sum = 1, carry = 0
1 + 0 + 1 = 10 Sum = 0, carry = 1
1 + 1 + 0 = 10 Sum = 0, carry = 1
1 + 1 + 1 = 10 Sum = 1, carry = 1

47
Number systems, operations, and codes
Binary Addition

Example Add the binary numbers 00111 and 10101 and show
the equivalent decimal addition.
Solution
0111
00111 7
10101 21
11100 = 28

48
Number systems, operations, and codes
Binary Subtraction

The rules for binary subtraction are


0−0=0
1−1=0
1−0=1
10 − 1 = 1 with a borrow of 1

Example Subtract the binary number 00111 from 10101 and


show the equivalent decimal subtraction.
Solution 111
10101
/ / / 21
00111 7
01110 = 14

49
Number systems, operations, and codes
1’s Complement

The 1’s complement of a binary number is just the inverse


of the digits. To form the 1’s complement, change all 0’s to
1’s and all 1’s to 0’s.
For example, the 1’s complement of 11001010 is
00110101
In digital circuits, the 1’s complement is formed by using
inverters:
1 1 0 0 1 0 1 0

0 0 1 1 0 1 0 1

50
Number systems, operations, and codes
2’s Complement

The 2’s complement of a binary number is found by


adding 1 to the LSB of the 1’s complement.
Recall that the 1’s complement of 11001010 is
00110101 (1’s complement)
To form the 2’s complement, add 1: +1
1 1 0 0 1 0 1 0 00110110 (2’s complement)
1

0 0 1 1 0 1 0 1
Input bits
Carry
Adder
in (add 1)
Output bits (sum)

0 0 1 1 0 1 1 0

51
Number systems, operations, and codes
Signed Binary Numbers

There are several ways to represent signed binary numbers.


In all cases, the MSB in a signed number is the sign bit, that
tells you if the number is positive or negative.
Computers use a modified 2’s complement for
signed numbers. Positive numbers are stored in true form
(with a 0 for the sign bit) and negative numbers are stored
in complement form (with a 1 for the sign bit).
For example, the positive number 58 is written using 8-bits as
00111010 (true form).

Sign bit Magnitude bits

52
Number systems, operations, and codes
Signed Binary Numbers
Negative numbers are written as the 2’s complement of the
corresponding positive number.
The negative number −58 is written as:
−58 = 11000110 (complement form)
Sign bit Magnitude bits
An easy way to read a signed number that uses this notation is to
assign the sign bit a column weight of −128 (for an 8-bit number).
Then add the column weights for the 1’s.
Assuming that the sign bit = −128, show that 11000110 = −58
Example as a 2’s complement signed number:
Solution Column weights: −128 64 32 16 8 4 2 1.
1 1 0 0 0 1 1 0
−128 +64 +4 +2 = −58

53
Number systems, operations, and codes
Floating Point Numbers IEEE 754 binary formats
Floating point notation is capable of representing very large
or small numbers by using a form of scientific notation. A 32-
bit single precision number is illustrated.
S E (8 bits) F (23 bits)
Sign bit Biased exponent (+127) Magnitude with MSB dropped
Express the speed of light, c, in single precision floating point
Example notation. (c = 0.2998 x 109)
Solution In binary, c = 0001 0001 1101 1110 1001 0101 1100 00002.
In scientific notation, c = 1.001 1101 1110 1001 0101 1100 0000 x 228.
S = 0 because the number is positive. E = 28 + 127 = 15510 = 1001 10112.
F is the next 23 bits after the first 1 is dropped.
In floating point notation, c = 0 10011011 001 1101 1110 1001 0101 1100

64-bit double precision number, 80-bit extended precision,… 54


Number systems, operations, and codes
Arithmetic Operations with Signed Numbers
Using the signed number notation with negative
numbers in 2’s complement form simplifies addition
and subtraction of signed numbers.
Rules for addition: Add the two signed numbers. Discard
any final carries. The result is in signed form.
Examples:
00011110 = +30 00001110 = +14 11111111 = −1
00001111 = +15 11101111 = −17 11111000 = −8
00101101 = +45 11111101 = −3 1 11110111 = −9
Discard carry

55
Number systems, operations, and codes
Arithmetic Operations with Signed Numbers

Note that if the number of bits required for the answer is


exceeded, overflow will occur. This occurs only if both
numbers have the same sign. The overflow will be
indicated by an incorrect sign bit.
Two examples are:
01000000 = +128 10000001 = −127
01000001 = +129 10000001 = −127
10000001 = −126 Discard carry 100000010 = +2

Wrong! The answer is incorrect


and the sign bit has changed.

56
Number systems, operations, and codes
Arithmetic Operations with Signed Numbers số bị trừ

Rules for subtraction: 2’s complement the subtrahend and


add the numbers. Discard any final carries. The result is in
signed form.
Repeat the examples done previously, but subtract:
00011110 (+30) 00001110 (+14) 11111111 (−1)
− 00001111 –(+15) − 11101111 –(−17) − 11111000 –(−8)
2’s complement subtrahend and add:
00011110 = +30 00001110 = +14 11111111 = −1
11110001 = −15 00010001 = +17 00001000 = +8
1 00001111 = +15 00011111 = +31 1 00000111 = +7
Discard carry Discard carry

57
Number systems, operations, and codes
Decimal Hexadecimal Binary
Hexadecimal Numbers 0 0 0000
1 1 0001
Hexadecimal uses sixteen characters to 2 2 0010
represent numbers: the numbers 0 3 3 0011
through 9 and the alphabetic characters 4 4 0100
A through F. 5 5 0101
6 6 0110
Large binary number can easily 7 7 0111
be converted to hexadecimal by 8 8 1000
grouping bits 4 at a time and writing 9 9 1001
the equivalent hexadecimal character. 10 A 1010
11 B 1011
Example Express 1001 0110 0000 11102 in
hexadecimal:
12 C 1100
13 D 1101
Solution Group the binary number by 4-bits 14 E 1110
starting from the right. Thus, 960E 15 F 1111

58
Number systems, operations, and codes
Decimal Hexadecimal Binary
Hexadecimal Numbers 0 0 0000
1 1 0001
Hexadecimal is a weighted number 2 2 0010
system. The column weights are 3 3 0011
powers of 16, which increase from 4 4 0100
5 5 0101
right to left. 6 6 0110
7 7 0111
Column weights {4096
3 2 1
16 16 16 16 .
256 16 1 .
0

8 8 1000
9 9 1001
Example Express 1A2F16 in decimal. 10 A 1010
11 B 1011
Solution 4096 256 16 1
Start by writing the column weights:
12 C 1100
13 D 1101
1 A 2 F16
14 E 1110
1(4096) + 10(256) +2(16) +15(1) = 670310 15 F 1111

59
Number systems, operations, and codes
Decimal Octal Binary
Octal Numbers 0 0 0000
1 1 0001
Octal uses eight characters the numbers 2 2 0010
0 through 7 to represent numbers. 3 3 0011
There is no 8 or 9 character in octal. 4 4 0100
5 5 0101
Binary number can easily be
6 6 0110
converted to octal by grouping bits 3 at 7 7 0111
a time and writing the equivalent octal 8 10 1000
character for each group. 9 11 1001
10 12 1010
Example Express 1 001 011 000 001 1102 in
octal:
11 13 1011
12 14 1100
Solution Group the binary number by 3-bits 13 15 1101
starting from the right. Thus, 1130168 14 16 1110
15 17 1111

60
Number systems, operations, and codes
Decimal Octal Binary
Octal Numbers 0 0 0000
1 1 0001
Octal is also a weighted number 2 2 0010
system. The column weights are 3 3 0011
powers of 8, which increase from right 4 4 0100
5 5 0101
to left. 6 6 0110
7 7 0111
Column weights {5128
3 82
64
81
8
80 .
1 . 8 10 1000
9 11 1001
Example Express 37028 in decimal. 10 12 1010
11 13 1011
Solution 512 64 8 1
Start by writing the column weights:
12 14 1100
13 15 1101
3 7 0 28
14 16 1110
3(512) + 7(64) +0(8) +2(1) = 198610 15 17 1111

61
Number systems, operations, and codes
Decimal Binary BCD
BCD 0 0000 0000
1 0001 0001
Binary coded decimal (BCD) is a 2 0010 0010
weighted code that is commonly 3 0011 0011
used in digital systems when it is 4 0100 0100
5 0101 0101
necessary to show decimal 6 0110 0110
numbers such as in clock displays. 7 0111 0111
The table illustrates the 8 1000 1000
difference between straight binary and 9 1001 1001
BCD. BCD represents each decimal 10 1010 0001 0000
digit with a 4-bit code. Notice that the 11 1011 0001 0001
codes 1010 through 1111 are not used in 12 1100 0001 0010
BCD. 13 1101 0001 0011
14 1110 0001 0100
15 1111 0001 0101

62
Number systems, operations, and codes
BCD

You can think of BCD in terms of column weights in


groups of four bits. For an 8-bit BCD number, the column
weights are: 80 40 20 10 8 4 2 1.

Question: What are the column weights for the BCD number
1000 0011 0101 1001?
Answer:
8000 4000 2000 1000 800 400 200 100 80 40 20 10 8 4 2 1
Note that you could add the column weights where there is
a 1 to obtain the decimal number. For this case:
8000 + 200 +100 + 40 + 10 + 8 +1 = 835910

63
Number systems, operations, and codes
BCD
A lab experiment in which BCD
is converted to decimal is shown.

64
Number systems, operations, and codes
Decimal Binary Gray code
Gray code 0 0000 0000
1 0001 0001
Gray code is an unweighted code 2 0010 0011
that has a single bit change between 3 0011 0010
one code word and the next in a 4 0100 0110
5 0101 0111
sequence. Gray code is used to 6 0110 0101
avoid problems in systems where an 7 0111 0100
error can occur if more than one bit 8 1000 1100
changes at a time. 9 1001 1101
10 1010 1111
11 1011 1110
12 1100 1010
13 1101 1011
14 1110 1001
15 1111 1000

65
Number systems, operations, and codes
Gray code
A shaft encoder is a typical application. Three IR
emitter/detectors are used to encode the position of the shaft.
The encoder on the left uses binary and can have three bits
change together, creating a potential error. The encoder on the
right uses gray code and only 1-bit changes, eliminating
potential errors.

Binary sequence
Gray code sequence

66
Number systems, operations, and codes
ASCII

ASCII is a code for alphanumeric characters and control


characters. In its original form, ASCII encoded 128
characters and symbols using 7-bits. The first 32 characters
are control characters, that are based on obsolete teletype
requirements, so these characters are generally assigned to
other functions in modern usage.

In 1981, IBM introduced extended ASCII, which is an 8-


bit code and increased the character set to 256. Other
extended sets (such as Unicode) have been introduced to
handle characters in languages other than English.

67
ASCII American Standard Code for Information
ASCII
Interchange

68
…..Unicode
Extended ASCII
Number systems, operations, and codes
Parity Method
The parity method is a method of error detection for
simple transmission errors involving one bit (or an odd
number of bits). A parity bit is an “extra” bit attached to
a group of bits to force the number of 1’s to be either
even (even parity) or odd (odd parity).

Example The ASCII character for “a” is 1100001 and for “A” is
1000001. What is the correct bit to append to make both of
these have odd parity?
Solution The ASCII “a” has an odd number of bits that are equal to 1;
therefore the parity bit is 0. The ASCII “A” has an even
number of bits that are equal to 1; therefore the parity bit is 1.

70
Number systems, operations, and codes
Cyclic Redundancy Check
The cyclic redundancy check (CRC) is an error detection method
that can detect multiple errors in larger blocks of data. At the
sending end, a checksum is appended to a block of data. At the
receiving end, the check sum is generated and compared to the sent
checksum. If the check sums are the same, no error is detected.

71
Selected Key Terms

Byte A group of eight bits


Floating-point A number representation based on scientific
number notation in which the number consists of an
exponent and a mantissa.
Hexadecimal A number system with a base of 16.
Octal A number system with a base of 8.
BCD Binary coded decimal; a digital code in which each
of the decimal digits, 0 through 9, is represented by
a group of four bits.

72
Selected Key Terms

Alphanumeric Consisting of numerals, letters, and other


characters
ASCII American Standard Code for Information
Interchange; the most widely used alphanumeric
code.
Parity In relation to binary codes, the condition of
evenness or oddness in the number of 1s in a code
group.
Cyclic A type of error detection code.
redundancy
check (CRC)
73
1. For the binary number 1000, the weight of the column
with the 1 is
a. 4
b. 6
c. 8
d. 10

74
© 2008 Pearson Education
2. The 2’s complement of 1000 is
a. 0111
b. 1000
c. 1001
d. 1010

75
© 2008 Pearson Education
3. The fractional binary number 0.11 has a decimal value of
a. ¼
b. ½
c. ¾
d. none of the above

76
© 2008 Pearson Education
4. The hexadecimal number 2C has a decimal equivalent
value of
a. 14
b. 44
c. 64
d. none of the above

77
© 2008 Pearson Education
5. Assume that a floating point number is represented in
binary. If the sign bit is 1, the
a. number is negative
b. number is positive
c. exponent is negative
d. exponent is positive

78
© 2008 Pearson Education
6. When two positive signed numbers are added, the result
may be larger that the size of the original numbers, creating
overflow. This condition is indicated by
a. a change in the sign bit
b. a carry out of the sign position
c. a zero result
d. smoke

79
© 2008 Pearson Education
7. The number 1010 in BCD is
a. equal to decimal eight
b. equal to decimal ten
c. equal to decimal twelve
d. invalid

80
© 2008 Pearson Education
8. An example of an unweighted code is
a. binary
b. decimal
c. BCD
d. Gray code

81
© 2008 Pearson Education
9. An example of an alphanumeric code is
a. hexadecimal
b. ASCII
c. BCD
d. CRC

82
© 2008 Pearson Education
10. An example of an error detection method for
transmitted data is the
a. parity check
b. CRC
c. both of the above
d. none of the above

83
© 2008 Pearson Education
Answers:
1. c 6. a
2. b 7. d
3. c 8. d
4. b 9. b
5. a 10. c

84
85
Logic gates
A X
The Inverter

The inverter performs the Boolean NOT operation. When the


input is LOW, the output is HIGH; when the input is HIGH,
the output is LOW.

Input Output
A X
LOW (0) HIGH (1)
HIGH (1) LOW(0)

The NOT operation (complement) is shown with an overbar.


Thus, the Boolean expression for an inverter is X = A.

86
Logic gates
A X
The Inverter

Example waveforms:
A
X
A group of inverters can be used to form the 1’s complement
of a binary number: Binary number
1 0 0 0 1 1 0 1

0 1 1 1 0 0 1 0
1’s complement

87
Logic gates
A A
X & X
The AND Gate B
B
The AND gate produces a HIGH output when all inputs are
HIGH; otherwise, the output is LOW. For a 2-input gate,
the truth table is Inputs Output
A B X
0 0 0
0 1 0
1 0 0
1 1 1

The AND operation is usually shown with a dot between the


variables but it may be implied (no dot). Thus, the AND
operation is written as X = A .B or X = AB.

88
Logic gates
A A
X & X
The AND Gate B
B
Example waveforms:
A
B

X
The AND operation is used in computer programming as a
selective mask. If you want to retain certain bits of a binary
number but reset the other bits to 0, you could set a mask with
1’s in the position of the retained bits.
Example If the binary number 10100011 is ANDed with
the mask 00001111, what is the result? 00000011
89
Logic gates
A X A ≥1 X
The OR Gate
B B
The OR gate produces a HIGH output if any input is HIGH;
if all inputs are LOW, the output is LOW. For a 2-input gate,
the truth table is Inputs Output
A B X
0 0 0
0 1 1
1 0 1
1 1 1

The OR operation is shown with a plus sign (+) between the


variables. Thus, the OR operation is written as X = A + B.

90
Logic gates
A X A ≥1 X
The OR Gate
B B
Example waveforms:
A
B

X
The OR operation can be used in computer programming to set certain
bits of a binary number to 1.
Example and a 0 in this position for capitals. (Bit positions are numbered
ASCII letters have a 1 in the bit 5 position for lower case letters

from right to left starting with 0.) What will be the result if you
OR an ASCII letter with the 8-bit mask 00100000?
Solution The resulting letter will be lower case.
91
Logic gates
A X A & X
The NAND Gate
B B
The NAND gate produces a LOW output when all inputs
are HIGH; otherwise, the output is HIGH. For a 2-input
gate, the truth table is Inputs Output
A B X
0 0 1
0 1 1
1 0 1
1 1 0

The NAND operation is shown with a dot between the


variables and an overbar covering them. Thus, the NAND
operation is written as X = A .B (Alternatively, X = AB.)

92
Logic gates
A X A & X
The NAND Gate
B B
Example waveforms:
A
B

X
The NAND gate is particularly useful because it is a
“universal” gate – all other basic gates can be constructed
from NAND gates.

Question How would you connect a 2-input NAND gate


to form a basic inverter?

93
Logic gates
A X A ≥1 X
The NOR Gate
B B
The NOR gate produces a LOW output if any input is
HIGH; if all inputs are HIGH, the output is LOW. For a
2-input gate, the truth table is
Inputs Output
A B X
0 0 1
0 1 0
1 0 0
1 1 0
The NOR operation is shown with a plus sign (+) between
the variables and an overbar covering them. Thus, the NOR
operation is written as X = A + B.
94
Logic gates
A X A ≥1 X
The NOR Gate
B B
Example waveforms:
A
B

X
The NOR operation will produce a LOW if any input is HIGH.
+5.0 V

Example When is the LED is ON for the circuit shown? 330 W

Solution The LED will be on when any of A


B X
the four inputs are HIGH. C
D

95
Logic gates
A X A =1 X
The XOR Gate
B B
The XOR gate produces a HIGH output only when both
inputs are at opposite logic levels. The truth table is
Inputs Output
A B X
0 0 0
0 1 1
1 0 1
1 1 0

The XOR operation is written as X = AB + AB.


Alternatively, it can be written with a circled plus sign
between the variables as X = A + B.

96
97
Logic gates
A X A =1 X
The XOR Gate
B B
Example waveforms:
A
B

X
Notice that the XOR gate will produce a HIGH only when exactly one
input is HIGH.

Question waveforms, how is the output affected?


If the A and B waveforms are both inverted for the above

There is no change in the output.

98
Logic gates
A X A =1 X
The XNOR Gate
B B
The XNOR gate produces a HIGH output only when both
inputs are at the same logic level. The truth table is
Inputs Output
A B X
0 0 1
0 1 0
1 0 0
1 1 1
The XNOR operation shown as X = AB + AB. Alternatively,
the XNOR operation can be shown with a circled dot
between the variables. Thus, it can be shown as X = A . B.

99
Logic gates
A X A =1 X
The XNOR Gate
B B
Example waveforms:
A
B

X
Notice that the XNOR gate will produce a HIGH when both inputs are the
same. This makes it useful for comparison functions.

Question the output affected?


If the A waveform is inverted but B remains the same, how is

The output will be inverted.

100
Logic gates
Fixed Function Logic

Two major fixed function logic families are TTL and CMOS.
A third technology is BiCMOS, which combines the first
two. Packaging for fixed function logic is shown.
0.335 – 0.334 in.
0.740 – 0.770 in. 14 13 12 11 10 9 8

14 13 12 11 10 9 8

0.250 ± 0.010 in. 0.228 – 0.244 in.

1 2 3 4 5 6 7

1 2 3 4 5 6 7
Pin no.1 Lead no.1
identifiers identifier
14
1 14
1

DIP package SOIC package

Dual in-line package (DIP) Small-outline Integrated Circuit (SOIC)


101
Logic gates
Fixed Function Logic
Some common gate configurations are shown.
VCC VCC VCC VCC
14 13 12 11 10 9 8 14 13 12 11 10 9 8 14 13 12 11 10 9 8 14 13 12 11 10 9 8

1 2 3 4 5 6 7 1 2 3 4 5 6 7 1 2 3 4 5 6 7 1 2 3 4 5 6 7
GND GND GND GND
'00 ' 02 '04 '08

VCC VCC VCC VCC


14 13 12 11 10 9 8 14 13 12 11 10 9 8 14 13 12 11 10 9 8 14 13 12 11 10 9 8

1 2 3 4 5 6 7 1 2 3 4 5 6 7 1 2 3 4 5 6 7 1 2 3 4 5 6 7
GND GND GND GND
'10 '11 '20 '21

VCC VCC VCC VCC


14 13 12 11 10 9 8 14 13 12 11 10 9 8 14 13 12 11 10 9 8 14 13 12 11 10 9 8

1 2 3 4 5 6 7 1 2 3 4 5 6 7 1 2 3 4 5 6 7 1 2 3 4 5 6 7
GND GND GND GND
'27 '30 '32 '86

102
Logic gates
Fixed Function Logic
Logic symbols show the gates and associated pin numbers.
VCC
(14)
(1)
(3)
(2) (1) & (3)
(4) (2)
(6) (4)
(5) (6)
(5)
(9) (9)
(8) (8)
(10) (10)
(12) (12)
(11) (13) (11)
(13)

(7)
GND

103
Logic gates
Fixed Function Logic
Data sheets include limits and conditions set by the manufacturer as well as DC and
AC characteristics. For example, some maximum ratings for a 74LS00 are:

104
Logic gates
Programmable Logic
A Programmable Logic Device (PLD) can be programmed
to implement logic. There are various technologies
available for PLDs. Many use an internal array of AND
gates to form logic terms. Many PLDs can be programmed
multiple times. A A B B

SRAM SRAM SRAM SRAM


cell cell cell cell

SRAM SRAM SRAM SRAM


cell cell cell cell
X = AB

105
Logic gates
Programmable Logic

In general, the required logic for a PLD is developed with


the aid of a computer. The logic can be entered using a
Hardware Description Language (HDL) such as VHDL or
Verilog HDL. Logic can be specified to the HDL as a text
file, a schematic diagram, or a state diagram.

Example
A text entry for a programming a PLD in VHDL/Verilog
HDL as a 2-input NAND gate is shown for reference in the
following slide. In this case, the inputs and outputs are first
specified. Then the signals are described. Although you are
probably not familiar with VHDL, you can see that the
program is simple to read.

106
Summary
Programmable Logic

VHDL Verilog
entity NandGate is module NAND2gate(A, B, F);
port(A, B: in bit; input A;
input B;
LED: out bit);
output F;
end entity NandGate; reg F;
architecture GateBehavior of NandGate is
signal A, B: bit; always @ (A or B)
begin F <= ~(A & B);
begin
end
X <= A nand B;
LED <= X; endmodule
end architecture GateBehavior;

107
Selected Key Terms

Inverter A logic circuit that inverts or complements its


inputs.
Truth table A table showing the inputs and corresponding
output(s) of a logic circuit.
Timing A diagram of waveforms showing the proper time
diagram relationship of all of the waveforms.

Boolean The mathematics of logic circuits.


algebra
AND gate A logic gate that produces a HIGH output only
when all of its inputs are HIGH.
108
Selected Key Terms

OR gate A logic gate that produces a HIGH output when


one or more inputs are HIGH.
NAND gate A logic gate that produces a LOW output only
when all of its inputs are HIGH.
NOR gate A logic gate that produces a LOW output when one
or more inputs are HIGH.

Exclusive-OR A logic gate that produces a HIGH output only


gate when its two inputs are at opposite levels.
Exclusive-NOR A logic gate that produces a LOW output only
gate when its two inputs are at opposite levels.
109
1. The truth table for a 2-input AND gate is
Inputs Output Inputs Output
A B X A B X

a. 0 0 0 b. 0 0 1
0 1 1 0 1 0
1 0 1 1 0 0
1 1 0 1 1 0

Inputs Output Inputs Output


A B X A B X
0 0 0 0 0 0
c. 0 1 0 d. 0 1 1
1 0 0 1 0 1
1 1 1 1 1 1
110
© 2008 Pearson Education
2. The truth table for a 2-input NOR gate is
Inputs Output Inputs Output
A B X A B X

a. 0 0 0 b. 0 0 1
0 1 1 0 1 0
1 0 1 1 0 0
1 1 0 1 1 0

Inputs Output Inputs Output


A B X A B X
0 0 0 0 0 0
c. 0 1 0 d. 0 1 1
1 0 0 1 0 1
1 1 1 1 1 1
111
© 2008 Pearson Education
3. The truth table for a 2-input XOR gate is
Inputs Output Inputs Output
A B X A B X

a. 0 0 0 b. 0 0 1
0 1 1 0 1 0
1 0 1 1 0 0
1 1 0 1 1 0

Inputs Output Inputs Output


A B X A B X
0 0 0 0 0 0
c. 0 1 0 d. 0 1 1
1 0 0 1 0 1
1 1 1 1 1 1
112
© 2008 Pearson Education
A ≥1 X
4. The symbol B is for a(n)

a. OR gate
b. AND gate
c. NOR gate
d. XOR gate

113
© 2008 Pearson Education
A X
5. The symbol B is for a(n)

a. OR gate
b. AND gate
c. NOR gate
d. XOR gate

114
© 2008 Pearson Education
6. A logic gate that produces a HIGH output only when
all of its inputs are HIGH is a(n)
a. OR gate
b. AND gate
c. NOR gate
d. NAND gate

115
© 2008 Pearson Education
7. The expression X = A + B means
a. A OR B
b. A AND B
c. A XOR B
d. A XNOR B

116
© 2008 Pearson Education
8. A 2-input gate produces the output shown. (X represents
the output.) This is a(n)
a. OR gate
b. AND gate
c. NOR gate
d. NAND gate
A
B

X
117
© 2008 Pearson Education
9. A 2-input gate produces a HIGH output only when the
inputs agree. This type of gate is a(n)
a. OR gate
b. AND gate
c. NOR gate
d. XNOR gate

118
© 2008 Pearson Education
10. The required logic for a PLD can be specified in an
Hardware Description Language by
a. text entry
b. schematic entry
c. state diagrams
d. all of the above

119
© 2008 Pearson Education
Answers:
1. c 6. b
2. b 7. c
3. a 8. d
4. a 9. d
5. d 10. d

120
Capacitors "C" of 100nf to 300nf provide smoothing

121
122
123
124

You might also like