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

basic stamp not good enough for calculator in class?

2»

Comments

  • kwinnkwinn Posts: 8,697
    edited 2013-04-23 12:27
    I probably have 5 or 10 tucked away somewhere as well but digging them out would be a challenge. Haven't needed one for at least a decade.
  • ohVaNiLLaGoRiLLaohVaNiLLaGoRiLLa Posts: 33
    edited 2013-04-23 14:36
    thank you all for your input! i didnt think such a discussion would result from my post.

    I am not entirely sure what this project is about either. It is our final project for my digital design class. He wants us to build an 8 bit calculator that can add and subtract using ttl logic. But if you wanted to use a micro controller you can do that too. With one student in our class who is a senior computer science major giving him a micro controller and saying program this in C++ to make a calculator is much different than telling the rest of us, sophomores, to put together a calculator out of ttl logic. To me that seems a bit unfair. If the professor will not accept my bs2 calculator I am just going to ask him to take it into consternation for some extra credit perhaps.

    Also I believe we could learn all the same stuff about logic gates and debugging circuits by doing a 4 bit calculator. But we have done ttl projects all semester and also did ttl projects in a lab for half of last semester. Everyone in my class, except for the CS major, has built a gray code to bcd converter with no logic reduction so that took forever. Then they taught us about logic reduction and we built a frequency counter out of ttl chips. Then we assembled some logic to display 8 characters on a 7 segment led controlled by a dip switch, 3 bits for each character so 3 switches. Then we had to make a multiplexed display after we got that done to get 3 characters displayed "at the same time" on three 7 segment leds. We had to do a bunch of little projects in between there also. I am just going to be glad when this is over!!
  • bruceebrucee Posts: 239
    edited 2013-04-23 15:23
    Wow, $7 for a 74LS181. I guess that is the price for obsolescence. I'd be thinking of getting into the chip business to build them, but I'm sure the annual usage is in the 100s and probably all for classroom activities.

    For that kind of a price, maybe a CPLD or FPGA might be a better solution, unless the soldering skills is part of the lesson you might find a cheap eval board. For my money learning the arithmetic that way and implementing it in some RTL is the way to go. While I'm from the age of cave painting and schematic design, hardware design has become an exercise in software in Verilog, VHDL or System Verilog.
  • jmgjmg Posts: 15,183
    edited 2013-04-24 00:09
    Also I believe we could learn all the same stuff about logic gates and debugging circuits by doing a 4 bit calculator. But we have done ttl projects all semester and also did ttl projects in a lab for half of last semester. Everyone in my class, except for the CS major, has built a gray code to bcd converter with no logic reduction so that took forever. Then they taught us about logic reduction and we built a frequency counter out of ttl chips. Then we assembled some logic to display 8 characters on a 7 segment led controlled by a dip switch, 3 bits for each character so 3 switches. Then we had to make a multiplexed display after we got that done to get 3 characters displayed "at the same time" on three 7 segment leds. We had to do a bunch of little projects in between there also. I am just going to be glad when this is over!!

    That does seem like a lot of repetition at the TTL level.
    It would make sense to do one, or maybe two TTL projects, but then move onto another rung up the ladder.
    SPLDs would be a easy next step, with more scope to challenge the better students, but still with a firm LOGIC base.
  • kwinnkwinn Posts: 8,697
    edited 2013-04-24 18:23
    jmg wrote: »
    That does seem like a lot of repetition at the TTL level.
    It would make sense to do one, or maybe two TTL projects, but then move onto another rung up the ladder.
    SPLDs would be a easy next step, with more scope to challenge the better students, but still with a firm LOGIC base.

    The purpose seems to be to learn about logic gates, so whether it's TTL, CMOS, NMOS, RTL, or DTL, does not matter. Logic gates are logic gates, although I suppose TTL is a good choice for it's immunity to static damage.
  • ohVaNiLLaGoRiLLaohVaNiLLaGoRiLLa Posts: 33
    edited 2013-04-24 21:52
    anyone know an easy way to change binary to bcd with the basic stamp? other than with a bunch of if statements D:

    i did do some searching on converting binary to bcd but im not quite sure if i fully understand what is going on.
    so you take the binary number and shift it left until you cant anymore? then if you shift it 5 times or more you +3 someplace? could someone please clarify, thanks!
  • jmgjmg Posts: 15,183
    edited 2013-04-24 22:29
    You need to specify how many bits you are trying to convert, and if size or speed matter.
    .
  • whickerwhicker Posts: 749
    edited 2013-04-24 23:51
    just remember your powers of 10...

    first ask is it negative? if it is, print a minus sign, then make the number positive.
    the 3rd digit is "how many hundreds are in this?" then subtract that many hundreds...
    the 2nd digit is "how many tens are in this? then subtract that many tens...
    the 1st digit is "how many ones are in this? (or just basically the leftover, the remainder)
  • ohVaNiLLaGoRiLLaohVaNiLLaGoRiLLa Posts: 33
    edited 2013-04-25 15:33
    i need to do 8 bit binary so from 0 - 255 just positive numbers
  • jmgjmg Posts: 15,183
    edited 2013-04-25 18:13
    i need to do 8 bit binary so from 0 - 255 just positive numbers

    Choices on a small byte sized number would be
    * Lookup table
    * Use Divide and Remainder operations 2 times - this is how larger numbers are usually done.
    * Use successive subtract of 10, until remainder is < 10. LSD is remainder and count of subtracts (up to 25) is MSD's
  • AleAle Posts: 2,363
    edited 2013-04-27 01:10
    The '181 datasheet has the equivalent circuit in gates, I am sure you can build it and test it. You know, I was just thinking, I should use the schematic capture of the Xilinx WebISE to simulate the circuit... and so can you !, There, is Verilog quite popular, and in my opinion easy to learn. With some primitives you can "build" and simulate your circuit from gates...
    Edit:To run the code you need for instance icarus verilog. To see the waveform GTKWave. Other simulators should work equally well. Those in WebISE, or Altera's Quartus and so on requiere a bit more (of a sometimes overwelling) work.
    `default_nettype none // undefined wires give an error
    
    // test bench for full adder
    module tb();
    
    reg ain, bin, cin; // you need the inputs as registers
    wire qo, carryo; // you need the outputs as wires
    
    // you declare the module, we don't use the same names for the ios
    // but this way you keep the order
    
    full_1_bit_adder adder( ain, bin, cin, qo, carryo);
    
    // now we simulate
    initial
    	begin
    		$dumpvars; // dumps a waveform
    		ain = 0;
    		bin = 0;
    		cin = 0;
    		
    		#10 // waits 10 time units
    		ain = 1;
    		bin = 0;
    		cin = 0;
    		#10
    		ain = 0;
    		bin = 1;
    		cin = 0;
    		#10
    		ain = 1;
    		bin = 1;
    		cin = 0;
    		#10
    		ain = 0;
    		bin = 0;
    		cin = 1;
    		#10
    		ain = 1;
    		bin = 0;
    		cin = 1;
    		#10
    		ain = 0;
    		bin = 1;
    		cin = 1;
    		#10
    		ain = 1;
    		bin = 1;
    		cin = 1;
    		#10
    		
    		$finish; // finishes simulation
    		
    	end
    
    endmodule
    
    module full_1_bit_adder( input ai, bi, ci, output qo, carryo);
    
    wire x1, x2, x3, x5, x7, x8, x9;
    
    nand g1(x2, ai, bi);
    nand g2(carryo, x2, x8);
    
    xnor g3(x9, x5, ci);
    
    nor g4(x5, x1, x3);
    nor g5(x1, ai, bi);
    
    or  g6(x8, x1, x7);
    
    not g7(qo, x9);
    not g8(x3, x2);
    not (x7, ci);
    
    endmodule
    
    
    
  • SRLMSRLM Posts: 5,045
    edited 2013-04-29 16:43
    davejames wrote: »
    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...

    I wish I had this advice a few years back. I took an embedded systems class where you were supposed to use an AVR, but I argued and got them to let me use the Propeller. After that, I didn't have to learn anything about using the AVR, which is a shame (and just postpones the learning, not eliminates it). Plus, my final project was so traumatic to the class structure that they changed the rules after I left.
Sign In or Register to comment.