please dont rip this site

Digital Logic Tutorial

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:

file: /Techref/logic/TFlipFlop.htm, 3KB, , updated: 2013/5/11 18:51, local time: 2018/6/21 15:07,

 ©2018 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?
Please DO link to this page! Digg it! / MAKE! / 

<A HREF=""> Digital Logic Tutorial, T Flip Flop</A>

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 available Members 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.
Did you find what you needed?

  PICList 2018 contributors:
o List host: MIT, Site host, Top posters @20180621 RussellMc, Van Horn, David, Isaac M. Bavaresco, Sean Breheny, Neil, David C Brown, Bob Blick, Denny Esterline, Brent Brown, James Cameron,
* Page Editors: James Newton, David Cary, and YOU!
* Roman Black of Black Robotics donates from sales of Linistep stepper controller kits.
* Ashley Roll of Digital Nemesis donates from sales of RCL-1 RS232 to TTL converters.
* Monthly Subscribers: Gregg Rew. on-going support is MOST appreciated!
* Contributors: Richard Seriani, Sr.

Welcome to!