Author Topic: Logic design question  (Read 2510 times)

0 Members and 1 Guest are viewing this topic.

Offline pterrusTopic starter

  • Jr. Member
  • **
  • Posts: 37
  • Helpful? 0
Logic design question
« on: June 20, 2012, 02:04:23 PM »
I'm designing a remote control for my robot and I want to do some discrete logic on the transmitter end to save ports on the microcontroller not have to do it in software.

My desired interface has a pushbutton (B) and a switch (S) and I want to generate B*S and B*NOT(S).  After much head scratching I cannot figure out a way to do this with fewer than 5 NAND gates.  I feel like there's gotta be some really simple way to do this but it's not coming to me.

I'm free to set up the switches to be either pull up or pull down if that helps.

Offline mstacho

  • Supreme Robot
  • *****
  • Posts: 376
  • Helpful? 10
Re: Logic design question
« Reply #1 on: June 21, 2012, 08:40:22 AM »
Um, if I understand it correctly, when you say B*S you mean "B AND S", correct?

So, I guess you want TWO signals, one of which is B AND S, and the other is B AND NOT(S), rather than a single signal:

(B AND S) AND (B AND NOT(S))

Correct?

Going on that assumption, it's one AND gate and one NAND gate (or two AND gates and one NOT gate).  I'm not sure where your five gates come from?

IF it is the second option, then the output is *always* false, which is why I assumed it must be the first one.  (it's always false since either S or NOT(S) will always be false, thus one side of the AND's will be false)

If you mean anything other than what I assumed, let me know!

**EDIT:

If * means "OR", then:

the second option is two ORs, one AND, and one NOT (or one OR, on AND, and 1 NOR)

The first option is still two OR gates and one NOT gate, so no 5 NANDs...

MIKE
« Last Edit: June 21, 2012, 08:44:14 AM by mstacho »
Current project: tactile sensing systems for multifingered robot hands

Offline pterrusTopic starter

  • Jr. Member
  • **
  • Posts: 37
  • Helpful? 0
Re: Logic design question
« Reply #2 on: June 22, 2012, 11:04:02 PM »
Yeah I meant that I need 2 seperate signals.

I think I figured out how I'm gonna do it: I'll take the output of the switch, split it and NOT one branch.  Then I'll switch +5V into the whole thing with the button (including the gate).  So if the button isn't pressed, everything is zero.  If it is pressed, I get two outputs that flip based on the switch.  That works, right?  (and its only one gate)

Offline mstacho

  • Supreme Robot
  • *****
  • Posts: 376
  • Helpful? 10
Re: Logic design question
« Reply #3 on: June 23, 2012, 06:08:29 AM »
oh!  Yes, now I get it:  the button determines whether or not the switch signal does anything.

Yes, your method works fine, and is actually pretty elegant. 

MIKE
Current project: tactile sensing systems for multifingered robot hands

Offline Soeren

  • Supreme Robot
  • *****
  • Posts: 4,672
  • Helpful? 227
  • Mind Reading: 0.0
Re: Logic design question
« Reply #4 on: June 23, 2012, 12:57:46 PM »
Hi,

Yeah I meant that I need 2 seperate signals.
Do you mean that you need an output (from the entire whatever) consisting of two lines that will always be each others complement, as long as the button is pressed?
If so, why do you need those anti-"phase outputs, when a microcontroller can act on either one?


I think I figured out how I'm gonna do it: I'll take the output of the switch, split it and NOT one branch.  Then I'll switch +5V into the whole thing with the button (including the gate).  So if the button isn't pressed, everything is zero.  If it is pressed, I get two outputs that flip based on the switch.  That works, right?  (and its only one gate)
Assuming you need the complement output, you can make it with a DPDT switch and a pushbutton, no further circuitry needed - I can draw you a schematic if needed :)
Regards,
Søren

A rather fast and fairly heavy robot with quite large wheels needs what? A lot of power?
Please remember...
Engineering is based on numbers - not adjectives

Offline pterrusTopic starter

  • Jr. Member
  • **
  • Posts: 37
  • Helpful? 0
Re: Logic design question
« Reply #5 on: June 29, 2012, 07:39:14 AM »
Hi,

Yeah I meant that I need 2 seperate signals.
Do you mean that you need an output (from the entire whatever) consisting of two lines that will always be each others complement, as long as the button is pressed?
If so, why do you need those anti-"phase outputs, when a microcontroller can act on either one?
Yes, that's what I mean.  I'm trying to bypass the microcontroller entirely.  I'm running out of ports.  :p


I think I figured out how I'm gonna do it: I'll take the output of the switch, split it and NOT one branch.  Then I'll switch +5V into the whole thing with the button (including the gate).  So if the button isn't pressed, everything is zero.  If it is pressed, I get two outputs that flip based on the switch.  That works, right?  (and its only one gate)
Assuming you need the complement output, you can make it with a DPDT switch and a pushbutton, no further circuitry needed - I can draw you a schematic if needed :)
Actually that would be awesome.  I didn't think of DPDT.  I tried to figure it out myself, but the schematic I came up with doesn't seem right (one output is always floating, not sure if that's okay).

Offline Soeren

  • Supreme Robot
  • *****
  • Posts: 4,672
  • Helpful? 227
  • Mind Reading: 0.0
Re: Logic design question
« Reply #6 on: June 29, 2012, 07:25:07 PM »
Hi,

Do you mean that you need an output (from the entire whatever) consisting of two lines that will always be each others complement, as long as the button is pressed?
If so, why do you need those anti-"phase outputs, when a microcontroller can act on either one?
Yes, that's what I mean.  I'm trying to bypass the microcontroller entirely.  I'm running out of ports.  :p
Ah OK - the real way of solving such issues while staying prepared for future changes would be a controller with more pins of course, but that's in your future, so nothing I should worry about :)


Assuming you need the complement output, you can make it with a DPDT switch and a pushbutton, no further circuitry needed - I can draw you a schematic if needed :)
Actually that would be awesome.  I didn't think of DPDT.  I tried to figure it out myself, but the schematic I came up with doesn't seem right (one output is always floating, not sure if that's okay).
Add a little Scotch brain lubricant to heal a cold and it can be reduced to a push button and a SPDT - at least if I get your idea, which isn't true complimentary outputs, but rather one or the other output following the button presses, while the other is permanently low (until flipped).
Is that what you need?
Regards,
Søren

A rather fast and fairly heavy robot with quite large wheels needs what? A lot of power?
Please remember...
Engineering is based on numbers - not adjectives

Offline pterrusTopic starter

  • Jr. Member
  • **
  • Posts: 37
  • Helpful? 0
Re: Logic design question
« Reply #7 on: June 30, 2012, 02:13:17 PM »
That's perfect, thanks.