Professional Documents
Culture Documents
Ky Thuat So
Ky Thuat So
+5 +5
1 0 1
V V
Time Time
–5 –5
Digital: Analog:
only assumes discrete values values vary over a broad range
continuously
• In binary, a single number is called a bit (for binary digit).A bit can have the
value of either a 0 or a 1, depending on if the voltage is HIGH or LOW.
VH(max)
HIGH
VH(min)
Invalid
VL(max)
LOW
VL(min)
Binary base 2
Surplus
Surplus
Surplus
Hexadecimal to Binary
Transform
-1 -1 -1
0 - 0 = 0
0 - 1 = 1 möôïn 1 1 1 0 1 0
1 - 0 = 1 1 1 1
1 - 1 = 0 1 0 0 1 1
Robotic & Vision Lab RoVis
13
c. Multiply: 1 0 1 1
1 0 0 1
1 0 1 1
0 0 0 0
0 0 0 0
1 0 1 1
1 1 0 0 0 1 1
d. Divide:
1 0 0 1 0 0 0 1 1 0 1 1
1 0 1 1
1 1 0 1
1 1 1 0
1 0 1 1
1 1 0 1
1 0 1 1
1 0
Robotic & Vision Lab RoVis
Sign Value
- The left-most bit in a signed binary number is the sign bit,
which tells you whether the number is positive or negative.
- A 0 sign bit indicates a positive number, and a 1 sign bit
indicates a negative number.
+ 13 : 01101
- 13 : 11101
+ 25 : 0 0011001
- 25 : 1 0011001
• 1110 = 00001011
• -1110 = 11110100
• 1110 = 00001011
• -1110 = 11110100 one’s comp
• -1110 = 11110101 two’s comp
-7 : 1001 11001
-
+5 : 0101 00101
+ 4 : 0 1 0 0 (Kq sai) 1 0 1 0 0 : - 12 (Kq ñuùng)
Retro
LED Watch
(Circa 1970s)
f g b
e c
f g b
e c
n n
A: 2 rows, since there are 2 possible binary
patterns/combinations for the n variables
Boolean Algebra
• Canonical Sum-Of-Products:
The minterms included are those mj such that F( ) = 1
in row j of the truth table for F( ).
• Canonical Product-Of-Sums:
The maxterms included are those Mj such that F( ) = 0
in row j of the truth table for F( ).
Boolean Algebra
x y z minterm Maxterm
0 0 0 m0 = x y z M0 = x + y + z
0 0 1 m1 = x y z M1 = x + y + z
0 1 0 m2 = x y z M2 = x + y + z
0 1 1 m3 = x y z M3 = x + y + z
1 0 0 m4 = x y z M4 = x + y + z
1 0 1 m5 = x y z M5 = x + y + z
1 1 0 m6 = x y z M6 = x + y + z
1 1 1 m7 = x y z M7 = x + y + z
x y z F F(x, y, z) = x y z + x y z + x y z + x y z + x y z
0 0 0 0 = m1 + m2 + m5 + m6 + m7
0 0 1 1
0 1 0 1
= m(1, 2, 5, 6, 7)
0 1 1 0 = (1, 2, 5, 6, 7)
1 0 0 0
1 0 1 1 F(x, y, z) = (x + y + z) (x + y + z) (x + y + z)
1 1 0 1 = M0 . M3 . M4
1 1 1 1
= M(0, 3, 4) = (0, 3, 4)
b. Daïng chính taéc 2:
x y z F
0 0 0 X F (x, y, z) = (1, 2, 5, 6) + d (0, 7)
0 0 1 1
0 1 0 1 = (3, 4) . D (0, 7)
0 1 1 0
1 0 0 0
1 0 1 1
1 1 0 1
1 1 1 X
Logic Function A X
B
X = A + BC B
C BC
1 1 1 0 1 2 3 4 5 6 7
0 0 0
0 1 0 1 0 1
3/8 DEC.
Y0
Y1
A0
Y2
A1 Y3
Y4
A2
Y5
Y6
Y7
B 1 0 B’C A F
1
2
C 0 3 BC
F=C(AB+A’B’)
A’B’
A 1 0
1 F
2
B 0 3 AB
EN
• Outputs signals:
Name Description
Left Power control for the left rear light
Right Power control for the right rear light
LT BR EM BL Left
0 0 0 0 0
0 0 0 1 0 K-map:
0 0 1 0 0 Left EM
0 0 1 1 1
0 1 0 0 1 0 0 1 0
0 1 0 1 1
1 1 1 1
0 1 1 0 1 BR
0 1 1 1 1 0 1 1 0
1 0 0 0 0 LT
1 0 0 1 1
0 1 1 0
1 0 1 0 0 BL
1 0 1 1 1
1 1 0 0 0 Left= LT.BL + LT’.BR + EM.BL
1 1 0 1 1 Same for Right:
1 1 1 0 0 Right= RT.BL + RT’.BR + EM.BL
1 1 1 1 1
Robotic & Vision Lab RoVis
Example (cont): Encoder with NOR
Left’= m(0,1,2,8,10,12,14)
0
1
2
Left
3
LT 4
3 5
BR 2 6
EM 7
1 8
BL 0 9
10
11
12
13
14
15
3-variable Karnaugh
F AB F AB
C 00 01 11 10 C 00 01 11 10
0 X 1 1 0 X 0
1 X 1 1 X 0 0
5-variable Karnaugh 10
F BCA 0 1
DE
00 01 11 10 10 11 01 00
00
01
11
10
Robotic & Vision Lab RoVis
Example
2-variable Karnaugh maps are trivial but can be used to introduce
the methods you need to learn. The map for a 2-input OR gate
looks like this:
A
0 1
B
A
Y 0 1
B
A
1 1 1
A B Y
0 0 0
B
0 1 1
1 0 1
A+B
1 1 1
group of 4 terms
F AB F AB
C 00 01 11 10 C 00 01 11 10
0 1 1 0 0
1 1 0
BC A +B
B C
D B
Eight-connection (8 nearby blocks are 1 or 0):
- we will have the multiply function that omits 3 variables. The
omitted variables are the variable that have different number
- Or we will have the sum function that omits 3 variables. The
omitted variables are the variable that have different number
Robotic & Vision Lab RoVis
Two nearby blocks
F F
AB AB
00 01 11 10 00 01 11 10
CD CD
00 1 1 00 0
01 01
11 11
10 10 0
F F
AB AB
00 01 11 10 00 01 11 10
CD CD
00 00
01 01
11 11 0
10 1 1 10
0
01 CD 01 1 1
11 11 1 1
AD
10 10
F F
AB AB
00 01 11 10 00 01 11 10
CD CD
00 1 1 AD 00
01 01 1 1
BD
11 11 1 1
10 1 1 10
01 01 0 0
11
A D 11 0 0
10 10
F F
AB AB
00 01 11 10 00 01 11 10
CD CD
00 0 0 A D 00
01 01 0 0
B D 0
11 11 0
10 0 0 10
11 B D 11
10 0 0 10
11
BD 11
10 1 1 10
10 10 0 0
F F
AB AB
00 01 11 10 00 01 11 10
CD CD
00 1 1 1 1 00
01 01 0 0 0 0
D D
11 11 0 0 0 0
10 1 1 1 1 10
F(A, B, C) = (0, 1, 3, 5, 6) = A B + A C + B C + A B C
F AB
C 00 01 11 10 ABC
0 1 1
AB 1 1 1 1
BC
AC
F AB
00 01 11 10
CD
00 1 1
01 1
11 1 1
10 1 1
F ( A, B, C , D ) A B C D A B BC
Robotic & Vision Lab RoVis
F(A, B, C, D) (0,1,4,5,6,7,14,15)
F
AB
00 01 11 10
CD
00 1 1
01 1 1
Redundant
11 1 1
connection
10 1 1
F(A, B, C, D) A C BC
Robotic & Vision Lab RoVis
Example
AC
A B C Y
0 0 0 1 AB
C 00 01 11 10
0 0 1 1
0 1 0 0 0 1 1 1
0 1 1 0
1 0 0 1 1 1 1
1 0 1 1
1 1 0 1
1 1 1 0 B
B AC
Robotic & Vision Lab RoVis
Robotic & Vision Lab RoVis
Exercise
Given the truth table, find the simplified SOP and POS form.
A B C Y
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
AB
CD 00 01 11 10
X
00
01
X 1
11 X X
10 X X
AD
Robotic & Vision Lab RoVis
F(A, B, C, D) = (0, 4, 8, 10) + d (2, 12, 15)
= BD +CD
F AB
CD 00 01 11 10
00 1 1 X 1 CD
01
11 X
10 X 1
BD
F AB
CD 00 01 11 10
00 0 0 X X D
01 X X
11 0 X
(B + C)
10 0 0 0 0
0 1 0 1 0 1 0 1
1 1 0 1 1 1 0 1
0 0 x x 0 0 x x
1 1 x x 1 1 x x
2/1 MUX S I1 I0 Y
I0
I0 0 0 0 0
Y I1I0
I1 0 0 1 1 S 00 01 11 10 1/2 Dec.
S 0 1 0 0 0 0 1 1 0 S Y
Logic Symbol 0 1 1 1 1 0 0 1 1
1 0 0 0
S Y 1 0 1 0 I1
Y = S I0 + S I1
0 I0 1 1 0 1
1 I1 1 1 1 1
Logic Expression Logic Circuit
Logic Function Truth Table
1 14
00
Vcc = +5V 1
3
2
2 13
3 12 4
6
5
4 11
9
5 10 8
10
6 9
12
7 8 11
Gnd 13
7400
Design the control circuit using three variables: PWM, Direction, Brake
a) Logic Algebra
b) K-Map
Robotic & Vision Lab RoVis
Design the control circuit for a gaming using 4 inputs
Circuit works only reset switch is 1. When reset switch is 0 all led will be OFF
One led is ON if input to resistor is 1.
Just One led is ON when all player push button.
VCC
VCC R1
R2 R3
Play er1
R1
Q1 D1
Play er2
R1
Q2 D2
Play er3
R1 D3
Q3
Reset
1 2
Input(s) Output(s)
circuit
memory
bed1
R Q light
RS
Latch
1 S
bed1
button bed2
R Q light
bed2 RS
button Latch
1 S warning
bell
1 master
reset
• Sequential counter have 1 clock (CK) input and many outputs. The
Output are the Flipflop output
Synchronous (Bộ đếm song song) : the input pulse (CK) of all FF are connected to
each other. When pulse occurs all status of FF will change
Using to design an arbitrary counter loop (counter do not have order)
• Count Up
Q0(LSB) Q1 Q2(MSB)
1 T Q 1 T Q 1 T Q
CK CK Q CK Q CK Q
CK
Q0
(LSB)
Q1
Q2
(MSB)
Robotic & Vision Lab RoVis
Count Down
Q0(LSB) Q1 Q2(MSB)
1 J Q 1 J Q 1 J Q
CK CK CK CK
1 K Q 1 K Q 1 K Q
CK
Q0
(LSB)
Q1
Q2
(MSB)
Robotic & Vision Lab RoVis
Count Up
EX: Using T-FF pulse down edge and one preset input, to design
the counter up m = 5, and initial value is 0.
Q2 Q1 Q0 Z Z is the reset signal
0 0 0 0 Z Q2Q1
0 0 1 0 Q0 00 01 11 10
0 1 0 0
0 1 1 0
0 X
1 0 0 0 1 X 1
1 0 1 1
1 1 0 X Z = Q 2 Q0
1 1 1 X
0 0 0
1 T Pr Q 1 T Pr Q 1 T Pr Q
CK Ck Q Ck Q Ck Q
Cl Cl Cl
CK
Q0
(LSB)
Q1
Q2
(MSB)
Robotic & Vision Lab RoVis
EX: Using JK-FF Pulse down edge and one Q2 Q1 Q0
Preset, Clear active low; to design counter 0 1 0
0 0 1
down m = 5 and initial value is 2. 0 0 0
1 1 1
Z is reset signal: Z = Q2 Q1 (tích cöïc thaáp) 1 1 0
1 0 1
Q0(LSB) Q1 Q2(MSB)
1 1
Pr Pr Pr
1 J Q 1 J Q 1 J Q
CK CK CK
CK
1 K Q 1 K Q 1 K Q
Cl Cl Cl
1
Redraw the Wave form of this example
Robotic & Vision Lab RoVis
Boä ñeám song song (Synchronous Counter): :
The input pulse (CK) of all FF are connected to each other. When
pulse occurs all status of FF will change
Do not need to consider the activated condition of Pulse (up or
down). Consider the current status and next status
Design a arbitrary counter loop
* SR-FF * JK-FF
* D-FF:
Q Q+ S R J K
D = Q+
0 0 0 X 0 X
* T-FF: 0 1 1 0 1 X
1 0 0 1 X 1
T = Q Q+ 1 1 X 0 X 0
1 … 1 1
Find the value of FF that will change the current to next value based
on FF table
T2 Q2Q1
Current Next FF Q0 00 01 11 10
Q2 Q1 Q0 Q + 2 Q+ 1 Q+ 0 T2 T1 T0 0 1 1 1 1
0 0 0 1 1 1 1 1 1
0 0 1 0 0 0 0 0 1 1
0 1 0 1 0 1 1 1 1
0 1 1 0 1 0 0 0 1 T1 Q2Q1
1 0 0 0 1 1 1 1 1 Q0 00 01 11 10
1 0 1 1 1 0 0 1 1 0 1 1 1 1
1 1 0 0 0 1 1 1 1
1 1 1 1 0 0 0 1 1 1 1 1
T2 = Q0 T1 = Q0 + Q2 T0 = 1
Robotic & Vision Lab RoVis
T2 = Q0 T 1 = Q0 + Q 2 T0 = 1
Q2(MSB) Q1 Q0(LSB)
T2 Q T1 Q 1 T0 Q
2 1 0
2 1 0
There are two method to solve the undesired value in the loop
Method 1: undesired value will be assign a value. Needing to start the
initial value for the counter. The initial value is one of the desired
value
Current Next
EX: Design counter D-FF active up
Q2 Q 1 Q0 Q+ 2 Q + 1 Q+ 0
edge, Pr and Cl active up edge
0 0 0 1 0 0
Q 2Q 1Q 0 0 0 1 X X X
0 1 0 1 1 0
000
0 1 1 0 1 0
1 0 0 0 1 1
110 100 1 0 1 X X X
1 1 0 0 0 0
1 1 1 X X X
010 011 D2 D1 D0
Robotic & Vision Lab RoVis
D2 = Q 2 Q0 D1 = Q 2 Q1 D0 = Q 2 Q1
Q2(MSB) Q1 Q0(LSB)
0 0
D2 Pr Q D1 Pr Q D0 Pr Q
2 1 0
RS
Robotic & Vision Lab RoVis
Method 2: assign an undesired value one value in the loop
Q 2Q 1Q 0
001 000
Current Next FF
Q2 Q1 Q0 Q + 2 Q+ 1 Q+ 0 T2 T1 T0 T 2 = Q0 + Q 2 Q 1
0 0 0 1 0 0 1 0 0
0 0 1 1 1 0 1 1 1
0 1 0 1 1 0 1 0 0 T1 = Q2 (Q1 Q0)
0 1 1 0 1 0 0 0 1
1 0 0 0 1 1 1 1 1
1 0 1 1 0 0 0 0 1 T 0 = Q0 + Q 2 Q 1
1 1 0 0 0 0 1 1 0
1 1 1 1 0 0 0 1 1
Robotic & Vision Lab RoVis
Current FF input Next value
this type of Shift Register also acts as a temporary storage device or as a time
delay device for the data, with the amount of time delay being controlled by
the number of stages in the register, 4, 8, 16 etc or by varying the application
of the clock pulses. Commonly available IC’s include the 74HC595 8-bit
Serial-in to Serial-out Shift Register all with 3-state outputs.
As this type of shift register converts parallel data, such as an 8-bit data
word into serial format, it can be used to multiplex many different input
lines into a single serial DATA stream which can be sent directly to a
computer or transmitted over a communications line. Commonly
available IC’s include the 74HC166 8-bit Parallel-in/Serial-out Shift
Registers.
Robotic & Vision Lab RoVis
Parallel-in to Parallel-out (PIPO) Shift Register
• Functional simulation
• Test the circuit to determine if it correctly performs all the
functions that are required
• Timing simulation
• Test the circuit to determine if it meets the timing requirements
• Correct functionality does not necessarily lead to fast speed