Logic Calculator

Thread Starter

MSA

Joined Jun 8, 2007
9
I am trying to implement a calculator which takes input via keypad or any other way like switches etc decode it into binary numbers via decoder ic perform airthmetic calculations(add,sub,mul and division only) and display the result on either 7 segments or on LCD.
but so far what i hav is idea of how it should be and not any thory articles related to it and idea of how to implement it.
i want to take input in decimal form ,from 0-9 calculate it and display the result which i may restrict to 2 digits(less than 100).

i hope u will understand what i said and will try to help me to solve this...
 

Papabravo

Joined Feb 24, 2006
21,159
Your only chance of accomplishing this task in reasonable time is to use a micro controller. There are many online articles and tutorials that explain how to interface a keypad and a display. Addition and subtraction are straightforward operations, but multiply and divide are a bit harder. You may want to study these algorithms before committing to an approach.
 

Thread Starter

MSA

Joined Jun 8, 2007
9
thanks
well so far i am not able to find the articles and tutorial of additiona nd subtraction if u can provide this it will surely be helpfull. as far as my little knowledge say multiplication is related to addition and division is to subtraction using xor and xnor gate...
N E ways if u provide me the tutorials of addition and subtractrion it will solve half of my problems,
thanks
 

Papabravo

Joined Feb 24, 2006
21,159
Addition is done with a combinatorial boolean circuit called a full adder. It can be any length you desire. The longer the the length the more time it takes for the carry to propagate. Subraction is done by taking the 2's complement of one of the operands, then adding.

In a microcontroller there are individual instructions which do addition and subtraction. Multiplication involves shifting and addition, while division involves shifting and subtraction.
 

Thread Starter

MSA

Joined Jun 8, 2007
9
yes u r right
but we r restricted to not use mcu neither interfacing so all we hav to do is using gates,encoders,7 segments ..that's where the problem is i mean i cann't find any thing on this..
plz provideme some data...
 

beenthere

Joined Apr 20, 2004
15,819
Is this a paper exersize, or do you have to actually construct it? If you have to build it, what logic family do you have to use? There are logic IC's that will be helpful, like full adders and shift registers, for instance.

The previous posts from Papabravo have set out the principles of how the arithmetic functions are performed, but it's a long way from that to actually entering the numbers and doing the functions.

Four banger calculators are so cheap that nobody ever thinks of actually duplicating their functions. You might grab a logic template and start to draw up some circuitry...
 

bloguetronica

Joined Apr 27, 2007
1,541
You could make a "4 bit series" alu from a pic. You would use two buses, one for the data (input operands digit by digit) and one for the instruction. Then you would use two registers to compose the operands. That's what I have in mind, but I think it is very complicate to implement and not a good solution at all.
 

Thread Starter

MSA

Joined Jun 8, 2007
9
well i have said earlier that i am not allowed to use PIC,MCU,interfacing and alll i have to use is gates,decoders,7 segments,adder,subtracter ic.....

the main problem i hav is how to implement is i mean as i said earlier i hav only outline and not any material for this neither i find it on gogle...

so keeping in mind that i only have to use IC's plz suggest me some good material and if a sample circuit it would be helpfulll
 

Thread Starter

MSA

Joined Jun 8, 2007
9
well hav a look at it...
i found this it takes input through 4 hexadecimal switches...and perform calculation (no divison) but the problem is this is only ckt diagram i mean no data at all even i don't know the ic numbers to view their data sheet...
but i am sure it will help u undertand what i am trying to say remember as in the figure the input is through "HEXADECIMAL" switches but i also want this to be decimal..

i hope this will help u solving my problem
 

Attachments

Thread Starter

MSA

Joined Jun 8, 2007
9
well it doestn't matter much if u cann't se the pic...
what i want is to give u an idea that in this there is no microcontroler and thing like that ..... jus ic's..so this is just an example..
well the problem was the picture is of higher resolution and i had to shrink it to attach here..

so plz any data or material...
time is runnning out
 

thingmaker3

Joined May 16, 2005
5,083
Try looking up individual functions (add, subtract, multiply, divide, convert). You can then combine the individual functions into a calculator. Start searching now! Time is running out!
 

