What is the best way to output arithmetic operations output?

atferrari

Joined Jan 6, 2004
4,768
Luckily the chip was in my proteus simulator and it can still be simulated (74LS181 and 74HC181).:) Allen
What on account of their unavailability makes little sense to me. More or less like simulating nowadays say an SN76477 or its more obscure brother, the SN76481.

Better take the different concepts, one by one, see how they work in the micro of your choice and you could end having a robust routine to show any figure in 7-segment / LCD / GLCD displays, signed / unsigned with/without leading zeros. What I did, BTW.

Additional complication (or it is a simplification?) is to learn how to do maths in BCD inside the micro. (Old AN from Microchip do exists). It demands to learn how to adjust the carry in between digits of the pair, and how the micro actually does it. You need a clear mind, some time and everything would be simple afterwards

Just in case, learn what the "corner case" concept is. Good when testing routines of ANY kind.
 

WBahn

Joined Mar 31, 2012
30,051

WBahn

Joined Mar 31, 2012
30,051
What on account of their unavailability makes little sense to me. More or less like simulating nowadays say an SN76477 or its more obscure brother, the SN76481.
Once a simulation model is in a library, there is very little reason to take it out and quite a few reasons to leave it in. People don't like it when they upgrade their library and now some of their legacy products won't simulate any more but they still need to support their customers that have those products.
 

atferrari

Joined Jan 6, 2004
4,768
Once a simulation model is in a library, there is very little reason to take it out and quite a few reasons to leave it in. People don't like it when they upgrade their library and now some of their legacy products won't simulate any more but they still need to support their customers that have those products.
Yes. Maybe in some 30 years-old designs using that 74181? Or it is 40?

For a newcomer, bothering to simulate it still makes no sense unless he pays those 6,88$...

I would like to hear what the OP has to say to my initial post.
 

Thread Starter

imperatormk

Joined Mar 1, 2011
96
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
From the '181 datasheet:

The function table lists the arithmetic operations that are
performed without a carry in. An incoming carry adds a one
to each operation. Thus, select code LHHL generates
A minus B minus 1 (2s complement notation) without a
carry in and generates A minus B when a carry is applied.


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.
I know that these ICs are difficult to get. Luckily a friend of mine found two pieces for me, $1.12 each.

Probably should have explained the idea earlier. I have coded an app to control the IC inputs through parallel port, and want the outputs on a couple 7-segment displays for arithmetic ops and 4 LEDs for logical (one LED for each bit). So this particular project is meant to be done with a real '181, not a simulated one.
 
Last edited:

absf

Joined Dec 29, 2010
1,968
I tried to simulate the 4 outputs of the 74181 (F0-F3) to get it decoded to 2 BCD and displayed on 2 7-segment CA LED.

It turned out that I need the chip 74185 (5 bit binary to 2 BCD) to do the decoder job. My simulator has the chip for schematice capture but not for simulation. So I implemented the function using 74154 and a couple of NAND gates as in the 2nd figure attached.

The truth table showed how I implement the BIN 2 BCD. There are some discussions about the conversion from binary to BCD here....

http://forum.allaboutcircuits.com/showthread.php?t=60883

and

http://www.electro-tech-online.com/homework-help/113371-how-convert-binary-bcd-using-logic-work.html

As for how to show the 2 decimal digits in its negative form when bit 3=1..., I am still working on it and not sure if I can do it. But I think it could be implemented using 2x 2716 eprom. May be the best solution is to use a pic16F628a, with a simple program, the binary to BCD decoder as well as the 2x 7447 7-segment drivers can be embedded into the mcu.:rolleyes:

Allen
 

Attachments

Last edited:

Thread Starter

imperatormk

Joined Mar 1, 2011
96
I tried to simulate the 4 outputs of the 74181 (F0-F3) to get it decoded to 2 BCD and displayed on 2 7-segment CA LED.

It turned out that I need the chip 74185 (5 bit binary to 2 BCD) to do the decoder job. My simulator has the chip for schematice capture but not for simulation. So I implemented the function using 74154 and a couple of NAND gates as in the 2nd figure attached.

The truth table showed how I implement the BIN 2 BCD. There are some discussions about the conversion from binary to BCD here....

http://forum.allaboutcircuits.com/showthread.php?t=60883

and

http://www.electro-tech-online.com/homework-help/113371-how-convert-binary-bcd-using-logic-work.html

Allen
Amazing! I too am using the same simulator so I'll check it out how it works. This chip, 74185 is exactly what I was looking for even prior posting here.

As for how to show the 2 decimal digits in its negative form when bit 3=1..., I am still working on it and not sure if I can do it. But I think it could be implemented using 2x 2716 eprom. May be the best solution is to use a pic16F628a, with a simple program, the binary to BCD decoder as well as the 2x 7447 7-segment drivers can be embedded into the mcu.:rolleyes:

Allen
Umm, I think that would make the whole project more complicated than it should be. Might give it a try though, if you think that it is the best solution (or perhaps the only possible one). I appreciate your effort!
 

absf

Joined Dec 29, 2010
1,968
My circuit only works for positive numbers. If I want to display 1's or 2's complement number -8 to +7, I need to add a switch to indicate whether the output is to be in "0-15" or "-8 to +7" mode.

Can the 74181 indicate whether it's outputting positive or negative numbers?

Still reading the datasheet to gather more informations...:D

Allen
 

absf

Joined Dec 29, 2010
1,968
I thought so. But they can be easily replaced using 32x8 TTL PROM (74S188 or 82S123) or a 2716 EPROM. I have about 50 pieces of 2716 from obsolete OKI teleprinters.

Allen
 

Thread Starter

imperatormk

Joined Mar 1, 2011
96
I showed this to someone who knows a lot on this topic so I think we'll manage to find some solution. Will post back later.
 

thatoneguy

Joined Feb 19, 2009
6,359
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?
Some "logic" ICs are nothing more than masked ROM lookup tables to change outputs based on the input "address". 7 segment decoders, hex display drivers, and some others.

How far do you stray before it is "cheating" if you are only using the uC for the display, while using 74xx logic for the actual ALU?
 

WBahn

Joined Mar 31, 2012
30,051
Some "logic" ICs are nothing more than masked ROM lookup tables to change outputs based on the input "address". 7 segment decoders, hex display drivers, and some others.

How far do you stray before it is "cheating" if you are only using the uC for the display, while using 74xx logic for the actual ALU?
That depends entirely on what the intent is. Only the OP can answer that question.
 

absf

Joined Dec 29, 2010
1,968
@MrChips,
This is a trial effort to use 16f628a to display 2 BCD digits directly from the ALU to the 7 segment LED. Version one only works with positive numbers.

To display negative numbers, I need an extra pin on the pic to indicate "Mode". So I might have to make use of RA6 or RA7 which was for the xtal osc.

Still working on the software.

@imperatormk, any news from your friends who is very knowledgeable ?

Allen
 

Attachments

Last edited:
Top