simple modular binary +1/-1 counter using logic blocks

    Joined
    Aug 31, 2013
    Messages
    21
    Reaction score
    16
    So I know this has been covered using regex commands with the display modules, but for anyone interested in a simple solution using the logic blocks, here it is. Due to it using the DELAY blocks to compare the current state of the FLIP FLOPs to the old state, results will be wrong if you activate it more than 2 times a second.

    image.jpg

    The solution of the picture works for 4bit counters, but it can just as well extended to any number of FLIP FLOPs (which are of course the parts that display the actual count). Also you need some fundamental understading of binary numbers to understand why this thing is a counter in the first place, I guess. Anyways, have fun finding a useful place for it. For me the next step will be extending it to be able to add and subtract any binary number.
     

    Fellow Starmadian

    Oh cool so thats what this is
    Joined
    Jun 7, 2014
    Messages
    227
    Reaction score
    87
    • Community Content - Bronze 1
    • Wired for Logic
    • Legacy Citizen 2
    This circuit is very impressive (edit: inventive, intuitive, etc), but the counting issue can be solved much more simply and quickly utilizing instant pulses. simply make a string of latches of any length. to count one way, a button connected to the first latch is activated. to count the opposite way, a button connected to ALL the latches is activated. If you'd like a further explanation of instant pulses, I can either give a verbal explanation or I can dig up my instant pulse lesson bread board.
     
    Last edited:
    Joined
    Aug 31, 2013
    Messages
    21
    Reaction score
    16
    Thanks for the feedback, I have no idea what you mean by instant pulses though. Can you explain (shortly) or link me somewhere it is covered?
     

    Jaaskinal

    ¯\_(ツ)_/¯
    Joined
    Jan 19, 2014
    Messages
    1,377
    Reaction score
    646
    • Legacy Citizen 4
    • Wired for Logic Gold
    • Thinking Positive
    Instant pulses are the intentional abuse of race conditions with logic.

    A classic race condition would go as follows, a signal is applied to a not-gate and an and-gate. The not-gate goes to the and gate as well.

    Logically, the and-gate should never go output a high signal, but in real life, if there's a mechanical delay with the gates, the and-signal may actually output a high signal.

    This exact example doesn't happen in SM, schema made logic look far enough ahead to solve issues like that. Most instant pulses in SM are created by having multiple signals going into activators, or flipflops.
     

    Fellow Starmadian

    Oh cool so thats what this is
    Joined
    Jun 7, 2014
    Messages
    227
    Reaction score
    87
    • Community Content - Bronze 1
    • Wired for Logic
    • Legacy Citizen 2
    so I have one more class to attend but when I get back I'll give an in-depth explanation. When jaas says something may actually output a high signal, she means that given the right instant pulse timing, it will. Random instant pulses are a major factor in complex logic designs, makes for fun debugging.
     

    Fellow Starmadian

    Oh cool so thats what this is
    Joined
    Jun 7, 2014
    Messages
    227
    Reaction score
    87
    • Community Content - Bronze 1
    • Wired for Logic
    • Legacy Citizen 2
    Ok so sorry this took so long, but here's a pretty nice visual explanation. Here's a circuit that, without instant pulses, should have all three latches change their state.

    Here's a gif of what happens during the game's calculation of the circuit, slowed down to .5 seconds per gate:
    So from this you can tell that a HIGH signal propagates at a rate of 1 block per tick. There's lots of neat things you can do with an instant pulse of a defined length, meaning that LOW states also propagate at the same rate. But the most basic example is what brought me into this thread, the latch counter.
    If you study these gifs for a few minutes, you should be able to understand enough to test yourself. granted I've never taught using this method before so it might be too confusing lol.