Home    LittleBigPlanet 2 - 3 - Vita - Karting    LittleBigPlanet 2    [LBP2] Tutorials
#1

Scalable digital counter UPDATED with level

Archive: 33 posts


This is my first tutorial, so be nice.

Update I have included the new version of this into a level on LBP2 (http://lbp.me/v/x94vgt). It now will not roll over 9 on the highest digit (eg 999), and it will not go below 0. If you want to use it without that logic, just run your up down input directly to the counter cycle, and chain the other digits the same way. This will bypass the logic for not allowing rollover.

http://i135.photobucket.com/albums/q149/tbradt/lbp/LBP2%20Counter/display.jpg

What it does
This is a single digit that allows you to either set the value directly, or add or subtract values. It can be used individually or you can chain groups of them together via the single input/output to create any size number you choose. These numbers can be controlled through a single input, set directly, or added to or subtracted from. Actually quite useful.

How it was done

The first step is making your display. Set your grid to small. Now use holo material in the circle shape. Flatten this out to a flat layer and one square in size. Now make a bar that is one grid square high and ten wide.

Use the holo material again and set the display brightness to 0. While still on small grid, choose a square shape and flatten it. This time you want a shape about 14 wide and 25 tall. If it is a little larger that is fine. You can always trim it later.

Now take your holo bar and set the ON color to whatever color you want it to display when on. Duplicate the bar using L3 and cut out where the parts of your digit will display on your holo rectangle and then paste a duplicate in there. Once you have done that select your transparent material and glue it all together.

Ok, now place an Anti-Gravity Tweaker on the non display part of your digit to keep it in place. Also place a microchip on the non display portion of your digit.

When you are done you should have something similar to this

http://i135.photobucket.com/albums/q149/tbradt/lbp/LBP2%20Counter/MainDigit.jpg
Note:This is displaying a 0, at this point yours probably looks more like an 8.


Making the Logic

Open your microchip and choose an OR gate. Set it to have 10 inputs, and place 7 of them on your microchip in the same figure 8 that your digit displays in. This makes it easier for assigning inputs and outputs later.

Below that, place a single selector with 10 input/outputs.

Now take your OR outputs and attache them to the corresponding holo material for each part of the display.

Use the outputs from your Selector to make your digits. For example, output 1 will make the 0, so take the output from the 1 node and attach it to the corresponding input on each of the OR gates on the outside of your pattern so that when the first node on the Selector is active, your holo display lights up a zero. Continue to do the same for each node/digit.

http://i135.photobucket.com/albums/q149/tbradt/lbp/LBP2%20Counter/MainChip.jpg
NOTE: I set mine up so that each of the inputs for the OR switches corresponds to a given number. The ones on the left and bottom for 0, next for 1, and on up. This does leave some gaps, but it makes adjustments easier if you mess up a number. Plus it makes the microchip look a lot cleaner.

Ok, at this point take a second and pat yourself on the back! You now have a completely functional digital counter. Go ahead and hook a switch up to the Cycle input of your selector and test it out. Try hooking two switches through a direction combiner. Pretty snazzy huh? We're not done just yet.

Now add a microchip onto your main one just to the left of your selector and open it up (You probably noticed that in the picture above). Now on the microchip place two OR gates, two counters set to count to 1, two AND gates, and a single direction combiner as shown below.

http://i135.photobucket.com/albums/q149/tbradt/lbp/LBP2%20Counter/UDchip.jpg

The outputs of each OR gate should be attached to the reset input of their neighboring counter.

From top to bottom connect the outputs of your main selector as follows.

Top OR gate should be attached to "Selecter Output:#9"
Top counter should be attached to "Selector Output:#10"

Bottom counter should be attached to "Selector Output:#1"
Bottom OR gate should be attached to "Selector Output:#2"

Connect your counter outputs to the AND gate directly to the right.
Top AND should have the remaining input attached to "Selector Output:#1"
Bottom AND should have the remaining input attached to "Selector Output:#10"

Connect the AND gates to their corresponding poles in the combiner and their corresponding OR gate (top to top, bottom to bottom) .

Now we're DONE!!!

Now close all of your chips and duplicate the whole digit and place a copy of it to the left of the original. Open the chips on the right digit one more time, and connect the output from your combiner on the inside chip to the cycle input on selector on the chip to the left. Now every time the chip on the right rolls over from 9-0, or 0-9, the chip on the left will behave accordingly. You could attach another chip to the one on the left if you want. You can keep doing it to create a number as large as you like.


PS-This counter only works with positive numbers ATM. If you roll back below 0 it will go to 99 (or 999 or 9999). I didn't include the logic to keep from going below 0 because I wanted all the numbers to be identical and it is only needed on the very first number. Doing that is fairly easy though with a counter and a NOT gate. If there is interest I will add that part to the tutorial.
2011-01-24 02:57:00

Author:
tdarb
Posts: 689


Wow, this is really good! I was just thinking about this today actually.

And such an elegant solution, compared to the first LBP...

Great job, will definitely try this out, even if I don't have a level to use it in quite yet
2011-01-24 06:17:00

Author:
goldenclaw13
Posts: 224


Hehe, thanks. I hope you find it useful. Let me know how it comes out.

I've found it useful when building scoreboards, counters, and timers. The basic design could be modified to display letters too. I really like the concept of simple reusable objects, so I spend far too much time in my levels making as much of the logic plug and play as I can.....maybe that's why I rarely finish
2011-01-24 16:11:00

Author:
tdarb
Posts: 689


This can be in easier by chaining selectors, also having LCD controls is waste of thermo with holograms that can simply overlap themselves. On other hand if you want to do some LCD number display like animation (like common tape rolling effect) you solution will be more suitable ;]2011-01-24 16:21:00

