What is the best way to output arithmetic operations output?

Discussion in 'The Projects Forum' started by imperatormk, Dec 9, 2012.

  1. imperatormk

    Thread Starter Member

    Mar 1, 2011
    96
    2
    This is kinda amateur question.

    I am working on a 74181 project which is supposed to perform logical and arithmetical operations. What is the best way to output the arithmetical operations result: using a 7 segment display (in decimal form) or in binary form (1 LED for each output bit).

    Thanks!
     
  2. panic mode

    Senior Member

    Oct 10, 2011
    1,318
    304
    either individual LEDs or HEX. BCD cannot display values greater that 9
     
  3. imperatormk

    Thread Starter Member

    Mar 1, 2011
    96
    2
    Given that the output value will vary from 0 to 9, is using 7 segment display a good idea? Or better said, is it correct.

    To understand my question better, how are the outputs from arithmetic operations meant to be treated; as binary or decimal?

    Thank you.
     
    Last edited: Dec 9, 2012
  4. crutschow

    Expert

    Mar 14, 2008
    12,986
    3,226
    Why do you say the output will vary from 0 to 9? :confused: Are you limiting the input values so that the output never exceeds 9? Is the circuit going to perform BCD logic?

    If the output is intended for the average person to read, then typically a decimal output is displayed, but that requires the conversion of the usual binary number into decimal (BCD) format, which is not a simple process.

    If you are just wanting to observe the output to see that it is working, then you can use a hexadecimal digit display for each 4-bits.
     
    absf likes this.
  5. imperatormk

    Thread Starter Member

    Mar 1, 2011
    96
    2
    I would do so if necessary.

    This is the part I don't get. Are the arithmetical operations performed on 2 binary numbers or 2 decimal numbers coded as binary?
     
  6. WBahn

    Moderator

    Mar 31, 2012
    17,715
    4,788
    Since each of the inputs going into your circuit can only be a 0 or a 1, it can't be working on a decimal representation. So it has to be working with a binary representation. The question is, what binary representation is used? The common ones are unsigned binary, signed binary using two's compement, or binary-coded decimal (BCD).

    The 74181 uses 1's complement to perform subtraction, but I'm not sure (have never used it) whether external I/O is in 1's complement or 2's complement. It is NOT in BCD.

    If you are going to use the 74181 in a project, you need to first learn and understand what the 74181 does.
     
    absf likes this.
  7. imperatormk

    Thread Starter Member

    Mar 1, 2011
    96
    2
    Well I have to say that I posted here to have the things cleared up a bit exactly because I don't know exactly how this IC works in arithmetic mode. And thanks for the explanation.

    So does anyone have an idea how the output can be showed on 7-segment screens?

    Thanks.
     
  8. crutschow

    Expert

    Mar 14, 2008
    12,986
    3,226
    If you want the output in decimal, then you will need to do a binary to BCD conversion, which is not trivial to do. If 4-bit Hex output (0-9, A,b,C,d,E,F) is satisfactory, then you can generate that with a 7-segment display such as shown here.
     
  9. WBahn

    Moderator

    Mar 31, 2012
    17,715
    4,788
    There are lots of ways to display it (well, perhaps not "lots", but certainly several). The two big options are displaying it in decimal or displaying it in hex. If you display it in decimal you have to convert your binary output to BCD. If you display it in hex, then you have to be able to generate the encodings for the alphabetic hex digits, which a 7447 doesn't do, but something like a MC14495 does. But we have no idea which way(s) is(are) appropriate for your project because we don't know anything about your project other than you are using a 74181 and are outputting the results of arithmetic operations. Who is going to be looking at the display? Will they know how to interpret a hex display? Can your arithmetic operations result in negative values? Will the person looking at the display know how to interpret the hex encoding of a negative value?
     
  10. absf

    Senior Member

    Dec 29, 2010
    1,492
    371
    There is this chip that would convert 4 bit binary number to the hex equilvalent in 7-segment CC format. The chip number is DM9368.

    Or you can get dotted 7-segment LED TIL-311 and display real hex digits.

    See datasheets attached.

    Allen
     
    Last edited: Dec 13, 2012
  11. imperatormk

    Thread Starter Member

    Mar 1, 2011
    96
    2
    WBahn.

    The output is binary, but the problem is that it's max value is 1111, which would be 15 in decimal. And I need a way to show that decimal value on two 7-segment screens. The output can have negative values too.

    Thank's.
     
  12. WBahn

    Moderator

    Mar 31, 2012
    17,715
    4,788
    Now you are describing a signed BCD display involving three indicators, one for the sign, one for the tens digit, and one for the ones digit.

    If you have four bits and can have negative values, then you can't have a max value of 15. You have a total of 16 values you can represent and you must allocate them between positive and negative values. If you use two' complement, then this would be -8 to +7.

    Before you can talk about displaying the result, you must be clear on how the values you want to display will be represented. So take a step back and get that settled first.
     
  13. MrChips

    Moderator

    Oct 2, 2009
    12,420
    3,355
    The simplest solution would be to interface a microcontroller to read the outputs of the 74181.
     
    absf likes this.
  14. WBahn

    Moderator

    Mar 31, 2012
    17,715
    4,788
    Using an MCU would probably be against the intent of the whole thing. I mean, interfacing a microcontroller to an MSI ALU just seems....wrong... at a visceral level. :D
     
  15. MrChips

    Moderator

    Oct 2, 2009
    12,420
    3,355
    Not really. I know folks who rejuvenate old radios in wooden cabinets by ripping out the tube radios and installing transistor radios. Who can tell the difference?
     
  16. WBahn

    Moderator

    Mar 31, 2012
    17,715
    4,788
    If the intent is to have something that looks and, to some degree anyway, sounds like like an old radio, sure. But if the intend is to understand old radios, not so much. Which would be more likely to be the intent of the problem here?
     
  17. imperatormk

    Thread Starter Member

    Mar 1, 2011
    96
    2
    At this point I am kinda confused. Can you take a look at the 74181 datasheet for me? (I know that is works with negative values too, but thought that its max value is 15, which possibly is not).

    As for the output, I want to have it in decimal form on multiple 7-segments displays. For example: if you input 4-6 (0100 - 0111), then the output should be -2 on the displays.

    Thanks!
     
  18. WBahn

    Moderator

    Mar 31, 2012
    17,715
    4,788
    You can interpret the inputs and outputs as either signed or unsigned, but you can't do both at the same time. For instant, if you input 4-6, what is the output (what are the four bits). If you do 7+7, what is the output?
     
  19. absf

    Senior Member

    Dec 29, 2010
    1,492
    371
    I dont see any "A-B" in the function table of 74181.

    Your "4-6" have to be entered as A=4 and B=-6. Can you tell us how you enter "B" in your design?

    I am also learning about this ALU chip and I have a PCB with 2 of these chips inside and the card was labelled as "ALU". It was an old PCB from the RP (regional processor) of an Ericsson SPC Exchange.

    Allen
     
  20. atferrari

    AAC Fanatic!

    Jan 6, 2004
    2,645
    759
    Hola imperator,

    I am not trying to derail this thread, much less to discourage you.

    My question: do you have a source for the 74181? The last time I looked for one of those ICs it was impossible to get. Many many years ago.

    Is it in the idea of learning how to handle all those concepts?

    If so, you could exercise the whole lot in a micro working in assembler (what I finally did when starting).

    If you neglect this post, no offence taken.
     
    Last edited: Dec 15, 2012
    absf likes this.
Loading...