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

Divide/Modulo

Archive: 5 posts


Hello there!
I'm working on a HP-Display with Digits.

And I just wanted to know if it's possible to divide a number by 10/100/1000/10000
and find the rest (modulo)?

If I'm correct,my HP-Digits should work then...
2011-03-01 09:46:00

Author:
Unknown User


I presume you're using a timer for analog logic for your HP (If you're using digital, do a search for "double dabble"). The normal way to divide an analog signal is with a timer, but unfortunately timers are buggy in setting the duration, so you can't get an exact division by 10, 100, 1000 or 10000. (Though you can get a division by 20, then double it; but you'd need to chain that.)

But what you can do is create a 5 stripe sequencer with 9 batteries, set at 10%, 20%, 30%, 40%, 50%, etc, placed on the appropriate part of the sequencer, and set the input to positional. Subtract the battery output from the sequencer from the signal, then multiply the result by 10. You can chain several of these together for 5 digits of display. You'll end up with 1 frame of latency for each digit though, and the numbers will bounce around every time it changes.
2011-03-01 10:12:00

Author:
Tygers
Posts: 114


are you using analog signals, BCDs, or pure binary to do your math?

When you say "divide a number by 1/10", I assume you mean to take 1/10 of a number. They give two completely different results.
2011-03-01 10:22:00

Author:
tdarb
Posts: 689


I'm using a very own method to calculate the HP...
A Decimal-system,i dunno if it works...

Oh,I just got an error of my thought.
I wanted to use a XOR-Gate to get the input for the Divison.
But if I use one of the gates,the Result will always be "1",won't it?
I just had this idea.

e.g. If the battery is on 66%.
The battery is linked to an XOR.
Is the XOR-Output 66,too?

@tdarb:
I just want to split a decimal.
My idea was to use mod and division to get the correct number.
2011-03-01 10:39:00

Author:
Unknown User


Unless you do something very odd, your "own method" will still fall into the category of analog, BCD or pure binary. However since you're worried about gates changing the value to 1, I am going to assume you are using analog signals.

Furthermore, I'm going to assume that you haven't read rtm's blog on analog logic, as he covers the effects of gates on the value of signals, as well as how to work with them in general. I highly recommend it. That aside, it's best not to use XOR on non-digital signals unless you know what you're doing, but the other gates are fine. And probably more appropriate for your use anyway.
2011-03-01 10:54:00

Author:
Tygers
Posts: 114


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.