Alright so my friend came up with a problem. You have two leads. If both are 0, you want a light on. If both are 1 you want a light on. If you have 10 or 01 then you want a light off. I've tried figuring it out, as has he but we can't get it.
I was thinking you would need something like this:
+ stands for OR
* stands for AND
' stands for NOT
A*B + (AB)'
Using DeMorgan's theorum, that gets simplified to
A*B + (A'+B')
Distribution
A*A' + A*B' + B*A' + B*B'
Simplify
0 + A*B' + B*A' + 0
AB' + BA'
But that doesn't work in a truth table. Any help?
put one through a NOT, then both through a NAND.
(A' * B)'
-r
***Nevermind, that doesn't work. need sleep!
Or, Masm-wise:
include \masm32\include\masm32rt.inc
.code
start:
mov eax, 0
mov edx, 0
xor eax, edx
dec eax
print str$(eax), 9, "00", 13, 10
mov eax, 0
mov edx, 1
xor eax, edx
dec eax
print str$(eax), 9, "01", 13, 10
mov eax, 1
mov edx, 0
xor eax, edx
dec eax
print str$(eax), 9, "10", 13, 10
mov eax, 1
mov edx, 1
xor eax, edx
dec eax
inkey str$(eax), 9, "11", 13, 10
exit
end start
-1 00
0 01
0 10
-1 11
What's that supposed to tell me jj?
I drew out the truth table for A*B+A'*B'
|00|01 |10 |11 |
|--+---+---+---|
00|0 | 0 | 0 | 0 |
01|0 | 0 | 0 | 0 |
10|0 | 0 | 0 | 0 |
11|0 | 0 | 0 | 1 |
But that only returns 1 if they are all 1.
i would use an XNOR gate
that's an XOR gate with any one of the 3 leads inverted :bg
A' XOR B = A XOR B' = (A XOR B)'
Thanks for the edit and the help.
Quote from: HiddenDragon on December 02, 2010, 03:11:48 AM
What's that supposed to tell me jj?
> You have two leads. If both are 0, you want a light on. If both are 1 you want a light on. If you have 10 or 01 then you want a light off.
That is exactly what the code demonstrates. Have you run it?
mov eax,A
xor eax,B
not eax
you can now handle 32 lights at once :P
Alright thanks then jj but I didn't need a programmatic solution. I just needed the boolean expression for it.
see this truth table
A B B' AB' || A' BA' AB'+BA' (AB'+BA')'
ON 0 0 | 1 0 || 1 0 0 1
OFF 0 1 | 0 0 || 1 1 1 0
OFF 1 0 | 1 1 || 0 0 1 0
ON 1 1 | 0 0 || 0 0 0 1
A*B + (A+B)'
the symbol for XNOR is a circle with a dot in the center
(http://img574.imageshack.us/img574/9576/xnor.jpg)
or
(AB' + A'B)'
as Rui mentioned
To solve problems like that we can use Z tables like this:
. means AND
+ means OR
' means NOT
Z table Grouping 0's we have: Z' = A'. B + A . B'
B => Z = (A'B + AB')'
A | 0 1
-------------- Grouping 1's we have: Z = A'. B' + A . B
0 | 1
1 | 1
--------------
HiddenDragon,
Your error comes from this: A*B + (AB)'
it doesnt solve the problem
EDIT: Search WIKIPEDIA for XNOR
Yes, sound like you just want a XNOR gate. Perhaps you're not allowed to use those ? But since you're learning this stuff, you must know all gates can be constructed from NAND gates. So here is a diagram showing just that:
(http://upload.wikimedia.org/wikipedia/en/2/2f/XNOR_Using_NAND.png)
Wrt gates, there are no discrete XNOR gates AFAIK, so you can make one up out of and XOR plus Inverter, or use array logic.
oh yah - they are quite common
in CMOS, they are CD4077 or motorola 14077