What is the best way to output arithmetic operations output?

Thread Starter

imperatormk

Joined Mar 1, 2011
96
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!
 

Thread Starter

imperatormk

Joined Mar 1, 2011
96
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:

crutschow

Joined Mar 14, 2008
34,417
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?
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.
 

Thread Starter

imperatormk

Joined Mar 1, 2011
96
Why do you say the output will vary from 0 to 9? Are you limiting the input values so that the output never exceeds 9?
I would do so if necessary.

Is the circuit going to perform BCD logic?
This is the part I don't get. Are the arithmetical operations performed on 2 binary numbers or 2 decimal numbers coded as binary?
 

WBahn

Joined Mar 31, 2012
30,051
This is the part I don't get. Are the arithmetical operations performed on 2 binary numbers or 2 decimal numbers coded as binary?
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.
 

Thread Starter

imperatormk

Joined Mar 1, 2011
96
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.
 

crutschow

Joined Mar 14, 2008
34,417
........................
So does anyone have an idea how the output can be showed on 7-segment screens?
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.
 

WBahn

Joined Mar 31, 2012
30,051
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.
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?
 

absf

Joined Dec 29, 2010
1,968
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
 

Attachments

Last edited:

Thread Starter

imperatormk

Joined Mar 1, 2011
96
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.
 

WBahn

Joined Mar 31, 2012
30,051
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.
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.
 

WBahn

Joined Mar 31, 2012
30,051
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
 

MrChips

Joined Oct 2, 2009
30,800
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?
 

WBahn

Joined Mar 31, 2012
30,051
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?
 

Thread Starter

imperatormk

Joined Mar 1, 2011
96
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.
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!
 

WBahn

Joined Mar 31, 2012
30,051
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!
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?
 

absf

Joined Dec 29, 2010
1,968
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
 

Attachments

atferrari

Joined Jan 6, 2004
4,768
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:
Top