Author:
Shadowriver
Posts: 3991


Well, the choice of material is a mostly aesthetic one. One could just as easily use cardboard and neon or light matter. I just did a test on this, and it took me 75 of these to fill up a quarter of the thermo. Pasting four of them to show up to 9999 barely uses 1%. The only other way I can think to do this would be with emitters, is that really any less resource intensive?

You mentioned stringing together selectors, and that's essentially what this is. there's just the added logic of an output that rotates the next selector in the chain accordingly. The idea is to have a ready made counter object that can be used anywhere just by placing the digits and adding an input. The benefit of the holo material is both that it can pass through anything and it is invisible, making it ideal to overlay onto most levels.

I've looked over this repeatedly since your message, and, aside from materials, I really can't see any way to streamline it any more. I could possibly save some tiny bit of thermo by getting rid of the empty OR gate inputs, but the convenience that layout adds is worth the trade IMO.

If you guys know a better way to do this, then please don't hold back. I'm still learning, so If there's a more efficient way to do it I would love to know so I can make adjustments.
2011-01-24 21:11:00

Author:
tdarb
Posts: 689


The one downside to this is you can't do much math with it as your values are stored digitally, which means you'd need to convert it to binary and back first, which is a bit of a headache.

The method I'm using atm to build a calculator is using a series of toggle switches as bit storage, with toggle #1s input the primary input, and then toggle 1 -> toggle 2 -> 3 ->4, for a 4 bit State Machine.

Then to make a display I took all of the game's digital stickers, the green ones on black background, and put them on cardboard and cut them out.

I'm now building a small display that is just a thick layer of cardboard with the whitespace cardboard of the generic shape of the display. An emitter will emite the cardboard number into the space allocated for it.

Then each of the 4 toggle switches is hooked up to a colored tag. Then using a series of AND and NAND gates I set up 10 emitters within a MC to emit the numbers based on the state of the 4 bits,IE 0000 emits 0, 0010 emits 2, and so on. Emitted at once, lifetime infinite, type = appear, so on so on.

Second, on each of the numbers being emitted is the same small chunk of logic hooked up to a kill switch set to make it dissapear, but the output runs through a not gate.

Essentially when the state changes the number immediately kills itself so the spot can open up for the new number to be emitted in its place. Each number has four tag switches and up to 4 not gates, which would be 0, for a total of 40 gates in total. Which isn't much at all.