Thread Starter

MSA

Joined Jun 8, 2007
9
well too funny....
i hav searched a lot dear but cann't find any thing ...
and this is what i was saying that if u find any thing related to it then plz share it with me...
 

Papabravo

Joined Feb 24, 2006
21,159
well it doestn't matter much if u cann't se the pic...
what i want is to give u an idea that in this there is no microcontroler and thing like that ..... jus ic's..so this is just an example..
well the problem was the picture is of higher resolution and i had to shrink it to attach here..

so plz any data or material...
time is runnning out
If we could see what was in the picture we might be able to help. For all I know those could be ROM chips programmed with the required function, or PALs with logic under the hood so to speak. I don't know if that would be cheating according to your requirements, but those blocks sure didn't look like "gates" to me.

You seem to think we just have that stuff laying around when in reality nobody has done that kind of design for a very long time, like decades, because we don't have to anymore. The only people who might have that stuff laying are ASIC designers and processor designers, but those guys work for companies where security is really tight and I doubt they could get that stuff out even if they wanted to.

A one bit Full Adder is a combinatorial circuit with three inputs and two outputs. The inputs are a bit from operand A, a bit from operand B, and the carry In. The outputs are the sum digit and the carry out. Here is the truth table
Rich (BB code):
A B Ci | S Co
0 0 0  | 0 0
0 0 1  | 1 0
0 1 0  | 1 0
0 1 1  | 0 1
1 0 0  | 1 0
1 0 1  | 0 1
1 1 0  | 0 1
1 1 1  | 1 1
This gets you binary addition to however many bits you want. I've never seen a combinatorial circuit for a decimal adder but in principal it could be worked out. After all the ENIAC had a decimal adder.
 

Thread Starter

MSA

Joined Jun 8, 2007
9
well thanks 4 u response
i have an idea plz tell me keeping this in reference....
"i have let say 4 switches each for mul,division,addition and sub...i press at the start what type of operation i want....then through 2 different keypad i enter 2 different number and then press eneter let say i have to perform addition those 2 number in the form of binary(i don't exactly know that in what system the number will be after preeseng from keypad)goes to binary adders perform addition and then through 7 segment driver it display the result"

Now few areas where i have not clear my concept...
1)if i use 4 bit adders then the maximum first number will be 15 .... then what should be for no's above 15
2)when i enter first number then at that tyme the second number will be zero and 7 segment will show the answer...(i may restrict it using switch by breaking the circuit till both the numbers added but is it really work...?)
3)what will be the procedure for mul and division...

i thing this might help you understanding my point
 

Papabravo

Joined Feb 24, 2006
21,159
So if we assume two eight bit operands then they can be represented by four hexadecimal digits concantenated together in a sixteen bit shift register. Then you make an 8-bit adder from two 4-bit adders. The operands from the shift registers go to the inputs of the adder. Each time a key is pressed each of the four digits moves to the left by one position and the new key enters the lowest position. The leftmost digit falls of the edge of the earth so to speak. If you make a mistake then you just renter the four digits that you want. The results are continuously computed as keys are entered.
 

Deleted member 166695

Joined Dec 31, 1969
0
Hey, go buy a calculator IC, add a keyboard and a numerical readout, and you have it. That is where today's technology is, if you stop short of a simple uComputer chip solution. You could build it out of transistors and resistors, simple and and or gates, out of more complex chips like adders and multiplexers, or go with the calculator IC or uComputer. First you have to decide at what level of complexity you want to design it, and then go for it. Frankly, I would find someone that has multisim, and design and test a one digit by one digit calculator, then discuss how this can be extrapolated to n x n digits. i.e., this simple calculator could handle base ten numbers of 9 x 9, with a maximum output of 81 base ten for multiplication. The division could be a single digit by a single digit too, and just have a two digit readout - the same readout, with a fixed point readout of n.n . i.e., the maximum and minimum numbers in division would be 9.0 and 0.1 . Like I say, once you have simulated this tiny calculator, you can discuss how it can be expanded (extrapolated) to do larger numbers. Of course, if you get into floating point, etc., it gets way complicated without doing it with a uComputer.
 
Top