basic stamp calculator
russell_chris08
Posts: 6
Design an embedded system to perform basic calculator functions such as add, multiply and subtratct. use seven segment display in your design.
Comments
I merged your threads into this one. It is against forum rules to post the same question in more than one forum. It will help if you can provide more details about your project, such as how the numbers need to be input and output. It this a school assignment?
In the post I just quoted (it looks like Tracy missed one he found it), you mentioned using a seven segment display. Do you have one in mind? Have you learned to display numbers on it with the Basic Stamp? How many digits do you plan to use?
As Tracy asked, how are you going to input numbers? Keypad, debug window, etc. Do you know how to program the Stamp to interface with the input device you plan to use?
Mike Green lists some good sources to learn how to use the BS2 here.
Here's an example of a calculator using the Propeller. It uses a PC keyboard for input and a NTSC monitor for output.
Can you formulate a BS2 CODE For a Calculator performing basic functions as add, subtract etc
I probably could but that will be the easy part. The input and display will likely take the most work.
It would help if you answered Tracy's questions and my questions.
Generally, the first step is to describe in detail what you want to accomplish ... on the level of "if this happens, then do that". The Stamp Reference Manual has all sorts of information. For this project, have a look at the DEBUG and DEBUGIN statements. These will get display information out and keyboard characters into the Stamp. Your 1st or 2nd job is to come up with examples of what you might type in and a description of what you want to happen when you do so. Also look at the descriptions of the SEROUT and SERIN statements since the debug statements are special cases of these. Also look at the appendix that describes the "formatters". Try some of the examples in the Manual on a real Stamp. Write some 2 or 3 line programs that just input something and output it again to see what happens.
So start writting and ask for help in parts you don't understand. Did you look at the pdfs in Mike's post I linked to?
Lot's of us do consulting and will write it for you as a paying job, but you generally don't get programs written for free. But people around here are generous with helping by answering questions and pointing people in the right direction (like Mike's list of Basic Stamp references).
I like the feel of button type keypads over membrane keypads. I used one of these 16 button keypads in my "Universe Remote".
I intend to use it to control the universe (right after I achieve world domination with my army of robots).
All the keypads I linked to have 16 buttons. You could use the non-numbered buttons for your functions (+-*/).
I just noticed erco's talking calculator (he must have posted it while I was typing this post). Very cool.
Integer math is simple to do on a BS2, especially if you only deal with positive numbers.
If I was using 7-segment displays on a 16 IO pin BASIC Stamp, I'd use THREE displays for ultimate simplicity and limit my max number display to 199. Two displays (for tens and ones) hook directly to 14 pins, the hundreds display uses one pin to drive both LED segments. That leaves one pin for your IR receiver and input. 100% pin utilization, and there's plenty of memory for your program.
Hmmm. I might just build this for fun myself. Let's see how you make out!
You should review Chapters 1 & 2 of "Robotics with the Boe-Bot" and Chapter 6 of "What's a Microcontroller". You'll find some basic concepts that might get you started.
Start small and build an app to use the debug terminal for input and output. When that works teach yourself to redirect output to the LED (or LCD... I personally prefer the LCD, but that's just me).
Get some code going and come back. Folks are a bit more receptive when you've shown some effort on your part.
@