Professional Documents
Culture Documents
• Analog?
• Digital?
Analog vs Digital
Analog
ECE 2008
1
Digital
• Advantages of digital
– Ease of design
– Ease of storage
– Programmable operation
- Data Processing
- Data Transmission
- Data Storage
ECE 2008
2
Audio CD
– The analog voltage is amplified and used to drive a speaker that produces the
original analog sound.
-> Periodic
-> Non-Periodic
Frequency (f) is the rate at which it repeat itself at a fixed interval. Is measured in cycles
per second or Hertz (Hz)
f = 1/T Hz
ECE 2008
3
Period (T) is the time from the edge of one pulse to the corresponding edge of the next
pulse. Is measured in second
T = 1/f s
Example :
Pulse Width
90% 90%
Amplitude
50% 50%
Pulse
10% Width 10%
Duty Cycle
Timing Diagram is a graph of digital waveform showing the actual time relationship of two or
more waveform and how each waveform changes in relation to the others.
ECE 2008
4
1.3 NUMBER SYSTEM, OPERATION AND CODES
Decimal Number
The decimal numbering system has a base of 10 with each position weighted by a factor
of 10
….105 104 103 102 101 100. 10-110-2 10-3 10-4 10-5…
Example :
47 = (4 x 101) + (7 x 100)
= 40 + 7
= 47
Binary Number
• The binary numbering system has a base of 2 with each position weighted by a factor of 2
increase increase
• Example :
101112 = (1 X 24 + 0 X 23 + 1 X 22 + 1 X 21 + 1 X 20 )
16 + 4 + 2 + 1 = 23 10
ECE 2008
5
Binary-to-Decimal Conversion
1 0 0 1 0 12
25 + 2 4 + 23 + 2 2 + 21 + 20 = 32 + 4 + 1 = 3710
Binary Count
Binary-to-Decimal Conversion
• Step 4: Sum the result from step 3, and binary is now decimal.
ECE 2008
6
Decimal-to-Binary Conversion
◼ Determine the set of binary weights whose sum is equal to the decimal
number
1) Sum-of-weight method
Binary weights
256 128 64 32 16 8 4 2 1
= 28 + 26 + 25 + 22 + 20
Binary weights
ECE 2008
7
Try this for 25 and 125
Repeated division-by-2
– Write the remainder after each division until a quotient of zero is obtained.
– The first remainder is the LSB and the last is the MSB
ECE 2008
8
Converting Decimal Fractions-to-Binary
• 2 ways to convert:
– 1) Sum-of-weight
– 2) Repeated multiplication of 2
Repeated multiplication by 2
• Conversion of decimal-binary
ECE 2008
9
Converting Decimal Fractions-to-Binary
Using Sum-of-weights
Binary weights
1011111.1011
Repeated division by 2 yields the whole number while repeated multiplication by 2 of the
fraction yields the binary fraction
• Most digital systems deal with groups of bits in even powers of 2 such as 8, 16, 32, and
64 bits.
• Base 16
– 16 possible symbols
ECE 2008
10
Hex-to-Decimal Conversion
• Convert from hex to decimal by multiplying each hex digit by its positional weight.
Example:
Decimal-to-Hex Conversion
• Convert from decimal to hex by using the repeated division method used for decimal to
binary and decimal to octal conversion.
• The first remainder is the LSB and the last is the MSB.
Example
Decimal 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
Hexadecimal 0 1 2 3 4 5 6 7 8 9 A B C D E F
Binary 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111
Decimal-to-Hex
650 Right/LSB
= 40.625 x 16 = 10 = A
16
40 2 8 A
= 2.5 x 16 = 8
16
2
= 0.125 x 16 = 2
16
Left/MSB
done!
65010 = 28A16
ECE 2008
11
Binary-to-Hex Conversion
• Convert from binary to hex by grouping bits in four starting with the LSB.
• Leading zeros can be added to the left of the MSB to fill out the last group.
• Example
= 3 A 6
= 3A616
Octal Number
– uses base 8
The Octal system is based on the binary system with a 3-bit boundary
85 84 83 82 81 80
ECE 2008
12
Gray Code
Only one bit changes from one code to the next in the sequence
0 +0 = 0
0 +1 =1
1 1 1 0
1 +0 = 1
+ + +
1 +1 = 0
1 0 1 1
=10112
Eg : 11102
1 + 1 + 1 + 0
1 0 0 1
ECE 2008
13
CHAPTER TWO
LOGIC GATES
The Inverter
– 0(LOW) ➔ 1(HIGH) ; 1 ➔ 0;
Symbols used:
A X
0 1
A X=A
1 0
X is the complement of A
A X is the inverse of A
X is NOT A
"A bar"
"not A"
– Symbols used:
&
A A
X X
B B
ECE 2008
14
AND gate operation:
0.0=0
0.1=0
1.0=0
1.1=1
The OR Gate
ECE 2008
15
Symbols used:
0+0=0
0+1=1
1+0=1
1+1=1
ECE 2008
16
The NAND Gate
– If all or any of the input are LOW, then the output is HIGH.
Symbol used:
Logic expressions for NAND gate: Boolean expression for NAND is a combination of AND and
Inverter Boolean expressions.
ECE 2008
17
The NOR Gate
– If all or any of the input are HIGH, then the output is LOW.
• Symbol used:
A A 1
X A
X X
B B B
ECE 2008
18
Logic expressions for NOR gate:
• Combines basic logic circuits of AND, OR and Inverter. Has only 2 inputs
– If both of the input are at the same logic level, then the output is LOW.
– If both of the input are at opposite logic levels, then the output is HIGH
Symbol used:
ECE 2008
19
The XOR gate operation:
– If both of the input are at the same logic level, then the output is HIGH.
– If both of the input are at opposite logic levels, then the output is LOW.
• Symbol used:
ECE 2008
20
ECE 2008
21
CHAPTER THREE
BOOLEAN ALGEBRA AND LOGIC SIMPLIFICATION
Basic laws of BA
Commutative Laws
◼ Associative Laws
Distributive Laws
ECE 2008
22
Simplification of Boolean Expressions
ECE 2008
23
DeMorgan’s Theorems
– NAND ≡ negative-OR
– NOR ≡ negative-AND
X X
XY X+Y
Y Y
NAND Negative-OR
X X
X+Y XY
Y Y
NOR Negative-AND
DM theorem 1:
DM theorem 2:
ECE 2008
24
Standard Form of Boolean Expressions
ECE 2008
25
• Standardization makes the evaluation, simplification, and implementation of Boolean
expressions more systematic and easier
In SOP a single overbar cannot extend over more than 1 variable, but more than 1 variable can
have an overbar.
• A logic expression can be changed to SOP form using Boolean algebra techniques.
– Standard SOP form = where all the variables in the domain appear in each product
term in the expression.
ECE 2008
26
– Multiply each of the nonstandard term with the missing term using Boolean
algebra rule 6 ( ).
• Domain = A, B, C, D.
• What is missing?
– Term 1: missing D or D’
Now we have
ECE 2008
27
POS = when 2 or more sum terms are multiplied.
(A + B)S1 (A + B + C)S2
a single overbar cannot extend over more than 1 variable, but more than 1
variable can have an overbar.
• Standard POS form = where all the variables in the domain appear in each sum term in
the expression.
– Multiply each of the nonstandard term with the missing term using Boolean
algebra rule 8:
ECE 2008
28
• Domain = A, B, C, D.
• What is missing?
– Term 1: missing D or D’
– Term 2: missing A or A’
Term 1 : A + B + C = A + B + C + D D = ( A + B + C + D)( A + B + C + D)
Term 2 : B + C + D = B + C + D + A A
= ( A + B + C + D)( A + B + C + D)
Now we have
( A + B + C )( B + C + D )( A + B + C + D )
= ( A + B + C + D )( A + B + C + D )( A + B + C + D )( A + B + C + D )( A + B + C + D )
• Binary values in a standard SOP expression are not present in the equivalent standard
POS expression
ECE 2008
29
• Step 1: Evaluate each product term in the SOP expression ➔ i.e. determine the binary
numbers of the product terms.
• Step 3: Write equivalent sum term for each binary number from Step 2 and express in
POS form.
The SOP have 5 of 8, so POS have the other 3 (001, 100, 110) ➔ These 3 make sum term = 0
• Step 3: find the binary values that make the product = 1 (SOP) or sum = 0 (POS)
– Equal to 0 (SOP)
– Equal to 1 (POS)
• Domain = A, B, C. combinations = 2 3 = 8
ECE 2008
30
Karnaugh Map (K-Map)
• K-Map is similar to the truth table, but it presents all of the possible values of input and
output.
• The number of cells in a K-Map = total number of possible input variable combinations
➔ 3 = 23 = 8
• In a K-map with 4-variable or more, the top-most & bottom-most cells of a column (and
row) are adjacent.
ECE 2008
31
• K-Map is used to simplify Boolean expressions to their minimum form.
• A minimized SOP expression has the fewest possible term with each term having fewest
possible variables.
• A minimized SOP expression needs fewer logic gates than standard expression.
Step 2: Place a 1 in a cell that have the same value as the product term
ECE 2008
32
• For expressions that are not standard, it must be converted to a standard form.
• Recall: AB + ABC
1. Grouping the 1s
Grouping the 1s
Each cell must be adjacent to at least 1 other cell in the group, but all cells in a group
need not be adjacent
The 1s already in a group may be included in another group so long as the overlapping
group includes non-common 1s
ECE 2008
33
ECE 2008
34
CHAPTER FOUR
COMBINATIONAL LOGIC
Basic Combinational Logic Circuits
• AND-OR Logic
• AND-OR-Invert Logic
• Exclusive-OR Logic
• Exclusive-NOR Logic
AND-OR Logic
• If any of the AND gates output are HIGH, the output in the OR gate is HIGH
If all of the AND gates outputs are LOW, the output in the OR gate is LOW
AND-OR-Invert Logic
ECE 2008
35
Exclusive-OR Logic
• Output expression
ECE 2008
36
Boolean Expression to Logic Circuit
X = AB + CDE
1. AB
2. CDE
– 1 2-input AND-gate ➔ AB
How-to
ECE 2008
37
• Step 2b: Repeat until you get the smallest possible chunk.
• If we have a truth table instead of an expression, logic circuit can still be implemented.
• Step 1:
ECE 2008
38
• Step 2:
• Step 3:
• How to do this?
Boolean algebra
Example
ECE 2008
39
Step 2
Output Expression of the circuit is X = (ABC)C + ABC + D
Step 3
X = (A + B + C)C + A + B + C + D DeMorgan's theorem
= AC + BC + CC + A + B + C + D
= AC + BC + C + A + B + C + D CC = C ; C + C = C
= C(A + B + 1) + A + B + D => (A + AC) + (B + BC) + C + D
X=A+B+C+D => A + B + C + D
Simplified circuit :
A
B X
C
D
ECE 2008
40
ECE 2008
41
CHAPTER FIVE
LATCHES and FLIP FLOPS
Latches
A latch is a type of temporary storage device that has two stable states (bistable) a is
normally placed in a category separate from that of flip-flops.
The difference between latch and flip-flop is in the method used for changing their state.
S – set; R-reset
Type of Latch :
A) S-R Latch
C) Gated D Latch
Truth-Tables :
For Active-HIGH and Active-LOW input SR-Latch
ECE 2008
42
▪ The Q and not-Q outputs are supposed to be in opposite states.
▪ Q=1 and not-Q=0 is defined as set (by making S=1 and R=0)
▪ Q=0 and not-Q=1 is conversely defined as reset (by making S=0 and R=1)
▪ When S and R are both equal to 0, the multivibrator's outputs “not change" in
▪ If Q and not-Q happen to be forced to the same state (both 0 or both 1), that
• The S and R inputs control the state to which the latch will go when a HIGH level is
applied to the EN input.
• The latch will not change until EN is HIGH, but as long as it remains HIGH, the output is
controlled by the state of the S and R input.
• The invalid state occurs when both S and R are simultaneously HIGH.
ECE 2008
43
C) Gated D Latch
Edge-Triggered Flip-Flops
• Flip-flops are synchronous bi-stable storage devices capable of storing one bit.
• In this case synchronous means that the output state only changes at a specified point on a
triggering input called the clock (C).
That is, the output changes are synchronized with the clock signal.
• The main difference between latches and flip-flops is the method used to change their
states.
• Latches are level sensitive, or level-triggered. This means that the outputs are dependent
on the voltage level applied, not on any signal transition.
• Flip-flops are edge-triggered, that is that they depend on the transition of a signal.
ECE 2008
44
Difference between latch and flip-flop
ECE 2008
45
ii) Edge-Triggered D Flip Flop
ECE 2008
46
Example : Determine Q for the D input
v) The difference between J-K and S-R is a J-K has no invalid state as SR.
Truth table
ECE 2008
47
Asynchronous : Presets (PRE) and Clear (CLR) inputs
– Normally labeled
Logic diagram for a basic J-K flip-flop with active-LOW preset and clear inputs.
ECE 2008
48
2 sections :
ECE 2008
49
ECE 2008
50
CHAPTER SIX
COUNTERS
ASYNCHRONOUS COUNTER (AC)
⚫ An AC is one in which the Flip-Flops (FF) within the counter do not change states at
exactly the same time because they do not have a common clock pulse.
ECE 2008
51
b) 3-Bit Asynchronous Counter
ECE 2008
52
SYNCHRONOUS COUNTER (SC)
⚫ A SC is one in which all the Flip-Flops (FF) in the counter clocked at the same time by a
common clock pulse.
ECE 2008
53
DESIGN OF SYNCHRONOUS COUNTER
ECE 2008
54
Step 2 : Create Next State Table
ECE 2008
55
Step 5 and Step 6 :
Logic Expressions and Counter Implementation
ECE 2008
56
CHAPTER SEVEN
SHIFT REGISTERS
Basic shift register functions
– a) Data storage
– b) Data transfer/movement
ECE 2008
57
Serial In/Serial Out (SISO)
Figure 9.7 : Logic symbol for an 8-bit serial in/serial out shift register
Example 1
Figure .Four bits (1010) being entered serially into the register.
ECE 2008
58
Example 2
• Output is parallel
Example SIPO :
ECE 2008
59
Parallel In/Serial Out (PISO)
• SHIFT/LOAD
ECE 2008
60
Parallel In/Parallel Out (PIPO)
• A shift register with serial output connected back to the serial input to produce special
sequences.
– Johnson counter
– Ring counter
• In the Johnson counter the last complemented output is fed back in as an input to the first
FF
• Examples shown with D FF, but can be implemented with other types of FF as well.
ECE 2008
61
4-bit Johnson Counter
• For a 10-bit ring counter, there is a unique output for each decimal digit
• **The ‘1’ is always retained and goes ‘round the ring’ at each clock pulse
ECE 2008
62
Shift register applications
• Time delay
• Serial-to-parallel converter
ECE 2008
63
ECE 2008
64