Posted 17 February 2012 - 12:06 AM
Im trying to make a decoder for my binary adder that i made using a wiki page and redpower logic gates, i can make 1-9 but im a bit stuck when it comes to 10…
what i want is some clever piece of code that can instead of having every single number programed in (8bit adder, max is 510…) can know the numbers for 1 - 9 and when a number like 12 is inputted, it can output 1 and 2. also i need to figure out a binary to decimal decoder, wich shouldnt be that hard.
here is what i have so far…
this only works for 1-9 (well this only goes to 2)
basicly i need some sorta magic that says somthing like "1 == rs.setBundledOutput(X, e + f)"
and X can be set to diff sides for diff digits, then somthing like
11= 1, X=outside + 1, X=left
(this is were i got rly confused)
idealy a line of code that can look at the number 11 and see it needs two "1" 's instead of looking through a long list for the number 11, but thats better then doing all of the numbers indvidualy
many thanks in advance
what i want is some clever piece of code that can instead of having every single number programed in (8bit adder, max is 510…) can know the numbers for 1 - 9 and when a number like 12 is inputted, it can output 1 and 2. also i need to figure out a binary to decimal decoder, wich shouldnt be that hard.
here is what i have so far…
a = colors.white
b = colors.orange
c = colors.magenta
d = colors.lightBlue
e = colors.yellow
f = colors.lime
g = colors.pink
if input == "0 then
rs.setBundledOutput(outSide, a + b + c + d + e + f)
elseif input == "1" then
rs.setBundledOutput(outSide, e + f)
elseif input == "2" then
rs.setBundledOutput(outSide a + b + g + e + d)
....
(i got tierd at this point, you get the idea)
this only works for 1-9 (well this only goes to 2)
basicly i need some sorta magic that says somthing like "1 == rs.setBundledOutput(X, e + f)"
and X can be set to diff sides for diff digits, then somthing like
11= 1, X=outside + 1, X=left
(this is were i got rly confused)
idealy a line of code that can look at the number 11 and see it needs two "1" 's instead of looking through a long list for the number 11, but thats better then doing all of the numbers indvidualy
many thanks in advance