MEKATRONIKA
Meet 2 : Counter dan Shift Register
15 September 2015
Teknik Mesin
Unjani
HBH
Definisi
Counter aplikasi Flip flop sebagai penghitung maju/mundur.
Register merupakan penerapan flip flop sebagai penyimpan
memori (1 bit = 1 Flip flop)
15/09/2015
Case
15/09/2015
Registers
A flip-flop stores one bit of information
When you want to store n bits register
n flip-flops used
Clock is shared by all so action is synchronous with clock edge
Simple register
Shift register
Parallel access shift register
Lots of counters: up counter, down counter, BCD counter, ring counter,
Johnson counter
Q
Q
Q2
D
Q
Q
Q1
D
Q
Q
Q0
D
Q
Q
Parallel input
Clock
15/09/2015
Q2
Q1
Q0
Q
Q
Parallel input
Clock Load
In
Clock
Q
Q
Q1
Q
Q
Q2
Q
Q
Q3
Q4
Out
15/09/2015
In
1
Q1
0
Q2
0
Q3
0
Q4 = Out
0
t1
t2
t3
t4
t5
t6
t7
Parallel output
Q3
Q2
Q1
Q0
D Q
D Q
D Q
D Q
Serial
input Shift/Load
Parallel input
Clock
15/09/2015
S0
Function
memory
SHR
SHL
load
s1
s0
Q3
Q3
Q3
D Q
D Q
D Q
D Q
0 1 2 3
s1
s0
0 1 2 3
s1
s0
0 1 2 3
SRSI
s1
s0
0 1 2 3
SLSI
Parallel input
Clock
15/09/2015
74164 Shifter
8 bit serial in / parallel out shifter (used in modems)
Active low clear (CLRN)
Data-in provided by AND(A,B)
Positive edge triggered shift right register
74165 Shifter
8 bit parallel in / serial out shifter (also used in modems)
Active low asynchronous parallel load output is H
CLKIH is an active high clock inhibit memory state
Positive edge-triggered shift right register: SER is serial in
15/09/2015
Asynchronous Counters
Up counter using T flip-flops
Count clock pulses
1
Clock
Q
Q0
MSB of count
Q
Q1
Q2
15/09/2015
Clock
Q
Q0
Q
Q1
Q2
Clock
Q0
Q1
Q2
Count 0
1
Clock
Q
Q0
Q
Q
Q1
Q2
15/09/2015
Clock
Q
Q0
Q
Q
Q1
Q2
Clock
Q0
Q1
Q2
Count 0
Synchronous Counters
Asynchronous counters are slow due to propagation delays
Synchronous counters share the clock among all flip-flops
clock cycle
Q2
Q1
Q0
T0 = 1
T1 = Q0
T2 = Q1Q0
T3 = Q2Q1Q0
always toggle
toggle when Q0 = 1
toggle when Q1Q0 = 1
toggle when Q2Q1Q0 = 1
10
15/09/2015
Clock
Q0
Q1
Q2
Q3
Clock
Q0
Q1
Q2
Q3
Clock
Q0
Q1
Q2
Q3
Count
10
11
12 13
14 15
11
15/09/2015
Enable
Clock
Q
Q
Q
Q
Clear
Q2
Q1
Q0
D0 = 1 Q0
D1 = Q1 Q0
D2 = Q2 Q1Q0
D3 = Q3 Q2Q1Q0
always toggle
toggle when Q0 = 1
toggle when Q1Q0 = 1
toggle when Q2Q1Q0 = 1
12
15/09/2015
4 Bit Up Counter
Q0
D Q
Enable
Q1
D Q
Q
Q2
D Q
Q
Q3
D Q
Q
Output
carry
Clock
Enable
D0
D1
Load = 1 load
D2
Enable = 1 increment
Load = Enable = 0 memory
Load
Clock
0
1
DQ
Q
0
1
DQ
Q
0
1
DQ
Q0
Q1
Q2
0
1
DQ
Q
Q3
Output
carry
13
15/09/2015
Enable
D0
Q0
D1
Q1
D2
Q2
Load
Clock
Clock
14
15/09/2015
Clock
Q0
Q1
Q2
Clock
Q0
Q1
Q2
Count 0
Ring Counter
4 bit ring count: 1000 0100 0010 0001 1000
One-hot output that cycles in a ring
Johnson Counter
4 bit count: 0000 1000 1100 1110 1111 0111 0011 0001
0000
15
15/09/2015
Enable
D0
D1
D2
D3
Q0
Q1
Q2
Q3
BCD 0
Load
Clock
Clock
Clear
0
0
0
0
Enable
D0
D1
D2
D3
BCD 1
Load
Clock
16
15/09/2015
Q1
Qn 1
Start
Q
Q
Clock
asynchronous clear
Johnson Counter
n-bit counter that generates a sequence of length 2n
0000 1000 1100 1110 1111 0111 0011 0001
0000 .
Q0
Q
Q
Reset
Clock
Q1
Q
Q
Qn 1
Q
Q
17