Timed pulses with flip-flops

    Joined
    Nov 7, 2013
    Messages
    14
    Reaction score
    9
    Hopefully this merits a thread.
    Sometimes, you'll want to create a pulse of delay S (in seconds), and most people approach this by placing down 2S delay blocks in a loop (as a delay block creates a 0.5 second delay).

    However, you can save space by realising that the addition of a flip-flop as the output to a repeating pulse (like 2 delay blocks cross-linked) will double the total delay: The flip flop will toggle on each cycle of the delay circuit. If you add another flip-flop, you will double the delay again, as this flip flop will toggle only after the previous one has, itself, cycled.

    You can therefore achieve any delay with minimal blocks by taking S and halving it until you're left with a non-integer value or 2, we'll this number D. The number of times you halved S to reach D will be called F.
    Create the loop of delay blocks using exactly D delay blocks. Then, attach a chain of F flip flops as output. The last flip-flop in the chain will take exactly S seconds to pulse.


    In this image, the final flip-flop will take 8 seconds to pulse: the delay cycle takes 1s, which is doubled three times.

    In this way, you can also see that the delay of a circuit like this will equal D*(1+F/2)
     
    Last edited:
    Joined
    Jun 22, 2015
    Messages
    2
    Reaction score
    0
    Would you mind clarifying your instructions for odd numbers? If I wanted 7, what exactly would be the setup? If I follow the instructions exactly. Halving 7 = 3.5(non integer) = D and you divided once = F. 3.5 delay blocks and 1 flip flop?
     

    Jaaskinal

    ¯\_(ツ)_/¯
    Joined
    Jan 19, 2014
    Messages
    1,377
    Reaction score
    646
    • Legacy Citizen 4
    • Wired for Logic Gold
    • Thinking Positive
    Would you mind clarifying your instructions for odd numbers? If I wanted 7, what exactly would be the setup? If I follow the instructions exactly. Halving 7 = 3.5(non integer) = D and you divided once = F. 3.5 delay blocks and 1 flip flop?
    You kindof don't. The domain of the function is limited to counting numbers, and the range is 2^x.
     
    Joined
    Jun 22, 2015
    Messages
    2
    Reaction score
    0
    Well, I imagine you could still use it to reduce the number of blocks. I haven't tested it but I assume it should work to use the flip flops to get to the nearest power of two <= your target value and then chain a few delay blocks after that to hit the desired value.
     
    Joined
    Jan 31, 2015
    Messages
    53
    Reaction score
    2
    • Purchased!
    Would you mind clarifying your instructions for odd numbers? If I wanted 7, what exactly would be the setup? If I follow the instructions exactly. Halving 7 = 3.5(non integer) = D and you divided once = F. 3.5 delay blocks and 1 flip flop?
    well, that'd be 8 blocks in total instead of the 14 to do purely with delays, so it still saves space, it's just more efficient on saving space for 2^x numbers.


    Well, I imagine you could still use it to reduce the number of blocks. I haven't tested it but I assume it should work to use the flip flops to get to the nearest power of two <= your target value and then chain a few delay blocks after that to hit the desired value.
    For this instance, that'd result in 4 blocks to get to 4s (Delay-Delay-Flip-Flip (or Delay-Flip-Flip-Flip)), and then another 6 delays for the 3s on top, resulting in 10 blocks in total.
    I believe you'd want to test out for each method, but this particular method I believe would be more useful for numbers slightly above 2^x instead of slightly below, but it still saves some space.