Though my system is far more complicated than yours, it allows me to do binary addition and subtraction between my digital numbers, at the moment I'm trying to figure out a smooth way to multiply so one can add multi digit numbers, in other words I need a way to convert 0001 and 0110 to 10000, in other words 1 and 6 to 16, which requries me to turn 1 into 10 and add it to 6, yay multiplication... @_@;
2011-01-25 15:32:00

Author:
lionhart180
Posts: 200


Not bad!

When I made the display for my Logic Probe (http://lbp.me/v/wqzn-q), I put the results from the A->D conversion as circuit nodes laid out like this to keep track of which segment was which:
http://ie.lbp.me/img/ft/dce2552980e4d19a569ab7d54ac90b9982a73fb6.jpg
Also, I only put 1 per "line" to keep the chip's output lines from rearranging themselves.
2011-01-25 18:54:00

Author:
Balorn
Posts: 92


Man I really need to start understanding computer science. What is a simple way to get into it and start to understand it?2011-01-25 21:37:00

Author:
Krondelo
Posts: 136


Man I really need to start understanding computer science. What is a simple way to get into it and start to understand it?

http://www.play-hookey.com/digital/basic_gates.html

^_^
2011-01-26 01:46:00

Author:
lionhart180
Posts: 200


http://www.play-hookey.com/digital/basic_gates.html

^_^

Haha thanks, I have already looked at the basics but I like how this site breaks it down and shows it in a more practical manner (ie:Verbal examples)

The only thing is, it gets complicated so quick!
2011-01-26 05:06:00

Author:
Krondelo
Posts: 136


The one downside to this is you can't do much math with it as your values are stored digitally, which means you'd need to convert it to binary and back first, which is a bit of a headache.

....

Though my system is far more complicated than yours, it allows me to do binary addition and subtraction between my digital numbers, at the moment I'm trying to figure out a smooth way to multiply so one can add multi digit numbers, in other words I need a way to convert 0001 and 0110 to 10000, in other words 1 and 6 to 16, which requries me to turn 1 into 10 and add it to 6, yay multiplication... @_@;

well, yes and no. From a display standpoint, the main difference is that you output your results to an emitter while mine would output it to a node on a selector to change the numbers.

Display aside, both would work with added binary logic. Using the selector would add a level of reusability to your setup because it also gives you the ability to use a +/- input to turn it into a counter if you decide to use it without the binary logic.

I started working on a binary system to use with this, but I put it on hold for now. If you get the time i would love to take a peek at what you are doing so I can get a better handle on how to implement binary addition/subtraction.
2011-01-26 16:59:00

Author:
tdarb
Posts: 689


Binary addition is very easy in LBP2, the logic gate for the first 2 bits is XOR for the sum and AND for the carry over, so you simply make an MC with two inputs, A and B, and have them go into an XOR gate which outputs S, and also going into an AND gate and outputting Cout

Then for all remaining bits you want a full adder, which is just two half adders stuck together and an OR gate, with three inputs and two outputs, (A, B, Cin) and (S, Cout)

A and B -> Half Adder #1

Half Adder #1's S and Cin -> Half Adder #2

Then put both of the Couts of the Half adders through an or gate.

The S output of Half adder #2 is your S output of the full adder, and your combined Couts is your Full adder's Cout.

Essentially make your half adder and copy paste 2 of them into your full adder, stick in an or gate and your done.

Then just make as many full adders as bits you need -1, (one is taken up by the first half adder)

NOTE: The Cout of your last full adder represents a potential last bit of your sum, as you can add together two bitlengths of length n and end up with an output of length n+1
2011-01-27 02:18:00

Author:
lionhart180
Posts: 200


Binary addition even easy in LBP1 too ;] simple as this component:

http://img829.imageshack.us/img829/3225/aphoto31.jpg

Art is to display result in human understandable form

But back to LBP2, Even so think that you really need that, if you know that specific value will do nothing more then +1 or -1 all you really need is a selector, not whole calculator. To build a display timer for example (timer is device that COUNTS time) just chain selectors and plug a timer, what is even fun about it thanks to speed input action of timer you can control flow of time ;]

Not only that selector solution allows you to easily get and set value by useing output inputs of selectors and gate them
2011-01-27 05:31:00

