JK Flip Flop Examples


>>Good day. This is Jim Pytel
[assumed spelling] from [inaudible]
Community College. This is Digital Electronics. This lecture is entitled
JK flip-flop examples. Okay, so what we’re going to do is do two quick JK
flip-flop examples and see if we’re tracking from what we
learned in the last lecture. And before we go into this here,
let’s do a super brief review about what JK flip-flop does. It’s got some inputs, J and K.
J, if you can think about it, it’s kind of like S. It’s
kind of like the set command. K is kind of like R. It’s kind
of like the reset command. When you try to set
something, Q should go to 1. If you try to reset
something, Q should go to zero. Okay? And if I am neither
setting nor resetting my device, my Q should just stay
whatever its prior state was. The JK flip-flop, the
major advantage of it, unlike the SR latch where, if
you try to simultaneously set and reset it, this thing goes
into what’s called toggle mode. What is toggle mode? Basically whatever Q was, it
switches to its opposite state. If it was a zero, goes to a 1. If it was a 1, it
goes to a zero. Additionally we discuss these
asynchronous inputs called preset and clear. And again they’re asynchronous. They do not have to happen
with respect to the clock. And if there is input that
is synchronous, i.e. respect to the clock, they
supercede that. Okay? And because there’s
a bar over them, preset. If there’s a zero on
preset, I will put a 1 in. If there’s a zero on the clear,
I will put zero on Q. Briefly to surmise what we’ve got going on here is this little
mini truth table. If J is zero and K is zero,
what mode is it in as it’s lying in wait for, in this
particular example, positive clock signal,
positive etch. And just think about that. It’s just lying in wait, waiting for that clock signals
positive etch to tell it, okay, go into this mode. That mode is zero, zero. I’m neither setting
nor resetting. You can think of it as a memory. What about zero, 1? Thinking of resetting;
1, zero setting it. And finally a 1, 1,
I’m in a toggle mode. And I can get myself set
up in those modes prior to that positive
etch clock arriving. As soon as it does arrive, I
go ahead and reset it, set it, or toggle it, or just
stay where I’m at. Let’s go ahead and do a
timing analysis of this. Okay, step zero, where are
those asynchronous inputs? What I’ve got here, is I’ve got
preset and clear right there. They’re active low. I’m seeing a zero right here. Regardless of what’s
on that thing, I know at that moment
Q is going to be zero. Go ahead and figure out when
this thing is triggered. Well, it’s triggered
on a positive edge. Go ahead, find your
positive edges. So there’s all my
positive edges. And what is that
positive edge looking at? Well, it’s looking at the
synchronous inputs J and K. So basically I’m going to
look at those inputs only on those positive edges so
I can kind of draw a line down where they intersect at J and K. That’s the
mode that I’m in. So go ahead and draw
those lines. Okay, so that’s where
I’m sampling those synchronous inputs. And if you want to, you can
really just go ahead and kind of just tell yourself right
now what modes I’m in. That first one, I’m neither
setting nor resetting. I can call that as
I’m in memory mode. I’ve got a J1, K zero. I’m in set mode, J1 K zero; set. So you can kind of give yourself that cheat sheet
all the way across. You don’t necessarily
have to do that, but that’s a great assistance to figuring these things
out; memory, reset, reset. What happens here? This is kind of a new thing. J is 1 and K is 1. I’m simultaneously
setting and resetting. Well, for a JK flip-flop,
that’s in this toggle mode. Okay? I’m in memory. What about this positive
edge right here? Do I care what that is? No, because check it out. I’ve got the active low clear. I know I’m in set
mode 1 zero now, but I’ve got the
active low clear. By the way, that previous
one was in memory state. I’m in memory state. But again, finally, out
last one, memory, memory. Go ahead. What does Q look like? Our Q initial condition, it looks like our
initial condition is zero. Go ahead and do your
best estimate as to what Q might look like. Should look something like this. And there you go. If it was a 1, that
memory state. Excuse me. If it was a zero, that
memory state’s going to keep it at zero. It was a zero. Set it. What happens when
you set something that’s already set? Stays set. It’s in memory. It’s resetting at that moment. The moment of the
positive edge, it resets. Not when it receives
a reset command, only at that positive edge. Okay, I’m resetting something
that’s already reset. Very interesting. Toggle. It was a zero. Now it goes to a 1. It’s remembering that 1 state. Finally receive that active
low clear, and all the rest of them are memory states. So this is a classic example of a timing diagram
with a JK flip-flop. How do you practice
these things? Go ahead and just do them
hundreds of different times, of many different
combinations of Js and Ks and presets and clears. Just how would this
thing behave if it was in negative edge
detaching device? Speaking of which let’s do
that for a second example. Here’s your second
example right here. Now Q is unknown. Go ahead and see if you
can figure this thing out. In this particular case,
attention to detail, negative edge detaching device. Where are the edges? Go ahead and draw those edges. What is J and K, at those edges? Before you’ve done all that, what are our asynchronous
inputs preset and clear? Go ahead and do your
best estimate, what you think this might be. And remember Q is
in an unknown state. What you should do
is get something for Q that looks like this. Okay, so Q should look
something like this. Let’s go ahead and talk
how we got this value. Okay, first off, Q was
in an unknown state. Or was it? Look at that. Active low clear. Before we even start using
this thing, we clear it out. It’s always a great
idea, just get rid of all the junk that’s in this. What is a JK flip-flop? One of its major
applications is a memory. Get rid of whatever’s in there. It’s cleared out, at which point
we start taking synchronous inputs because if you look
at the clear and preset, there are no other
times it’s active low. Where is this device
taking synchronous inputs? It’s taking them
in negative edge of the clock, and
the clock only. So where is that? [Inaudible]. There you go. It’s taking those synchronous
inputs on the negative edge. Now go ahead and just
use our description of the negative edge
detaching JK flip-flop. What happens at those negative
edges given those inputs J and K? Okay, there you go. It’s the first time that
negative edge occurs there. We’re going to set command. We’re going to set it again. We’re going to go into memory. Go into memory. We’re going to reset it. We’re going to reset it. Now here’s something
pretty neat. J and K are both high
for several times. It toggles, toggles, it
toggles, it toggles, it toggles. Just think about this. What if I always left
J and K in toggle mode? It would constantly bounce
back between zero and 1, zero and 1, zero and 1. Last one. It looks like
we’re in a set command. So what happens? Look at our timing diagram here. Where is zero? We stay it at zero until that
first positive edge happened. We set it. We stayed set. We memorized it, memorized it. We reset it. We reset something
that was already reset. We toggled. We switched, toggled,
toggled, toggled, toggled. Finally we set something
that was already set. So hopefully you understood
these JK flip-flop examples. Again you can’t buy this stuff. I mean you got to go
ahead and practice this. It’s very important
concept to understanding to understand how these
sequential devices behave given certain inputs. One quick thing here too, before
we move on to the next lecture, is does Q instantaneously
respond to those synchronous inputs? The answer is no. There is a bit of propagation
delay just like we talked about in those edge
detection devices. In edge detached device, we
were purposely delaying it. But realize that there might
be a slight delay for some of these things to
actually happen. There might be a delay here. So these are real world effects. These are not these idealized
versions anymore of devices. That’s actually the next
topic of our lecture, is flip-flop operating
characteristics where we take into account some of
those real world effects. And we’re [inaudible] to into
some of the other applications of sequential devices.

10 Comments

  • brilliant tutorial ! one of the best videos on JK flip flops

  • thank you!

  • Ever so slight error around 7min, you said positive edge, you meant negative. Regardless great tutorial and made it very easy to understand.

  • Great job, you are very clear and explain it very well. 
    What program do you use for the drawing board and recording ? 

  • what will be the output if preset and clear are low at same time?

  • great video

  • very useful thank you very much !

  • Great, instructive video 😉

  • very good. nice one. NiceMan

  • Super helpful! Thank you so much.

Leave a Comment

Your email address will not be published. Required fields are marked *