# How do D flip flops know the correct count sequence?

Let's say we want to show the count sequence 001->010->100->111 using D flip flops. Next step would be making a state table.

After simplifying using K-map, we get D^A=C', D^B=B', D^C=A. Then I built the circuit with two 7474 ICs and it works. If the counter starts with 000, it will go through the wrong sequence (000->110->101->011) . I am confused about how the counter is able to 'avoid' the wrong starting sequences and always get the correct starting sequences every time. I am using 74LS74N IC with both the clear and preset input activated FYI. The function table for both PRE and CLR set high is as follows. Given that it can also start with 000 or any other combination not in the correct sequence, it seems to be magical to me with the fact that it always begins with one of the combinations in the correct sequence every time I powered up the circuit.

• It doesn't know that. I guess yours just starts up in the right sequence by chance or design? Mar 20 at 1:16
• I don't think it's by chance since it begins with the right sequence every time the circuit is powered up. Could be by design, but I am not sure what settings in the counter cause this to happen though. With the preset and clear inputs activated, every combination of ABC has the chance of being selected when starting up. Mar 20 at 1:30
• it could be that your type of D flip-flops always start in the 1 state, for example Mar 20 at 1:31
• Possible. But I do get a mix of one of the 4 sequences when starting up. Mar 20 at 1:41
• Without the clock, can you check the startup state multiple times upon powerup? Is it the same startup state each time? Because that is also possible. It does not need to be random. Make sure you have enough time between a poweroff and poweron for the circuit to fully discharge.
– sai
Mar 20 at 1:45