Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Simple Calculator

Status
Not open for further replies.

pianoman

New Member
Hey Everyone--

I've been interested in Digital Electronics all my life, and finally, in high school, I decided to take "Digital Electronics 101." It's pretty fun. I finished all the required curriculum by the end of the first semester, and basically I know just as much as our teacher at the moment.

Now to the project:

I want to design a simple 2 to 3 digit calculator capable of adding, subtracting, multiplying and dividing. It will use 7 segment displays. Here's the catch, I want to _only_ use and, or, nand, nor, xor, xnor gates (with the exception of memory registers). I've already designed a working binary to decimal converter for digits 0-100.

Can anyone offer any guidance?
 
I applaud your courage, for none but the brave
venture into the realm of DIY discrete calaculators.

**broken link removed**

and for the truly fearless, the schematics for
the Apollo guidance computer can be found on web.
 
Thanks for the link, seems interesting, but to be honest, some of those almost look _too_ complex. I would like to do everything from scratch. Maybe someone could explain the crucial parts of the calculator, what sections in a block diagram are absolutely necessary to make just a four function calculator?

Thanks for the prompt response!
 
pianoman said:
Thanks for the link, seems interesting, but to be honest, some of those almost look _too_ complex. I would like to do everything from scratch. Maybe someone could explain the crucial parts of the calculator, what sections in a block diagram are absolutely necessary to make just a four function calculator?

To make a four function calculator from logic gates is a MASSIVE undertaking - expect to use hundreds of chips, and probably thousands of dollars!. A PIC, costing just a couple of dollars, would replace all those chips, and probably give enhanced performance and functionality as well.


The old UK magazine 'Practical Electronics' did such a project many, many, years ago (1970's?) - it ran to something like 6 to 9 issues, with large sections of each dedicated to it. Unfortunately, during this long run, microprocessors became available - and 'cheap' handheld calculators hit the market - much more power, at only a tiny fraction of the cost.
 
The schematics do make for fascinating reading, but I have to agree with Nigel on this one , using a PIC will save a lot of hard work and provide a greater degree of flexibilty for say specialist functions.
 
Thanks for the insight.

I don't plan on actually building it, I want to just design the schematic and run the simulation. Perhaps if I simplified it all the way down to just adding two digit numbers? This is more of a proof of concept device for me, as opposed to a fully functional calculator.

I can't imagine it would be terribly difficult to construct a binary addator?

Once again, thank you for all of the well-thoughtout replies. I greatly appreciate it
 
Here's a good link, it even has a breadboard layout
**broken link removed**
 
Nice!

I have to design some sort of keypad that will output binary, that's my next task.

Things that are done:
4 bit adder
4 bit binary to decimal converter

Things that need to be done:
keypad/numeric entry device
...whatever else I'm missing.
 
Does anyone have a keypad schematic? That, for example, when 9 is pressed outputs 1001? or when 1 is pressed 0001, you guys are all bright, you know my intentions... Any guidance?
 
Keypad lol ,

Back in the bad old days it was done with
thumbwheel switches if you could afford them.
Failing that a rotary switch and a whole mess
of diodes. Though perhaps an up/down counter
might be a less painfull way of doing things.
 
pianoman said:
Does anyone have a keypad schematic? That, for example, when 9 is pressed outputs 1001? or when 1 is pressed 0001, you guys are all bright, you know my intentions... Any guidance?
A keypad decoding logic circuit is also a pretty complicated combinational circuit, and even more when you have to implement debouncing. Keypads columns are "polled" repeatedly, and when a key is pressed, the poll returns a positive result which would reflect the row. This is then repeated for a couple more times for debouncing. Well, slightly more tedious, but I guess still doable using state machines.

It's good that you are interested in logic circuit. But it's high time to move on to microcontrollers.
 
Well I'm also designing a robot for my school using a basicstamp. But I'm what you could call a visual learner. For example, if everyone really said "you're nuts kid, just use a microcontroller and build the damn calculator", I'd say "who has a schematic for the internals to a basic microcontroller chip" :lol: ...that's just how I am.

On that topic, any recommendations for good starter microcontrollers, and anything necessary to program them. Additionally, a block diagram of what actually makes a microcontroller work.
 
If you're really interested in how exactly a microcontroller works here's a site with source code in a hardware description language for an 8051 processor. It's in VHDL which takes a bit of getting used to but if you really want to get down to nuts and bolts of processors its a good thing to know.

If you want to fiddle around with digital circuits you can download Xilinx' ISE Webpack which is free software for designing and simulating digital logic for Xilinx' programmable logic chips. You just build schematics with gates and flipflops or use a Hardware design language (VHDL or Verilog).
 
bmcculla said:
If you're really interested in how exactly a microcontroller works here's a site with source code in a hardware description language for an 8051 processor.
--snip--

Maybe I missed it, but what site?
 
www.opencore.org I guess.

They are the open-source equivalent of hardware, essentially HDL codes that could be synthesized to gate-level RTL. But I'd like to advise you that microcontrollers nowadays comes in 100Ks of gates, not something that any sane person would attempt, and I doubt any insane person can fully achieve. Even a simple n-bit multiplier needs n^2 gates in general. So a standard 8-bit multiplier will need ... hmm ... 256 gates.

In summary, engineers are plain lazy people. They take the easiest way out. Hope you get the idea. Nowadays, people could hardly keep up with technology. To fully master them at the same time is really quite a fairytale.
 
pianoman said:
Additionally, a block diagram of what actually makes a microcontroller work.

For educational purposes why not start with look at the smallest of the building blocks, the transistor. The website of HP Friedrich's has some remarkable photographs, he is better known for his astonishing home made vacuum tubes, but of late has been experimenting with semiconductors and has managed to build his own transistors.
**broken link removed**
(warning - big page , lots of pics , be patient)
 
I carefully found the site and then forgot to paste it in :oops: .

Here it is: http://www.oregano.at/ip/8051.htm


If you want to play with real digital logic learning a Hardware Description Language is the only way to go. Verilog uses C like syntax and is supposedly fairly easy to learn. I use VHDL with is based on ADA, which isn't a popular language, but VHDL has more features than Verilog.

With a HDL the 100K gates boil down to a couple thousand lines of code.

The Xilinx software has a nice feature that lets you type in VHDL code and generate a schematic. You can use this this feature to see what sort of gates your code is generating.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top