Shop OBEX P1 Docs P2 Docs Learn Events
basic stamp calculator — Parallax Forums

basic stamp calculator

russell_chris08russell_chris08 Posts: 6
edited 2012-12-06 21:52 in BASIC Stamp
Design an embedded system to perform basic calculator functions such as add, multiply and subtratct. use seven segment display in your design.

Comments

  • russell_chris08russell_chris08 Posts: 6
    edited 2012-12-03 23:10
    I need help designing a program in which will perform calculator functions such as add, subtract, etc
  • russell_chris08russell_chris08 Posts: 6
    edited 2012-12-03 23:16
    i need help designing a calcuator
  • Tracy AllenTracy Allen Posts: 6,662
    edited 2012-12-03 23:32
    Hi Russell,

    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?
  • Duane DegnDuane Degn Posts: 10,588
    edited 2012-12-03 23:53
    Design an embedded system to perform basic calculator functions such as add, multiply and subtratct. use seven segment display in your design.

    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.
  • russell_chris08russell_chris08 Posts: 6
    edited 2012-12-04 12:35
    Duane Degn wrote: »
    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
  • Duane DegnDuane Degn Posts: 10,588
    edited 2012-12-04 13:33
    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.
  • russell_chris08russell_chris08 Posts: 6
    edited 2012-12-04 15:58
    Duane Degn wrote: »
    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.
    Debug Window and no i don't know how to program stamp to INTERFACE
  • Mike GreenMike Green Posts: 23,101
    edited 2012-12-04 16:04
    We cannot do your school project for you. We can answer specific questions and make general suggestions as well as point you to resources.

    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.
  • russell_chris08russell_chris08 Posts: 6
    edited 2012-12-04 23:41
    i just need help writing a stamp code that will function a basic calculator
  • Duane DegnDuane Degn Posts: 10,588
    edited 2012-12-05 05:22
    i just need help writing a stamp code that will function a basic calculator

    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).
  • ercoerco Posts: 20,256
    edited 2012-12-06 09:13
    It's actually quite a nice learning experience to program a calculator. Reading the digits during number entry, shifting left, multiplying by ten, it's all good for the soul. Here's a talking calculator I did recently.
  • Duane DegnDuane Degn Posts: 10,588
    edited 2012-12-06 09:22
    While using the BS2's debug window would probably be the easiest route, if you wanted a self contained calculator you could use a serial LCD and a keypad like this one from Parallax. You can also find keypads other places on the internet for bit cheaper (but the quality might not be as good). MPJA also sells a membrane type keypad.

    I like the feel of button type keypads over membrane keypads. I used one of these 16 button keypads in my "Universe Remote".

    UniverseRemote.jpg


    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.
    427 x 516 - 79K
  • ercoerco Posts: 20,256
    edited 2012-12-06 09:25
    If I were using a BASIC Stamp to make a calculator, I might consider using a TV remote as a keyboard to enter the numbers. That's easier hardware wise and just barely harder software wise, just a single IR receiver to wire into the Stamp, on one IO pin.

    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!
  • ajwardajward Posts: 1,130
    edited 2012-12-06 21:52
    i just need help writing a stamp code that will function a basic calculator

    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.

    @
Sign In or Register to comment.