Author:
Shadowriver
Posts: 3991


But back to LBP2, Even so think that you really need that, if you know that specific value will do nothing more then +1 or -1 all you really need is a selector, not whole calculator. To build a display timer for example (timer is device that COUNTS time) just chain selectors and plug a timer, what is even fun about it thanks to speed input action of timer you can control flow of time ;]

Not only that selector solution allows you to easily get and set value use it output inputs and gating them

That's what I have now. I have a selector that increments and decrements and allows chaining of other numbers to increment and decrement them at rollover. I am already doing what you are suggesting.

With a selector you can set the digits directly as well, so if I can do direct math and then set the digits that would be a great tool to have in handy.
2011-01-27 06:39:00

Author:
tdarb
Posts: 689


Hmmmmm....
What would be the best way to get this to display a player's score, would you say..?
I've been playing around with attaching score sensors to this model, and yielding some interesting results... But nothing conclusive. Thoughts?
2011-01-27 16:08:00

Author:
jdteather314
Posts: 74


so you want to display player score right? well you could use score based trans-level communication decoder, since practically it's just player score to binary converter, then convert that to decimal and display it.2011-01-27 19:16:00

Author:
Shadowriver
Posts: 3991


Yep, that's exactly what I was trying to do, shadowriver. I'm getting close to something, but finding out more and more that what I'm ACTUALLY looking for is a "currency" system, which I've been rifling through your "BCD Calculator" tutorial trying to solve. I thought maybe I could "cheat" my way into a currency system by just using the LBP2 point system as my "money" -- found out this will not work on account of LBP2's lack of a "lesser than" option in the score sensor (to prevent players from buying things they can't afford).
Though I suppose this could be solved with a few "nots" and "ands"... Hmmmm... Gonna go try that.

In the meantime, what do you think would be the best way of converting a score to binary?
2011-01-28 14:45:00

Author:
jdteather314
Posts: 74


found out this will not work on account of LBP2's lack of a "lesser than" option in the score sensor (to prevent players from buying things they can't afford).
Though I suppose this could be solved with a few "nots" and "ands"... Hmmmm... Gonna go try that.

Ofcorse thats can be solved by few gates, exactly easiest one is just by AND gating score sensor with a trigger, probably same way as challenges levels in story mode ;] You don't any binary number complexity if you use score as currency, score giver allows you to do addition and subtraction.
2011-01-28 16:50:00

Author:
Shadowriver
Posts: 3991


You don't any binary number complexity if you use score as currency, score giver allows you to do addition and subtraction.

The reason I wanted to convert the score to binary is to have it displayable on a digital counter like the one in this thread. I realize the design of the counter's logic will have to be completely different, I was just wondering if there was a way to convert the player's score into some kind of signal that could be interpreted by a digital display.
2011-01-28 17:42:00

Author:
jdteather314
Posts: 74


Well it might be hard, You need to convert Binary to BCD which requires shifting, i will try to call Aya here i know he was combinating with this on the beta. Once you get Score in BCD you can use this BCD to Decimal decoder circuit over here:

http://lh4.ggpht.com/_BGvgroHHiOU/SwWnnKVqtxI/AAAAAAAAD3Y/oZRbBE_CBZo/s800/bcd-to-decimal-converter-ic.jpg

One per digit. Remember that gates with Balls at the end are NAND and NOR gates, inverted ANDs and ORs
2011-01-28 17:59:00

Author:
Shadowriver
Posts: 3991


Hi,

I just tried this and i can't make it work. It works perfectly for one digit but i'm not sure how to connect it the the second one. I've tried connecting the output combiner of digit 1 to the microship of the second one but the second just won't work when i go from 9 to 0 ... Maybe i had the last step wrong. Could someone please help me with that?
2011-01-30 14:11:00

Author:
Stinkin Mushroom
Posts: 117


Ok thanks again to tdarb. He just showed me in the game what went wrong. i connected to first digit to the chip of the second one. what i had to do is connect it to the selector of he second one.2011-01-30 15:50:00

Author:
Stinkin Mushroom
Posts: 117


