Shop OBEX P1 Docs P2 Docs Learn Events
8 bit calculator out of TTL — Parallax Forums

8 bit calculator out of TTL

ohVaNiLLaGoRiLLaohVaNiLLaGoRiLLa Posts: 33
edited 2013-04-24 02:17 in General Discussion
I previously posted a topic about using a micro controller instead of constructing an 8 bit calculator out of TTL. Plenty of people had ideas about this calculator. So i was wondering what is the best way to build an 8 bit calculator out of ttl logic chips? I can use programmable logic chips also such as the GAL16V8 and the GAL22V10. This calculator just has to add and subtract!

For input I was going to use a dip switch.

From the input the number will go to the first register and the first register will always be displayed on the calculator display consisting of three 7 segment leds.
the first register will be some 74273 that works as a register so when its clocked it will hold the number. The number in this register will move to the second register when the second number is entered.

For the second register I was going to use a programmable logic chip, gal22v10, and program it so that if one of the pins is high it will store the 2s compliment of the number being put into it and if its low it will just store the number.

Then the two numbers will go to three 4bit adders connected together. The reason for 3 adder is because 2s compliment only goes up to 127 with 8 bits. Then the answer will be put in the first register which is always being displayed.

programming that gal22v10 with a table of 2s compliments and just regular binary numbers is going to be ridiculously time consuming and I am not even sure if it could hold two such large tables.


Have any ideas on how to improve this? or any other approaches that would possibly be less time consuming? This is the simplest way I can think to do it. I mean simple as least chips possible.

One issue is doing the calculations in binary and then converting it to bcd to use the ttl chip 74 whatever that does bcd to 7 segment. Im not quite sure how to get the number stored in the first register to be displayed on the three 7 segments i have... For example if the first register contains the number 45, which is 00101101 in binary, how do i make the display 0 on the first 7 segment and 4 then 5 on the others?

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2013-04-23 15:10
    Start with a detailed description of what the calculator is going to do. How are you going to tell it to add or subtract? How are you going to display the results, in binary (8 single LEDs) or hexadecimal or decimal? If decimal, why not have the calculator work in BCD with 8 bits holding two digits plus sign? Is using two DIP switch banks (8-bits each) going to satisfy your instructor? What's all this about tables of 2's complement values? Why do you think you need those?
  • ohVaNiLLaGoRiLLaohVaNiLLaGoRiLLa Posts: 33
    edited 2013-04-23 15:40
    well the numbers need to be displayed in decimal. To add two numbers together they will go through the 4bit binary adders. For subtraction the 2s compliment of the larger number will be taken and added to the second. The two numbers will always be added together. When the number goes from the first register to the second there will be a switch that will send the information strait to the second register or send it through some logic to get the 2s compliment and then into the second register. I do not see any other way to do subtraction. I have logic that will take binary and put it into bcd. from that bcd number I just need to connect the first 4 bits to the bcd driver that is connected to the right most 7 segment and so on.
  • kwinnkwinn Posts: 8,697
    edited 2013-04-23 19:20
    I previously posted a topic about using a micro controller instead of constructing an 8 bit calculator out of TTL. Plenty of people had ideas about this calculator. So i was wondering what is the best way to build an 8 bit calculator out of ttl logic chips? I can use programmable logic chips also such as the GAL16V8 and the GAL22V10.

    First thing to do is to make sure you have or can get the chips you need, as well as the programmer if one is needed. These two have been discontinued.

    Second thing is to make sure the chips you select are acceptable to your instructor.

    The chips you use to do the arithmetic are critical to the design of the rest of the circuitry. The 74181 was specifically designed to simplify doing binary math functions. It can do the conversion to 2's complement internally for subtraction. Take a good look at the data sheet logic diagram and the functions it can perform. Post a schematic of the adder you are going to use if you ask for more help.

    The first four bits of a binary number cannot go directly to the BCD driver. Those bits could be anything from 0000 to 1111 and values from 1010 to 1111 are not valid BCD numbers. The simplest way to convert binary to BCD is to use a table in a 1K x 4 (or larger) eeprom and a 2 bit counter. Displaying hex would be the simplest.
  • ohVaNiLLaGoRiLLaohVaNiLLaGoRiLLa Posts: 33
    edited 2013-04-23 19:52
    I have to have the display in decimal :[ and i was going to put some logic together to convert binary to bcd and then from the one large bcd number as input for the bcd to 7 segment chips.
  • kwinnkwinn Posts: 8,697
    edited 2013-04-23 20:46
    There are fairly simple ways to convert an 8 bit binary number to 3 BCD outputs. In general a counter drives the low address bits (usually A0 and A1) of an eeprom. The 8 bits of the binary number drive the higher address bits. A 1K by 8 eeprom is programmed with the BCD and digit select data needed to display the decimal value of the binary input. At most this requires a chip to produce the clock (555 timer), a counter chip (2 bits or more), an eeprom (1K x 8 or larger), a BCD to decimal driver chip for the display, and 3 transistors or a driver chip for the digit select.
  • jmgjmg Posts: 15,173
    edited 2013-04-23 22:50
    I can use programmable logic chips also such as the GAL16V8 and the GAL22V10. This calculator just has to add and subtract!

    You have not mentioned speed, which likely only has to be 'faster than someone can set the switches' ?
    That gives a nice way to avoid wide combinatorial paths, by using counters. - the classic Serial Adder/Subtractor !!
    One issue is doing the calculations in binary and then converting it to bcd to use the ttl chip 74 whatever that does bcd to 7 segment. Im not quite sure how to get the number stored in the first register to be displayed on the three 7 segments i have... For example if the first register contains the number 45, which is 00101101 in binary, how do i make the display 0 on the first 7 segment and 4 then 5 on the others?

    Side step that problem too, by working in BCD :)
    (I've even sidestepped BCD, and built an Up/Down counter in a 22V10, as a direct 7 segment state machine; from memory it included Ripple Blanking too... )

    All PLDs can (ideally) have the same code and you preload both operand, set direction for Add/Subtract, and then Go.
    Go clocks down one number set, whilst INC, or DEC of the other, until Zero. Result is A+B or A-B
    A 3 digit BCD (or 7Seg) counter would give an answer in 10us max.

    Edit : In the dusty archives, I found the code, and I see it used a Reset pin, and had 4 unused IP.
    A quick check shows that can flip to a Parallel Load, and 4 PL values, and it still fits in a ATF22V10 (compiled. not tested).

    The chip budget looks like one SPLD per Thumbwheel+7Seg, (as many as you want), plus one to handle Sign, and Go/Stop Add/Sub
  • LoopyBytelooseLoopyByteloose Posts: 12,537
    edited 2013-04-24 02:17
    I posted a good complete reference for doing this in your previous post. It includes using a 10key input and LED numerical display output.

    Also the book is a complete presentation of TTL logic. You can either do this with BCD or with Hexadecimal or both. It all depends on what you desire in terms of a grade.

    The text is "Digital Fundamentals: 7th Edition"

    Since you have to create the following:
    10 key input
    LED output
    and a maths processor

    It seems that you would do best with a good reference. Use a 4x4 matrix key pad for your additional functions of +, -. and =.
Sign In or Register to comment.