You are on page 1of 4

Gray Code Counter Using JK Flip Flops

Jerome K. Butler
SMU Electrical Engineering

October 17, 2009

1 Problem
Design a circuit to implement a Gray code counter using JK flip flops. As-
sume only a 3-bit counter.

2 3-Bit Gray Code


The Gray code for a 3-bit counter can be determined from that for the 2-bit
counter. The 2-bit counter is

0 0
0 1
1 1
1 0

Extend 2-bit code to 3-bit code

0 0 0
0 0 1
0 1 1
0 1 0
1 1 0
1 1 1
1 0 1
1 0 0

3 Setting the Sequence


The 3-bit Gray code sequence is now written as in the following sequence.
The variables are a (MSB), b, and c (LSB).

1
State a b c a+ b+ c+ State a b c a+ b+ c+
S0 0 0 0 0 0 1 S4 1 0 0 0 0 0
S1 0 0 1 0 1 1 S5 1 0 1 1 0 0
S2 0 1 0 1 0 0 S6 1 1 0 1 1 1
S3 0 1 1 0 1 0 S7 1 1 1 1 0 1

4 JK Flip-Flop States
The JK flip-flop states are illustrated in the figure below. For example, to
change from S0 (Q = 0) to S1 (Q = 1), may be either J = 1, K = 0, or J = 1, K
= 1. In short, J = 1, K = d. Three flip flops will be used in the circuit where
Q0 represents the LSB and Q2 is the MSB.

1d

J Q
0d d0
S0 S1
K Q

d1

The following truth table specifies the inputs to the three JK flip flops.

State Q2 Q1 Q0 Q2+ Q1+ Q0+ J0 K0 J1 K1 J2 K2


S0 0 0 0 0 0 1 1 d 0 d 0 d
S1 0 0 1 0 1 1 d 0 1 d 0 d
S2 0 1 0 1 1 0 0 d d 0 1 d
S3 0 1 1 0 1 0 d 1 d 0 0 d
S4 1 0 0 0 0 0 0 d 0 d d 1
S5 1 0 1 0 0 0 d 1 0 d d 0
S6 1 1 0 1 1 1 1 d d 0 d 0
S7 1 1 1 1 0 1 d 0 d 1 d 0

2
The Karnaugh maps and Boolean results:
Q2 Q2
J0 K0
Q0 Q0

1 d d 0 d 0 1 d
0 1 5 4 0 1 5 4

Q1 0 d d 1 Q1 d 1 0 d
2 3 7 6 2 3 7 6

The resulting Boolean equations are

J0 = Q1 Q2 + Q1 Q2
K0 = Q1 Q2 + Q1 Q2

Q2 Q2
J1 K1
Q0 Q0

0 1 0 0 d d d d
0 1 5 4 0 1 5 4

Q1 d d d d Q1 0 0 1 0
2 3 7 6 2 3 7 6

The resulting Boolean equations are

J1 = Q0 Q2
K1 = Q0 Q2

Q2 Q2
J2 K2
Q0 Q0

0 0 d d d d 0 1
0 1 5 4 0 1 5 4

Q1 1 0 d d Q1 d d 0 0
2 3 7 6 2 3 7 6

The resulting Boolean equations are

J2 = Q0 Q1
K2 = Q0 Q1

3
5 Digital Works Output
The following figure shows the circuit derived from the Boolean expressions
as well as the output from the ciruit.

You might also like