Ok, so I've been experimenting a bit with a personal idea on how to make a toggleable add/subtract function, with out going the traditional route of inverting half of the inputs on a full adder to make the subtractor. I know that particular solution functions, but it's not what I'm going for. It may not (actually, it's probably not) be the most efficient way of doing it, but I'm using it as a personal exercise in redstone.
Apparently it won't let me post the picture directly for some reason, so take the link.
I have a 3 bit adder set up(left), and opposite it, a 3 bit subtractor (basically a 3-bit adder with only the outputs inverted, on right), and I'm using a JK Flip Flop to toggle between the two (center). Unless it's necessary to create the intended result, you can go ahead and ignore the ugly bit of wiring in the center, it's just bringing the two arithmetic units into a unified output (which possibly may be my problem right there, we'll see). The JKFF triggers the set of pistons on either side, toggling between which input is used.
My question is this. How can I add a number using the adder, store that number, and then switch to and use the subtractor to subtract from the stored number? Any ideas and help would be appreciated. Once I can get this part figured out, I'll hook it up to a couple of decoders and a 7-seg display.
Thanks for the help and I hope I made sense.
Rollback Post to RevisionRollBack
If I've helped in any way, or made some sort of constructive comment, there's a little green plus sign in the bottom right corner of the post. Click it to let me know!
Simply just hook up the outputs of the adder to a 3-bit RAM module (3 RS-NOR latches or 3 D-flip-flops). Then you want to hook the output of the RAM back to the input of the subtractor. :smile.gif:
You need to wire the output to D-flip flops. You have to make them save when you know the operation is complete. The output of these D-flip flops should be wired as input in your adder, along with the user input.
If I've helped in any way, or made some sort of constructive comment, there's a little green plus sign in the bottom right corner of the post. Click it to let me know!
http://imageshack.us/photo/my-images/535/calculatoru.jpg/
Apparently it won't let me post the picture directly for some reason, so take the link.
I have a 3 bit adder set up(left), and opposite it, a 3 bit subtractor (basically a 3-bit adder with only the outputs inverted, on right), and I'm using a JK Flip Flop to toggle between the two (center). Unless it's necessary to create the intended result, you can go ahead and ignore the ugly bit of wiring in the center, it's just bringing the two arithmetic units into a unified output (which possibly may be my problem right there, we'll see). The JKFF triggers the set of pistons on either side, toggling between which input is used.
My question is this. How can I add a number using the adder, store that number, and then switch to and use the subtractor to subtract from the stored number? Any ideas and help would be appreciated. Once I can get this part figured out, I'll hook it up to a couple of decoders and a 7-seg display.
Thanks for the help and I hope I made sense.