Using Flip Flops 101

    Joined
    Sep 4, 2015
    Messages
    46
    Reaction score
    3
    I made a logic based firing control to fire 5 beams in a series and discovered a FEATURE with using logic to activate the beam computers.

    the system is fairly simple:
    1. clock timer
    (>- activation - delay x3 - NOT -<)
    2. counter incremented by clock
    ( clock(1) -> FlipFlop x3 ) each FlipFlop linked to NOT gate for 1 state
    3. counter reset
    ( AND(triggered by counter=5) -> delay x2 -> activation -> reset counter to 000 state)
    4. AND gate controlled beam computers x5
    (each AND is triggered by specific state of counter)

    the problem is that on 1, 3 and 5 the AND gates trigger multiple weapons without it being intended or in fact being linked to said weapons at all...

    gif of the problem:


    annotated img


    *edit* add .smet

    *edit* SOLVED
    cause I'm batman
    obviously...

    not really a bug, it was an issue with flip flops because the way they work in game, solved by putting a NOT gate to cause beams to trigger ONLY when flip flops have reached stable state



    why this happens : the flip flop counter cycles through all intermediary steps between the original and the end state. so while its cycling, it will trigger event even though it should no in theory do so in the 1 processing cycle it takes to happen.

    by linking it to the "off" state of the clock you prevent this event from happening as no signals are sent while the clock is in the "on" state and flip flops are flipping

    legit and realistic as possible, probably happened to the first binary logic systems too
     

    Attachments

    Last edited:
    Joined
    Jan 18, 2015
    Messages
    41
    Reaction score
    7
    I've been having troubles with simple memory cells and race conditions... I also wasn't going to read the whole man page for this... but I do hope that that first comment gives some insight!
     
    Joined
    Jan 25, 2015
    Messages
    964
    Reaction score
    225
    • Wired for Logic
    • Councillor 2 Gold
    • Legacy Citizen 5
    I made a logic based firing control to fire 5 beams in a series and discovered a FEATURE with using logic to activate the beam computers.

    the system is fairly simple:
    1. clock timer
    (>- activation - delay x3 - NOT -<)
    2. counter incremented by clock
    ( clock(1) -> FlipFlop x3 ) each FlipFlop linked to NOT gate for 1 state
    3. counter reset
    ( AND(triggered by counter=5) -> delay x2 -> activation -> reset counter to 000 state)
    4. AND gate controlled beam computers x5
    (each AND is triggered by specific state of counter)

    the problem is that on 1, 3 and 5 the AND gates trigger multiple weapons without it being intended or in fact being linked to said weapons at all...

    gif of the problem:


    annotated img


    *edit* add .smet

    *edit* SOLVED
    cause I'm batman
    obviously...

    not really a bug, it was an issue with flip flops because the way they work in game, solved by putting a NOT gate to cause beams to trigger ONLY when flip flops have reached stable state



    why this happens : the flip flop counter cycles through all intermediary steps between the original and the end state. so while its cycling, it will trigger event even though it should no in theory do so in the 1 processing cycle it takes to happen.

    by linking it to the "off" state of the clock you prevent this event from happening as no signals are sent while the clock is in the "on" state and flip flops are flipping

    legit and realistic as possible, probably happened to the first binary logic systems too
    sorry m8 but binary is already a thing. I do like that you found out a way yourself.
    I'll just tell you where I got my knowledge.
    thanks to Olxinos with this thread http://starmadedock.net/threads/instant-pulses-and-some-starmades-logic-details.8117/#post-125266
    I was able to make a 2 player game.
    the thread is full of useful things some you didn't even know existed, like the mini-delay.
    you'll have puzzle your own way how to turn his information into multiple outputs, small hint: you'll need or-signals not-signals and-signals and the setup he shows. good luck! and if you can't find the solution ask Olxinos or me