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.
|file: /Techref/logic/TFlipFlop.htm, 3KB, , updated: 2013/5/11 18:51, local time: 2019/7/19 21:07,
|©2019 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions?|
<A HREF="http://techref.massmind.org/techref/logic/TFlipFlop.htm"> Digital Logic Tutorial, T Flip Flop</A>
|Did you find what you needed?|
Welcome to massmind.org!
Welcome to techref.massmind.org!