# Digital Logic Question

Discussion in 'General Electronics Chat' started by rainyday101, Aug 31, 2010.

1. ### rainyday101 Thread Starter Member

Sep 24, 2009
50
0
I have a circuit where I have 9 outputs from comparators (logic 1 or 0) and would like each of the nine outputs to be the corresponding 4 bit binary number. This binary number would be sent to a 4511 7 segment display decoder/driver to display the corresponding decimal number (1-9) on a 7 segment display. The outputs of the comparators are fault indications for heater circuits. If a logic 1 is seen from the fault indication (say heater circuit 5) I need the 7 segment LED to display 5. The problem is I don't know how to convert each individual bit from the comparator to the corresponding 4 bit binary number and move this to the 4511. I tried having each comparator output going to the control of a 4066 quad analog switch. For example, if comparator 3 went to a logic level 1, then this would turn on switches 1 and 2, while switches 3 and 4 stayed off. Thus I would get a binary 0011 to send to the 4511. The problem with this is that you need tons of diode to block and direct the paths to the 4066. All nine comparators tied to the corresponding switches. There's gotta be a better way! Any ideas to get me pointed in the right direction?

May 9, 2009
2,613
214
3. ### rainyday101 Thread Starter Member

Sep 24, 2009
50
0
Thanks Tom, that is heading in the right direction. I will have to look at that more when I get time tonight. I am not sure that will work without some modification. For example I need the discrete high output from comparator 1 to give me binary 0001, a high output from comparator 2 to give me binary 0010, comparator 3 to give binary 0011 and so on up to comparator 9. Each individual comparator giving a four bit binary word to send to a 4511 so I can get the decimal (1-9) display on a 7 segment LED. I tried using one 4066 quad switch with all 9 comparators turning on the switches to get a binary number from the switches. Example: comparator 3 would leave switch 4 off (0), switch 3 off (0), and switch 2 on (1), and switch 1 on (1). The switches were fed a common 5vdc so that I would get outputs being 0011 to send to the 4511. Problem was with all 9 comparators feeding one 4066 I ended with a diode matrix nightmare that I never got correct. The comparators warn me of fault conditions in the preceding circuitry and the idea is to have the 7 segment display indicate the fault that the circuitry is monitoring. In my case I am using current transformers, op amps, and comparators to measure 9 heaters on a machine. When heater 9 goes open, I want the 7 segment display to show 9. I have had thoughts of using an Arduino.

4. ### tom66 Senior Member

May 9, 2009
2,613
214
Yes; the circuit I linked to will do that. As it is very similar to a flash ADC. It is important, however, that no two comparators are on at the same time, or you will get a nonsense result (a bitwise OR of the two numbers producing something different.)

5. ### SgtWookie Expert

Jul 17, 2007
22,183
1,728
You really need a small uC (microcontroller) for your project. Otherwise, it'll get really out of hand with the bits of hardware (diodes, etc) that you'll need - and if more than one error exists, you'll need ways to handle it.

With a uC, you could just poll the inputs, say, once a second - if an error exists, then display it directly on the 7-segment display (just use a look-up table for which segments need to be turned on for a particular number.

If multiple errors exist, simply rotate through the numbers that need to be displayed, one at a time, at perhaps a 1-second interval - but leave the display blank momentarily to catch your attention.

Jul 26, 2010
2,358
201
7. ### hobby16 Active Member

Aug 30, 2010
30
4
Don't use the 4511, let your detector outputs drive directly the 7 segment display with open collector drivers (like the 7405) :
for '1', you need 2 gates to light 2 segments,
for '2', you need 5 gates
etc, etc.
Open collector drivers may be replaced by diodes and one NPN transistor/number.

8. ### rainyday101 Thread Starter Member

Sep 24, 2009
50
0
Thanks Tom and Marshal. I have looked at both of the circuits and they will both work. I think I am going head the Arduino direction though. If I don't use an Arduino I need to come up with some sort of inhibit so that if one comparator is on and giving binary, the other comparators are inhibited. This way I don't get two binary numbers or more coming in at the same time. I really like that simple circuit from Marshal, but think it might be easier to use the microcontroller as Sgt Wookie mentioned. This way unlimited options are only software commands.

9. ### marshallf3 Well-Known Member

Jul 26, 2010
2,358
201
Quite honestly I was a bit surprised they never made a decimal to BCD encoder IC back in the days they made 7400 & 4000 series ICs in almost every logic configuration you could imagine.

10. ### rainyday101 Thread Starter Member

Sep 24, 2009
50
0
I am going to use a small arduino called an ardweeny. Small inexpensive solution to the problem. In this case it seems a little software can replace alot of hardware. This will solve all my decimal and binary problems. Thanks everyone for the advice.

11. ### BillB3857 Senior Member

Feb 28, 2009
2,402
348
Check out the 74ls147 datasheet here..... http://www.futurlec.com/74LS/74LS147.shtml

Jul 26, 2010
2,358
201