XavLogic: 6 block inline counter circuit

    Joined
    Jan 22, 2015
    Messages
    110
    Reaction score
    14
    For some reason, there is a distinct lack of counters in StarMade. Not sure why. They are the heart of most sequential systems, fixed repetition systems, calculators, etc. I suspect when rails show up, they'll come into more use.

    I did find this monster.
    http://starmadedock.net/content/logic-counter.2143/updates

    It's really cool that it's essentially a binary computer. It's not really cool in that it's freakin' massive for what it does. So without further ado, my solution to a Starmade counter. Most digits are 6 blocks with the zero digit (left) and the reset circuit (right) being different.


    Just fyi: that array can count from 0-9 and is currently at 0.

    The zero digit consists of a SvenCell™ (AND/OR) memory cell, a NOR, and an AND. The NOR/AND combination allows the system to recover from null state (no memory cells active) as well as automatically set to zero when the digits reset. The counter should never actually be in the null state, but it'll recover if something freaky happens and all your memory circuits get shut off. The zero digit, like everything in my counter, takes it's input from the non-memory AND. The other input into the AND is from the NOT of the NOR. The OR of the NOR receives input from the output of every single cell in your first set of digit cells, including the zero cell and outputs into the NOT.

    In other words, the zero cell is blocked from receiving direct input if any other memory cell in the first digit, but will update when the digits all reset. Like I said, it shouldn't go null, but if it does, it'll recover the next time the zero cell gets an input.

    At the other end, the reset cell is simply a 1 second delayed AND linked into a NOT. The NOT resets the last counter cell in the series, and because StarMade circuits last for a half-second, ends up reactivating the zero digit so your system is never in null state.

    The counter cells consist of a 1 second delayed AND, a SvenCell™, and a NOT. The 1-sec AND is your input and the wiring is simply DELAY->DELAY->AND. The AND of the SvenCell™ is your output. That's why if you look at the inline version of the cell, you see I set things up that way even though it does mean the signal is moving one way in the 1-sec AND and the opposite direction in the rest of the cell. But if you're so OCD as to care about having all your current flow in one direction, you need professional help anyway and/or are one of my ex-gf's, so really, not going to lose much sleep over upsetting you.

    The wiring within the cell you can see in the 1-cell which I broke up into its pieces. The AND in the 1-sec AND goes into the OR of the SvenCell™ which is the input of that memory cell. The AND of the SvenCell™ goes into the NOT, the first DELAY of the next cell, and into whatever else you want to hook it into (for example an OR that turns on lights displaying a "1"). The NOT goes to the SvenCell™ AND of the previous cell. The NOT turns the previous cell off when this cell turns on. The AND being wired into the 1 second delay will eventually (obviously after 1 second) allow the next cell to be turned on.

    Whatever you're using as an input has to go to all the AND's of each counter's 1-sec AND, and absolutely must be a half-second pulse. Otherwise the system turns into a very unreliable stopwatch. Even if you want a stopwatch, you're better off using an NOT-DELAY clock (just wire them to each other) then wire one of those blocks into an AND and hook an activator into that same AND and using that as a stopwatch. This gives you precise pulses every second that you can start and stop just by turning on or off the activator. So what you'll see happening is that a memory cell of one counter will be active, its NOT will be the only one turned off which is how the previous cell got turned off, and the 2 DELAYs of the next cell will be active thereby preparing the input AND of the next cell to be activated.

    There are a ton of ways to reset the system to zero from any stage. You can brute force it by wiring a NOT into every single AND of every single SvenCell™ to send them all a low pulse. You can build your base circuit, then wire in a NOT that turns off that row's cells so that you're only wiring together the NOT's at the end. You can also do some cool AND based stuff so that when your counter hits a specific point it resets, and even go to ridiculous by allowing the user to 'program' what that point is. There are lots of possibilities here, and they depend on how big your counter gets, whether it's even allowed to count in loops, what base its counting in, etc which is why I didn't just build it as part of the general counter.

    The best part of this is that you can count in any base you want. Want to count in base 8? Set up to go from 0-7. Hex? 0-15. And then you can expand quickly to add another digit simply by adding another row of counter cells and wire the last cell in each row to both the reset and all the non-zero digits of the next row. So, if you were counting from 9 to 10, when the system updates, it'll reset the first row to zero and set the second row to 1. Then when it goes from 19 to 20, the 9 digit will update the second row to 2 and the reset will set the bottom row to 0. And so on. Have fun.
     

    takethispie

    Titan-class builder
    Joined
    Oct 3, 2012
    Messages
    239
    Reaction score
    103
    • Purchased!
    • Wired for Logic
    • Legacy Citizen 9
    Joined
    Jan 22, 2015
    Messages
    110
    Reaction score
    14
    as I said in the Sven topic RS ANDOR memory cells doesn't exists , it's a bug from starmade
    also your counter is pretty huge, it should need about only 30 gate to count from 0 to 15 ^^'
    4 JK latches, 2 and gate and your clock = 6* 4 + 2 + your clock
    you need to learn ow to build the different latches :)

    some help:
    https://learn.sparkfun.com/tutorials/logicblocks-experiment-guide/logic-beyond-logicblocks

    a synchronous counter schematic:
    http://www.allaboutcircuits.com/vol_4/chpt_11/3.html
    I do know how to build all the gates and flip flops. That was the first thing I figured out how to do once I started playing StarMade the same as it was the first thing I did when I started playing Minecraft the same thing as it was when I built my first little electronics kit computer way, way long time ago.

    Take you circuit and make it count to a million and tell me how long it's going to take you to build it, how much work you're going to put into planning it, and how many blocks it takes to count to big numbers.

    I built a copy-pastable inline cell with infinite expandablity. The setup I put together can be copy pasted into a circuit that can count to a million in less than five minutes. Or it could count to a 1,677,216 hex (which would display as 1,000,000 cuz fun!) and take only a few moments longer since you need to copy 16 cells the first time rather than 10 but after that, you're just copying whole rows.

    And your links do not apply to StarMade for the same reason your bug post doesn't apply to StarMade. StarMade logic doesn't work that way. If StarMade processed sequentially, I could drop the two delays that separate out the input into distinct signals which would save me blocks and headaches in protecting my inputs. But since we're playing StarMade and building things in StarMade, I came to the obvious conclusion that I'd prolly want to stick to StarMade rules rather than formal logic circuit rules.
    [DOUBLEPOST=1424915714,1424915604][/DOUBLEPOST]
    It looks like it counts the number of times the input has been activated.

    Pretty much.

    Three round bursts on weapons. A lap counter for my gravity racetrack. A stopwatch for the same racetrack. Lots of fun things for Minecraft rails back in the day that I hope translate to StarMade when we get rails, and even more fun things if we ever get mover blocks (like pistons in Minecraft but hopefully using StarMade's connection system to move whole groups of blocks together)
     
    • Like
    Reactions: Gristle

    Jaaskinal

    ¯\_(ツ)_/¯
    Joined
    Jan 19, 2014
    Messages
    1,377
    Reaction score
    646
    • Legacy Citizen 4
    • Wired for Logic Gold
    • Thinking Positive
    Something I just thought of, it might be good to note that my counter and this counter are for different functions. Xavori's is for counting the number of times one input is activated, as stated above, but mine is to count how many inputs are activated. Slight difference, but one is better for some things while the other is better at other things :P
     
    Joined
    Jan 22, 2015
    Messages
    110
    Reaction score
    14
    Something I just thought of, it might be good to note that my counter and this counter are for different functions. Xavori's is for counting the number of times one input is activated, as stated above, but mine is to count how many inputs are activated. Slight difference, but one is better for some things while the other is better at other things :p
    Ya.

    And not sure if you set out to do it or not, but you really are just a couple steps from building a full-on binary based computer.

    I just used your setup as an example because when I tried to google "Starmade logic counter" yours was the only truly relevant response I got. Apparently not many people have gotten into the fun with logic mindset of seeing what they can build, regardless of whether its practical, like they have with Minecraft.

    For example, if you wanted to build a clock that kept fairly accurate time (provided you put it in a sector on a server you can be absolutely sure never lags) you could take my counters in rows of 10 (ones digit seconds), 6 (tens digit seconds), 10 (ones digit minutes), 6 (tens digit minutes) and then either 12 (hours) with something like an RSNOR to track AM/PM or 24 if you wanted military time. Hook it all into a display (yours is awesome btw) and call it done. Then you'd just need to figure out a way to keep the sector always in memory (we really need a server.cfg setting for this).
     

    Jaaskinal

    ¯\_(ツ)_/¯
    Joined
    Jan 19, 2014
    Messages
    1,377
    Reaction score
    646
    • Legacy Citizen 4
    • Wired for Logic Gold
    • Thinking Positive
    Ya.

    And not sure if you set out to do it or not, but you really are just a couple steps from building a full-on binary based computer.

    I just used your setup as an example because when I tried to google "Starmade logic counter" yours was the only truly relevant response I got. Apparently not many people have gotten into the fun with logic mindset of seeing what they can build, regardless of whether its practical, like they have with Minecraft.

    For example, if you wanted to build a clock that kept fairly accurate time (provided you put it in a sector on a server you can be absolutely sure never lags) you could take my counters in rows of 10 (ones digit seconds), 6 (tens digit seconds), 10 (ones digit minutes), 6 (tens digit minutes) and then either 12 (hours) with something like an RSNOR to track AM/PM or 24 if you wanted military time. Hook it all into a display (yours is awesome btw) and call it done. Then you'd just need to figure out a way to keep the sector always in memory (we really need a server.cfg setting for this).
    Even if it didn't keep completely correct time, it'd still be an interesting RP piece, "It is 16 hours, 36 minutes, 7 days, and one month since the world began"

    And no, I just wanted to make a counter, but I think it's more inherent of it being a counter and less inherent of it being a massive inefficient setup that makes it close to a binary computer xD
     

    takethispie

    Titan-class builder
    Joined
    Oct 3, 2012
    Messages
    239
    Reaction score
    103
    • Purchased!
    • Wired for Logic
    • Legacy Citizen 9
    I do know how to build all the gates and flip flops. That was the first thing I figured out how to do once I started playing StarMade the same as it was the first thing I did when I started playing Minecraft the same thing as it was when I built my first little electronics kit computer way, way long time ago.

    Take you circuit and make it count to a million and tell me how long it's going to take you to build it, how much work you're going to put into planning it, and how many blocks it takes to count to big numbers.

    I built a copy-pastable inline cell with infinite expandablity. The setup I put together can be copy pasted into a circuit that can count to a million in less than five minutes. Or it could count to a 1,677,216 hex (which would display as 1,000,000 cuz fun!) and take only a few moments longer since you need to copy 16 cells the first time rather than 10 but after that, you're just copying whole rows.

    And your links do not apply to StarMade for the same reason your bug post doesn't apply to StarMade. StarMade logic doesn't work that way. If StarMade processed sequentially, I could drop the two delays that separate out the input into distinct signals which would save me blocks and headaches in protecting my inputs. But since we're playing StarMade and building things in StarMade, I came to the obvious conclusion that I'd prolly want to stick to StarMade rules rather than formal logic circuit rules.
    the JK latches based counter work for the same reason there is no "formal logic" and "starmade logic" ^^
    to count to 2^20 or 1 048 576 it would take 12 gate per bit -> 12 * 20 + 1 = 241 gate
    as I made a template it would be about less than 20min to make it
    also it can stack vertically and horizontally without change to the template



    it is exactly the same schematic as in the link I posted earlier with a slight difference: the delays between the gate because signal transmission are instantaneous and without those it would go from 0 to 15 instantly ^^
    it took me about five minutes to build it and check it's working
     
    Joined
    Jan 22, 2015
    Messages
    110
    Reaction score
    14
    the JK latches based counter work for the same reason there is no "formal logic" and "starmade logic" ^^
    And yet you had to stick those delays in because????

    to count to 2^20 or 1 048 576 it would take 12 gate per bit -> 12 * 20 + 1 = 241 gate
    as I made a template it would be about less than 20min to make it
    also it can stack vertically and horizontally without change to the template
    it is exactly the same schematic as in the link I posted earlier with a slight difference: the delays between the gate because signal transmission are instantaneous and without those it would go from 0 to 15 instantly ^^
    it took me about five minutes to build it and check it's working
    Now, finish the circuit so that the binary counter can output something other than binary.

    Not saying your solution is wrong or bad. After all, JK synch counters are the go-to choice in electronics for a reason. But my counter was built to be easy. And if instead of using my counters the way I showed up above where each 6 block set represents one value of a digit, I used my counters as binary digits, I'm at 6 blocks to a JK latch's 8 + wiring blocks. So...still smaller.

    Heck, if I took my 5 block flip-flops and just stuck a delay on them (for the same reason you have delays between your flip flops), I'd have another way to use 6 blocks per binary digit. Cuz really, all you need is a flip flop and a way to limit when the subsequent digits update to make a counter.
     

    takethispie

    Titan-class builder
    Joined
    Oct 3, 2012
    Messages
    239
    Reaction score
    103
    • Purchased!
    • Wired for Logic
    • Legacy Citizen 9
    Now, finish the circuit so that the binary counter can output something other than binary.
    from binary to hexa it's easy but from binary -> decimal it's a little bit harder for big numbers but there is a lot less uses

    And yet you had to stick those delays in because????
    because there is no delay between connection wich is faster than my clock cycle x)

    I've never used jk counter even if I know how to make them, i'm always using counter with increment/decrement and parallel load i'm using on the differents processors I've built

    Wouldn't this be a "shift register"? I'd actually have to see it function.
    I know the difference between a shift register and a counter xD

    a shift register don't have the same connections and would rather use D Flip Flop (but JK are the same when you connect J and K together)
    the not gate at the begining would be replaced by the data input and each ouput of the previous JK latch would go to the next Data input
    and that's only for a SIPO shift register (it need a lot more gate for a PISO shift register) :)
     
    Joined
    Jan 22, 2015
    Messages
    110
    Reaction score
    14
    Wouldn't this be a "shift register"? I'd actually have to see it function.
    Kinda surprised you haven't built a JK flip-flop counter. I wasn't kidding when I said it was the go-to counter in electronic circuits since computers don't care what a pain it is to convert to base 10, nor are they unfamiliar with what numbers look like.

    'Course in Minecraft simply building JK's is a pain versus just using piston toggles which in turn are also easier to use in counters.

    from binary to hexa it's easy but from binary -> decimal it's a little bit harder for big numbers but there is a lot less uses
    The easy solution for bin to dec is similar to how I initially suggested people use my counters, don't actually count past 9 and then reset current / start a new row for each significant digit. Then wire in a series of 10 AND blocks that represent 0-9 with connections from the outputs of the '1' state of the JK's to convert your binary numbers into single digit decimal, ie. 100 = 4, 1000 = 8, and 1001 = 9 then reset.

    Resetting (for those not familiar with JK's) is easy because you can directly trigger the OR's on either side of the flip-flip and change its state regardless of J or K being high or low. So setting up the reset AND just means that when the counter tries to get to 1010, it gets set back immediately to 0001. (this is also pretty much what you'd do using this counter for counting to anything that isn't a power of 2)

    The downside of the easy solution is that you're basically building a 4th JK that will only be used for 2 of the possible 8 numbers it could have represented. It also makes for a spaghetti bowl of connections into the display AND's, but since each of the 4 JK's only represents 0 or 1, just looking at 0100, 0111, or 0010, etc. it's not hard to figure out connections. It's just there's a lot of them.