Shop OBEX P1 Docs P2 Docs Learn Events
basic stamp not good enough for calculator in class? — Parallax Forums

basic stamp not good enough for calculator in class?

ohVaNiLLaGoRiLLaohVaNiLLaGoRiLLa Posts: 33
edited 2013-04-29 16:43 in General Discussion
While this isn't a technical question I would still like to see peoples opinions. I am in a digit design class and my teacher wants us to build an 8 bit calculator out of ttl chips that can add and subtract. But he said if you want a micro controller to do it with you can but it also has to multiply and divide. So I asked him if I could use my basic stamp to do this project with and he said no because he wouldn't like to see me programming in basic. The micro controllers he gave out are some cheap freescale micro controllers that are programmed in some off version of C++. Whats your opinion on this?
«1

Comments

  • davejamesdavejames Posts: 4,047
    edited 2013-04-22 11:17
    My opinion?...out of curiosity, I'd ask why the dislike for BASIC-variants, and then I'd use the tool/board/micro provided in class.

    There are much larger battles to fight...
  • ohVaNiLLaGoRiLLaohVaNiLLaGoRiLLa Posts: 33
    edited 2013-04-22 11:27
    indeed there are but i was just curious as to see if basic was taken as a joke to other languages?
  • Heater.Heater. Posts: 21,230
    edited 2013-04-22 11:33
    I think you would gain a lot of useful experience building the thing out of TTL. Unless you have done that sort of thing before.

    Adding mul and div to a microcontoller based version does not exactly add anything to the complexity of the challenge if you are allowed to program it in C or BASIC or such. If you have a micro with no mul/div instructions then there is a nice challenge in implementing those in assembly language.

    How sophisticated does the user interface have to be. Is he expecting seven segment displays and a keyboard matrix or would a bunch of swithes and LEDs do?

    I think a good old mechainical rotary telephone dial would be great for this.
  • AleAle Posts: 2,363
    edited 2013-04-22 11:40
    I have been in a similar position several times, where I want to do something my way and teachers want they way... once they said "look what he did, what could we possibly teach him (that he already doesn't know ?". Others got angry and gave me bad grades...
    My advice, use what they give you. Why: you are familiar with the basic samp, great, then use your knowledge and apply it to a new target. After the class you know the basic stamp and one of those freescale microcontrollers. As davejames said, there are bigger and more important things in life and everything you learn today will help you tomorrow. Teachers don't like to be brought out of their comfort zone, so-to-say, if one student brings chaos the others can follow and everything he wants to teach will not be achieved :(. C++ is quite useful, learning it can land you a job :) If they are HC08 or similar they have decimal adjust after addition.. you could use BCD arithmetic instead of binary :), look at the math page below :).
  • AleAle Posts: 2,363
    edited 2013-04-22 11:40
    I have been in a similar position several times, where I want to do something my way and teachers want they way... once they said "look what he did, what could we possibly teach him (that he already doesn't know ?". Others got angry and gave me bad grades...
    My advice, use what they give you. Why: you are familiar with the basic samp, great, then use your knowledge and apply it to a new target. After the class you know the basic stamp and one of those freescale microcontrollers. As davejames said, there are bigger and more important things in life and everything you learn today will help you tomorrow. Teachers don't like to be brought out of their comfort zone, so-to-say, if one student brings chaos the others can follow and everything he wants to teach will not be achieved :(. C++ is quite useful, learning it can land you a job :) If they are HC08 or similar they have decimal adjust after addition.. you could use BCD arithmetic instead of binary :), look at the math page below :).
  • Heater.Heater. Posts: 21,230
    edited 2013-04-22 11:41
    ohVaNiLLaGoRiLLa,
    i was just curious as to see if basic was taken as a joke to other languages?
    Fear not, a lot of the best programmers of the recent decades started out with BASIC on 8 bit machines when they were kids. Of course they soon learned to move to assembler when they wanted to get anything interesting done in those small memory spaces.

    Like them BASIC grew up into Visual BASIC and such. Far more sophisticated than its 8 BIT roots.

    Still, if you want a simple, widely used, yet more sophisticated language without the shackles of running on Windows now a days we have such fine things as Python, Perl, JavaScript, Ruby.

    Back in MCU land it's C/C++ for me. And Spin on the Propeller of course.
  • CuriousOneCuriousOne Posts: 931
    edited 2013-04-22 11:56
    Actually, doing whole calculator (keyboard input, display unit, etc.) in TTL logic is way too complex than using either basic stamp or whatsoever. Not every student will be able to do it.
  • AleAle Posts: 2,363
    edited 2013-04-22 12:06
    I got two double posts in a row, what is wrong with chrome today ! :( ?
  • Heater.Heater. Posts: 21,230
    edited 2013-04-22 12:08
    It's not just Chrome, double posting. It's all over the place. The forum is seriously wonky recently. Thae admins are aware of the issue.
  • Mike GreenMike Green Posts: 23,101
    edited 2013-04-22 12:17
    @Ale, nothing wrong with Chrome. Something is wrong with Parallax's forums. This happens with a variety of browsers.

    @ohVaNiLLaGoRiLLa, I think the instructor just wants you to use a particular microcontroller (the Freescale one) and a particular development toolset (C++) or do the whole thing in TTL logic. Sure, doing it with a Stamp and PBasic would be simpler and more straightforward, but this is a class and the instructor has a particular set of goals for you to learn.
  • Mike GreenMike Green Posts: 23,101
    edited 2013-04-22 12:17
    @Ale, nothing wrong with Chrome. Something is wrong with Parallax's forums. This happens with a variety of browsers.

    @ohVaNiLLaGoRiLLa, I think the instructor just wants you to use a particular microcontroller (the Freescale one) and a particular development toolset (C++) or do the whole thing in TTL logic. Sure, doing it with a Stamp and PBasic would be simpler and more straightforward, but this is a class and the instructor has a particular set of goals for you to learn.
  • Heater.Heater. Posts: 21,230
    edited 2013-04-22 12:18
    CuriousOne,

    That's why I asked about the expected complexity of the thing.

    To my mind an 8 bit calculator could be just 8 switches for 8 bit binary input operand A. Another 8 for operand B. A switch for plus or minus and a couple of seven segment LED digits for output via a binary to segment decoder. Now do you use NAND gates to build your arithmetic unit or a couple of 4 bit ALU's? The latter is cheating in this case:)

    After that the sky is the limit. Back in the 70s a British hobby electronics mag published a design for a multi-digit TTL calculator with mul and div. Also sqrt I believe. There were 12 parts to the story over a year. It required a dozen or so PCBs and hundreds of chips. I guess no boody apart from the author built that design.
  • CuriousOneCuriousOne Posts: 931
    edited 2013-04-22 12:30
    The double posting issue is also here with IE10, but it can be avoided. When I press "post quick reply", a window appears, whenever I want to leave or stay on page. If I choose leave, everything will be OK. If I choose stay - post will be added but it will be like I haven't added it, so I'll click "post quick reply" again and did another dupe. Regarding the calculator on bare TTL logic ICs, without ALU, BCD to DEC, flip-flops or shift registers, I liked that task, so did a little sketch-up for myself, it appears that at least 200 DIP-14 cases will be needed for that task.
  • AleAle Posts: 2,363
    edited 2013-04-22 12:51
    I read somewhere else that those '181 ALUs are really hard to come by these days, of course a 32 macrocell CPLD can do the task very well :)... He actually said "ttl logic" and not "only nand/or gates" or so... if you can choose, then a couple shift registers and a 1 bit serial bus could simplify the task...
  • kwinnkwinn Posts: 8,697
    edited 2013-04-22 12:56
    CuriousOne wrote: »
    The double posting issue is also here with IE10, but it can be avoided. When I press "post quick reply", a window appears, whenever I want to leave or stay on page. If I choose leave, everything will be OK. If I choose stay - post will be added but it will be like I haven't added it, so I'll click "post quick reply" again and did another dupe. Regarding the calculator on bare TTL logic ICs, without ALU, BCD to DEC, flip-flops or shift registers, I liked that task, so did a little sketch-up for myself, it appears that at least 200 DIP-14 cases will be needed for that task.

    200 dip IC's are not required for an 8 bit binary add/subtact calculator. Two 74181 chips and 3 or 4 8 position dip switches would do the job. Leds to show input and output data would be a nice addition.

    As to why he would want you to use TTL chips or a micro that has to be programmed in C or assembly language, that is done to give you an understanding of how math is done at the most basic level of any computer.
  • kwinnkwinn Posts: 8,697
    edited 2013-04-22 12:56
    CuriousOne wrote: »
    The double posting issue is also here with IE10, but it can be avoided. When I press "post quick reply", a window appears, whenever I want to leave or stay on page. If I choose leave, everything will be OK. If I choose stay - post will be added but it will be like I haven't added it, so I'll click "post quick reply" again and did another dupe. Regarding the calculator on bare TTL logic ICs, without ALU, BCD to DEC, flip-flops or shift registers, I liked that task, so did a little sketch-up for myself, it appears that at least 200 DIP-14 cases will be needed for that task.

    200 dip IC's are not required for an 8 bit binary add/subtact calculator. Two 74181 chips and 3 or 4 8 position dip switches would do the job. Leds to show input and output data would be a nice addition.

    As to why he would want you to use TTL chips or a micro that has to be programmed in C or assembly language, that is done to give you an understanding of how math is done at the most basic level of any computer.
  • CuriousOneCuriousOne Posts: 931
    edited 2013-04-22 13:20
    yes, you are right. I havent read original post in details, so I thought that it was requested to do a normal calculator, with keyboard, VFD's and so on. This is why I was amazed with complexity of the task:-)
  • AleAle Posts: 2,363
    edited 2013-04-22 13:57
    I just looked at digikey and they seem to have some stock of 74LS181 at 5.9 Euro plus VAT plus s/h...
  • david314david314 Posts: 6
    edited 2013-04-22 14:00
    Our teachers did similar stuff like teaching Assembler on a virtual processor (*sigh*). Anyway, just do as he says, you are normally better off :) And there is nothing wrong of being able to use C/C++. Otherwise you wouldn't know how to appreciate better languages ;) BTW: Ale, look into your Notifications, please.
  • Heater.Heater. Posts: 21,230
    edited 2013-04-22 14:40
    I think you should forget the TTL and MCU's and build the thing out of wood.

    Matthias Wandel, demonstrates a six bit binary adder made of wood here: http://www.youtube.com/watch?v=GcDshWmhF4A

    You will get full marks for extending it to 8 bits and implementing subtraction:)
  • jmgjmg Posts: 15,189
    edited 2013-04-22 16:06
    So I asked him if I could use my basic stamp to do this project with and he said no because he wouldn't like to see me programming in basic. The micro controllers he gave out are some cheap freescale micro controllers that are programmed in some off version of C++. Whats your opinion on this?

    Basic is still perfectly valid tool in the toolbox, but why not do it two ways ?

    The teacher knows what he hands out, so can grade those more easily, but you could easily do both a Stamp., and a Freescale one, and then contrast Code Size / Speed / Precision
    Building something is relatively easy, the real polish come from knowing if it is optimal, and the trade offs.
  • kwinnkwinn Posts: 8,697
    edited 2013-04-22 22:35
    Ale wrote: »
    I just looked at digikey and they seem to have some stock of 74LS181 at 5.9 Euro plus VAT plus s/h...

    They are hard to find but also available in Canada for about $7.00. Probably a few cents less in the US. That's a bit of history slowly disappearing from the marketplace. That chip was the heart of a large number of minicomputers and the embedded controllers/computers in many of the instruments I serviced.
  • whickerwhicker Posts: 749
    edited 2013-04-22 22:37
    For the teacher, I don't think it's necessarily fear of going out of a comfort zone.
    It's about having the student stay inside a boundary in order to learn something fundamental.

    I personally would feel no shame or sympathy outright failing someone for using a basic stamp in a digital design class.
    Wow, it's great that you can use an existing tool. We all do every day.
    But if you're truly there to learn about digital design, what is there to design when you have a presoldered module that can already do symbolic math and perform I/O?

    There is also the practical aspect of it as well: the physical process of laying out and plugging in chips, stripping wire, going from a schematic to a functioning circuit (or just going on the fly by memory and intuition from a strewn about pages of TTL chip pinouts, then drawing the final circuit when it's all done :) ). Doing all of that, and it's not just a "rubber stamp" degree. You earn it, you learned a new skill.

    Just wait until the circuits get complicated. All the silly mistakes (forgetting to power chips, wires shorting, wires stripped too short and falling out) can get discovered when making simple circuits like this basic adder. It's also a situation where you can learn to use a logic probe and contrast what is supposed to happen versus what is happening.

    When starting so simple, I love how when the difficulty ramps up, suddenly the short-cutters are at a total loss because they never learned the basics. Just get done with their circuit, power on, and no response (not even smoke and heat). NOW WHAT?

    That's kind of what I think a large part of education is: obviously solving problems other people already have solved, but in an environment that encourages (or forces) the learning of efficient processes and skills pertaining to how those problems were solved.
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2013-04-23 03:19
    There are several dimensions to the issue.

    A. Learning to deal with maths in a high level language versus doing so in Assembler.
    B. The problem of BasicStamps only supporting integer maths
    C. The perception that C or C++ is an adequate level of programming skill for employment

    I think you would be better off just using a PIC16F57 and assembly language... as you would learn more. Yes, you would be using the same microcontroller that the BasicStamp 1 has, but you would be addressing the issues involved in A, B, and C as a real developer would.

    There are a ton of fancy microcontrollers out there with fancier language support, but dealing with low level programing and limited resources are going to provide you with more insights that opting for the easiest way out.

    BTW, using Forth on a Propeller would be an extremely easy option.. but you would also learn very little. Writing a calculator in C has been done, and it provided as a complete example in "The Unix Programming Environment" by Kernighan and Pike, 1984.

    An all TTL solution can be found in "Digital Fundamentals: Seventh Edition" by Floyd, 2000.
  • Heater.Heater. Posts: 21,230
    edited 2013-04-23 03:38
    Loopy,

    Yes. Had you numbered your options there I would add:

    0. Learning to do arithmetic with only logic gates, AND, OR, XOR, NOT. vs using a ready made CPU or ALU to do it.

    of course then there is:

    -1. Learning to build logic gates when you only have transistors, or vacuum tubes or relays or bits of wood (see above).

    Which leads to:

    -2, Learning to build transistors out of..., well whatever, you get the idea.

    There is a lifetimes worth of study bound up in this little 8 bit calculator problem.
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2013-04-23 04:06
    @Heater
    Yes, Item 0 was an oversight, but the role of Assembler and TTL logic are very similar.

    The rest is a bit pedantic and argumentative.
  • Heater.Heater. Posts: 21,230
    edited 2013-04-23 04:54
    Loopy,

    "Pedantic and argumentative". Me? Never. Not my intention here anyway.

    I'm just cruising around the topic of conversation which was about what level of abstraction the posters exercise is aimed at. There is a whole course at Berkeley taking you through all these layers of abstraction from transistors to gates, ALU's, CPU, caches, instruction decoding, the whole MIPS computer architecture, assembler to C. About 30 hours of videos on YouTube. I think it's interesting to cross these abstraction barriers occasionally.
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2013-04-23 06:18
    I guess my blood pressue is creeping up from too many lattes.

    My impression is the original poster either doesn't undertand what the teacher wants to teach, or is trying to negotiate the easiest way to complete the assignment. On the other hand, the teacher may not have a good idea what the focus of the extercise is.

    I presume it is to demonstrate binary addtion, subtraction, multiplication, and division with real electronic devices. If that is the case, using any language other than assembler is going to cloud the issue.

    I was just trying to encourage the student to tackle the problem in a pro-active way... choose an alternative that will provide useful knowledge.

    I gave up on teaching English in the Taiwan university system as my students were constantly trying to negotiate down the work load and to negoiate up their grades. Not much was getting done and they treated all the foreign English teachers as easy to manipulate. Either you are taking the class to really advance your knowledge or you are taking the class to just be processed as a university graduate. The second choice is rather tragic as employers really only want the top of the class.

    Your wooden device is only an adder and that is only 50% of the project... binary subtraction is required as well. Clever, but not enough.
  • Heater.Heater. Posts: 21,230
    edited 2013-04-23 07:35
    You are right, the goal is not well defined. If the teacher says build a TTL "thing" whatever it is but then says "It's OK to not do that, just write a program" then we really don't know the point of the exercise.

    That is why I threw in the wooden adder idea. It was not a serious suggestion although in my younger days I might have been tempted to do it. After all we did build a binary counter using 1 meter long pneumatic RAMs and spool valves in tech school.

    I did say implementing subtraction was an exercise. Still getting that to work might teach you as much about doing arithmetic with logic as designing a TTL version.
  • PublisonPublison Posts: 12,366
    edited 2013-04-23 11:01
    kwinn wrote: »
    They are hard to find but also available in Canada for about $7.00. Probably a few cents less in the US. That's a bit of history slowly disappearing from the marketplace. That chip was the heart of a large number of minicomputers and the embedded controllers/computers in many of the instruments I serviced.

    At least 7 available in the US. :) NOS Date Code 7352. Think I have another tube of 16 somewhere..

    74S181 002.jpg
    74S181 001.jpg
    640 x 480 - 78K
    640 x 480 - 112K
Sign In or Register to comment.