The T Flip Flop

The D Flip flop is a great little bit, but
there is a trap it can fall into. Sometimes we want the input of a flip flop
to depend on the output of that same flip flop. In other words, we want it
to change based on what it was before. For example, if we want something
that goes off if it was on, and on if it was off, we might just take the
output of a bit of memory and run it through an inverter, then connect it
back to the input. Then each time we hit the clock line, the opposite of
whatever the current output is, will go in and so it will switch back and
forth. Brilliant, no?

Well... No. Because the instant you clock the input to the output, that output
becomes the input and changes the output right back and over and over. It's
called a "race" condition, and it's a real problem in logic design.

There are two ways to get 'round it:
1) Delay the input so you can remove the clock signal before the changed
output has time to change the input or
2) use two flip flops: one to capture the new input when the clock
goes on, then stop taking input and pass the new setting on to the second
flip flop when the clock goes back.

The T-Flip Flop shown here is the second sort. It's made from two D-Flip
Flops which are represented here by a box with a "D" on it. But keep in mind,
inside the box are the same NAND gates we know and love.

There are a couple of
interesting things to notice about this new circuit. First, the way it clocks
the input though as the clocks go up and down. Just push the button and watch
it happen. Neat huh?

But what is really important about this circuit is that the output cycles
on and off at half the rate of the clock input. In this top part, each time
you press and release the button, the output changes state. It takes two
presses to return the output back to where it was. So the output frequency
is divided by two. That's neat, and useful, but it has another really cool
use.

Because computers work in binary, when one thing is going on and off half
as often as the next thing, it turns out it's counting. If you haven't seen
the binary page, check it out. Then press the "Clock
Enable" button in the lower left. The clock will feed pulses to the first
T Flip Flop, which drives the lowest bit of the binary to decimal display,
and feeds the second T Flip Flop. That produces the next highest binary digit.
And so on up the chain. It's counting... it's counting in binary.

See also:

http://www.youtube.com/watch?v=y1w6Nskbx8E Excellent video
from Jeri on different ways to make a "master-slave" flip flop and avoid
the race condition. She demonstrates an analog, time based solution that
uses fewer gates, but is sensitive to timing.+

After you find an appropriate page, you are invited to
your
to this massmind site! (posts will be visible only to you before review)
Just type in the box and press the Post button.
(HTML welcomed, but not the <A tag:
Instead, use the link box to link to another page.
A tutorial is availableMembers can
login
to post directly, become page editors, and be credited for their posts.

Link? Put it here:
if you want a response,
please enter your email address:
Attn spammers: All posts are reviewed before being made visible to anyone other than the poster.