Let us Try to understand the Flip-Flop Circuit from the basics. During my college days (30 years back), it took me long time to understand the Flip-flop. This the Most important component in Digital Electronics. Every Electronics Engineer must thoroughly understand this. That is the reason I am explaining this step by step. If anyone finds it difficult to follow or feels that some thing can be changed, write a comment. I will modify this. Advance Thanks.

The basics of Flip-Flop is Gates. We are constructing Flip-Flop using AND gate and NOT Gate.

Step – 1

If input A is 0 output Y is 1

If input A is 1 output Y is x – x means don't care may be 0 or 1

Step – 2

If input B is 0 output Y is 1

If input B is 1 output Y is x – x means don't care may be 0 or 1

Step – 3

Now let us connect the above TWO circuits together as shown below.

Step – 4

When input A and B are given 1 and 0, the output Y is 0. You can follow the steps in the below diagram step by step.

Now let us change the input B only. Change the input B from 0 to 1.

Step – 5

Now let us change the input A only. Change the input A from 1 to 0

Step – 6

Step – 7

Now let us change the input A only. Change the input A from 0 to 1

If you notice Step 5 and Step 7, the input in is 1 1 but the out differs. This is the specialty of this circuit. You can not predict the output for the input condition 11. When the input condition is 11 the output is determined by the previous state. Since this follows the Sequence, this circuit is called Sequential Logic. To differentiate Sequential logic from Combinational logic, the name of the labels are changed

A -> R

B -> S

Y -> Q

Let us see the sequence once again.

Now let us convert this as a block diagram. In this circuit once Q is set to 1 or 0, it retains the value. That is the reason this devices is called "RS Latch"

Now Let us see the Truth Table.

The above table can be written as shown below. In this table Qn is current state and Qn-1 is previous state.

In the RS Latch when R & S Changes, the output Changes. Now let us introduce a Control Input. The purpose of the Control Input to have master control. When control input is 0 , even R & S are changing the output does not change. When Control Input is 1, when R & S changes the output Changes.

Here is the diagram with Control Input. This circuit is built using RS Latch.

Now let us make C input as 0 . Since C is 0 both the AND gates output are 0. The R & S inputs can be anything (x). The inputs (R&S) of RS Latch is 1,1. So there is no change in output.

Now let us make C as 1 . Since C is 1 both the AND gates output depends on R & S. If the R & S inputs are 1 and 0. The inputs (R&S) of RS Latch is 1,0. So the output Q is 0. i.e. we are writing 0 on Q

Now let us take C as 1 . Since C is 1 both the AND gates output depends on R & S. The R & S inputs are 0 and 1. The inputs (R&S) of RS Latch is 0,1. So the output value Q is 1. i.e. we are writing 1 on Q.

Now let us make block diagram of above circuit. That circuit is called "RS Flip-Flop"

Here is the Truth Table for the RS Flip-Flop

If you notice the above circuit, the are three things happening

1. Writing 1 at Q (Write)

2. Writing 0 at Q (Write)

3. Preserving the value of Q (Memory)

Also two inputs R & S are used to store only one bit (Q). Let us reduce the two inputs to one. So R & S are reduced D. Refer the table below.

Now let us construct a D Flip Flop using RS Flip Flop

In D Flip Flop when C input is 0 there is no change in the Q output. When C input 0, the D input is not considered.

In D Flip Flop when C input is 1 then the D input goes directly to Q output.

Now let see the block diagram of D Flip Flop.

The truth table of D Flip Flop

This is the most important component in Digital Electronics. Microprocessor, Memory, FPGA all devices are constructed using this D flop flop. To see the use of this D Flip Flop refer the following answers.