yeah, sorry about that. My directions weren't very clear on that. I've updated the original post to clarify it. Anyway, glad we got it working, and thanks for the help on those x2 levels. 2011-01-30 17:43:00

Author:
tdarb
Posts: 689


Thanks a lot! Easy to understand but very useful 2011-01-30 20:12:00

Author:
Unknown User


Just wanted you guys to know, I made a level that contains a new version of this

http://lbp.me/v/x94vgt

It is basically the same thing, but it doesn't go below 0 or over 9 on the highest chained number. so if you have a chain of four you can get up to 9999.

I will be updating the front post with info on the new logic tomorrow.
2011-01-31 08:38:00

Author:
tdarb
Posts: 689


Okay Ive done most of it, but when it comes to the second MC that contains the counters ORs and Combiner I cant seem to make it change the cycle on the second chip :S2011-01-31 11:30:00

Author:
xForrest
Posts: 72


sorry to be such a pain in the butt... but can you show pictures of where your suppose hook up the swithches to make this work? I cant figure it out... 2011-01-31 14:09:00

Author:
Unknown User


Is there a way to add the number of 2 counters together?
For example counter1 shows "4" and counter2 "5". If i add counter1 to counter2, counter1 should state "0" and counter2 "9".
If its to complicated to explain here, add me in the PSN
2011-01-31 16:35:00

Author:
Unknown User


sorry to be such a pain in the butt... but can you show pictures of where your suppose hook up the swithches to make this work? I cant figure it out...


Okay Ive done most of it, but when it comes to the second MC that contains the counters ORs and Combiner I cant seem to make it change the cycle on the second chip :S

sorry, I should have explained that better. On the old chip, say you have the number 52.

The 2 would have an input from you source through a direction combiner. Then the direction combiner on the chip would output to the input on the 5 (selector cycle input)

On the new chip on the level, there are 3 inputs/outputs. So the 2 would accept an input on the up down wire from a direction combiner like before, then its up down output would go to the 5's matching input. The 5's 0 and 9 toggle outputs would feed in to the 2.

I'll see if I can get some pictures in a few minutes to make it clearer.
2011-01-31 17:05:00

Author:
tdarb
Posts: 689


Is there a way to add the number of 2 counters together?
For example counter1 shows "4" and counter2 "5". If i add counter1 to counter2, counter1 should state "0" and counter2 "9".
If its to complicated to explain here, add me in the PSN

I am working on something like that, and it is juuuuust about ready. If you want, I will post pictures and do my best to explain it. It requires binary numbers to do, so it is a bit tough to explain without pictures and an example.
2011-01-31 17:08:00

Author:
tdarb
Posts: 689


I am working on something like that, and it is juuuuust about ready. If you want, I will post pictures and do my best to explain it. It requires binary numbers to do, so it is a bit tough to explain without pictures and an example.

That would be great! Although a Microchip would be enough I think ^^
2011-01-31 17:44:00

Author:
Unknown User


Hi
I'm pretty new at this LBP universe, but full of ideas and this counter is just what I need, thank you.
It works as it should but I can not get it to run (hold the + or - down and the counter runs up or down) as in "Scalable digital counter".
Can you please help me what do I do?
2011-02-07 21:57:00

Author:
Xlain
Posts: 3


This is the most compact it can get, yes? In terms of components. I had to move the components off the chip to take the pictures. How can I not have to do that?
I have a 0-6 microchip in the corner.

http://i1132.photobucket.com/albums/m570/toahero92/0to9and0to6microchip.gif
2011-04-21 18:21:00

Author:
Unknown User


LBPCentral Archive Statistics
Posts: 1077139    Threads: 69970    Members: 9661    Archive-Date: 2019-01-19

Datenschutz
Aus dem Archiv wurden alle persönlichen Daten wie Name, Anschrift, Email etc. - aber auch sämtliche Inhalte wie z.B. persönliche Nachrichten - entfernt.
Die Nutzung dieser Webseite erfolgt ohne Speicherung personenbezogener Daten. Es werden keinerlei Cookies, Logs, 3rd-Party-Plugins etc. verwendet.