Adder circuit help:

Thread Starter

ecjohnny

Joined Jul 16, 2005
142
How can i wire the 6-DIP switch to the HD74LS283P Full-adder IC and a LED to the chip so that whenever >3(4 and above) dip switch is ON(high) my led will light up?

I dont know if it is possible to do with 1 chip but from my suggested answer, it would require as least 2 adder chip? I spend like few hour wiring up with some combinations/ways and i still cant get it.

Here an aided diagram :
http://imageshack.us/photo/my-images/26/fulladderqns.jpg/

and here is the datasheet of the chip being used:
http://pdf1.alldatasheet.com/datasheet-pdf/view/246818/RENESAS/HD74LS283P.html
 
Last edited:

crutschow

Joined Mar 14, 2008
34,452
The easiest way is to use two CD4063 (or similar) magnitude comparators. They will output a high (A>B) whenever the A input is higher than the comparison B input value.
 

Thread Starter

ecjohnny

Joined Jul 16, 2005
142
how can i go about doing it? i just started learning logic design. can i do it with a adder circuit? coz i am given the adder IC only.
 

crutschow

Joined Mar 14, 2008
34,452
Upon re-reading you requirements I think you are talking about something like a majority gate. If I understand, you want an output when any 4 or more of the 6 dip switches are high.

A comparator won't work for that and I don't see how an adder would either since they both work with binary words and this is not a binary word problem.

The easiest way is probably an analog solution. You simply have each DIP switch go to the inputs of an opamp configured as a 6-input summer, with the summer output going to an analog comparator. The comparator trip point voltage is selected such that when 4 or more inputs are active the comparator trips and lights the LED.

If you want a digital solution then you could go with a sequential circuit. Each switch would go to the input of a multiplexer with the mux output going to the enable input of a digital counter. The multiplexer would be clocked to sequence through the 6 switch outputs Any energized switch would generate a high at the mux output which would enable the counter to add one count. When the count equals 4 or more the LED would light. The counter would have to be reset to zero before the start of the next multiplexer sequence.

This digital approach could also be easily done, of course, with a microprocessor.
 

Georacer

Joined Nov 25, 2009
5,182
Magnitude comparators will be problematic.

If we split the 6 bits into 3 to each comparator, fill with 0 the final bit and OR the outputs, there are cases like 110110 that will give a wrong result, since both comparators will output 0.

I 'd go for an DAC-like converter, like crutschow said. Make an inverting adder using an OpAmp and then compare its output to a voltage comparator.
 

ErnieM

Joined Apr 24, 2011
8,377
This is quite doable with the original HD74LS283P 4 bit full adder requested.

A 4 bit full adder has 4 inputs for "A," 4 inputs for "B," and 5 outputs for their sum "C." The extra pin is for the cases when A+B>15.

Consider this extra pin (the carry out): If we connect A to the DIP switches and B to a fixed number 12, then when the DIP switches are throw for 3 we get 3+12=15, and for 4 we get 4+12=16.

Thus the carry out pin will be high only when A>3, thus accomplishing the task at hand with the part specified.
 

ErnieM

Joined Apr 24, 2011
8,377
Just noticed input is a SIX switch DIP switch. Same applies, still requires a single adder. One needs to recognize that the lowest two bits have no effect on the output, thus stay disconnected. But the constant is now 15, or all B inputs go to Vcc.
 
Last edited:

ErnieM

Joined Apr 24, 2011
8,377
<giggleing> Well, why do we need the adder at all?

Bottom two switched unconnected. Top 4 switched all in parallel, one end to Vcc, other end to resistor and LED.

Close any switch 3-6 and the LED comes on. Problem solved.
 

crutschow

Joined Mar 14, 2008
34,452
<giggleing> Well, why do we need the adder at all?

Bottom two switched unconnected. Top 4 switched all in parallel, one end to Vcc, other end to resistor and LED.

Close any switch 3-6 and the LED comes on. Problem solved.
I think he wants the LED to light when "any" 4 or more switches are on. In that case the switches do not have a binary weighted output (sequence is unimportant) and an adder or a simple connection scheme does not work.
 

Georacer

Joined Nov 25, 2009
5,182
Not quite. If I 'm not mistaken, the OP wants to detect any three switches out of six. Your solution utilizes only four switches. Moreover, if only the MSB switch is on, then the output will be 12+8=20, hence the output will be falsely on.
 

crutschow

Joined Mar 14, 2008
34,452
Not quite. If I 'm not mistaken, the OP wants to detect any three switches out of six. Your solution utilizes only four switches. Moreover, if only the MSB switch is on, then the output will be 12+8=20, hence the output will be falsely on.
The OP stated "whenever >3(4 and above) dip switch is ON(high) my led will light up".

If it's any 4 or more switches then MSB has no meaning. All switches have equal value.
 

ErnieM

Joined Apr 24, 2011
8,377
If they all have equal value then the adder still works, you just have to use three of them.

Note you can add three bits by using the carry in bit. Add S1, S2 and S3 for A, add S4, S5 and S6 for B. Then add these together for the final output.

The E3 output pin is your result, it is high for >3 switches closed.
 

Georacer

Joined Nov 25, 2009
5,182
The OP stated "whenever >3(4 and above) dip switch is ON(high) my led will light up".

If it's any 4 or more switches then MSB has no meaning. All switches have equal value.
I was actually talking to ErnieM. We posted roughly at the same time.

@ErnieM. Your last suggestion will work, but it uses 3 ICs, while a summing OpAmps needs only one and some resistors. Any special preference towards the first, apart from the OP's intention?
 

ErnieM

Joined Apr 24, 2011
8,377
When asked questions such as this one I take them as a puzzle, changing "I can name that tune in 5 notes" to "I can build that circuit in 5 parts."

Op asked for the 74LS283 so that's what I used. It's just as puzzle circuit, I don't have any answers as to what is better in the real world as that depends on so many other interconnected things.
 
Top