# Clock input of a D Flip Flop

I am a beginner at digital electronics and I am supposed to create a circuit on a breadboard using some kind of a flip-flop. I designed the circuit and decided to use a D- Flip flop since I only have two inputs. However I don't know what to connect to the CLK input part of the flip flop on the breadboard. Is there something that works a clock that I can simple connect or should I build a clock input? I saw some examples using a cyrstal, will that work as the CLK input.

The answer may be straightforward but thank you in advance for your consideration.

• I would go with a switch or a pushbutton... Nov 20, 2017 at 17:44
• I don't think that would solve my problem.. I want the clock input to store the previous status of the circuit – Nov 20, 2017 at 17:48
• @Ekin, it would store the status each time you push the button, and hold it until the next time you push the button. If that's not a solution to your problem, please edit your question to explain the problem more clearly. Nov 20, 2017 at 18:01
• You need to read CLOCK as edge. It does not need to be a "clock" as such, you just have to realize the outputs of a D-Type do not change to the D input value till there is an appropriate edge on that pin. Nov 20, 2017 at 19:09
• The 'clock' input to a D flip flop does not need to be (and often is not) a regularly timed clock signal. The clock input simply clocks the input to the output. Nov 20, 2017 at 19:26

You could use a tactile pushbutton. They're very cheap and useful if you want to "step" through a design, but you'll need to make sure to debounce them to see accurate behavior.

You could also use a TTL oscillator or crystal. These are simple packages that will create a clean signal, but they will be at a fixed frequency and most likely the smallest one you can get easily will be in the kHz range so this may be too fast to observe individual edge behavior.

You could create a 555 timer circuit using a potentiometer to vary the period of the output, and you could configure it to be monostable multivibrator if you want a single clock cycle. This is cheap, easy, and the parts are easily available.

I don't know what kinds of parts you have on hand but personally, the solution I'd use is connecting a small microcontroller like an Arduino of Teensy to it. This has the advantage of allowing you to quickly create custom behavior, like every time you press a button connected to one of its inputs it creates a pulse of a given width. Or, if you want to go from a 1Hz output to a 1kHz output, it's as simple as changing a variable in code rather than having to calculate (and possibly purchase) new resistor values. You could also use digital inputs on it to measure points in your circuit and store their state.

Without knowing much more about your application, it's hard to say which is the most fitting.

• Normally we are using VHDL and basys 3 as well as the circuit design on a breadboard however in this lab I was asked to create a finite state machine on a breadboard without any other supply. I designed the circuit that takes an input from a tactile push button but when I opened the manuel of the D flip flop I remembered the clock which I don't have experience about. I both have crystals and 555 timer. Which one should I use and should I only do a simple series connection Nov 20, 2017 at 17:57
• Again, this depends on how much "access" to your clock you need. Do you need to be able to "step" through the FSM, one clock cycle at a time? Or do you not care about individual clock cycles, and just want to observe the behavior of the FSM as a whole? Nov 20, 2017 at 18:01
• ı want to observe the overall behavior and just want to store the previous state and use it as a input for the next state Nov 20, 2017 at 18:12
• @EkinAlparslan, that requirement doesn't say anything about how you want to treat the clock. Nov 20, 2017 at 18:34
• have you studied how FSMs are implemented using D FFs? usually, the output is directly wired to the input through some combinational logic to produce the next state. the clock doesn't interact with it at all; the clock just tells the circuit how quickly to update the state. in a proper FSM, the clock shouldn't interact with the state logic. Nov 20, 2017 at 21:27