Log in

View Full Version : Exclusive OR - XOR



Archangel
- 8th September 2006, 01:36
How would you go about using an xor function with 2 outputs, without using discrete logic IC followers, is this DOable in code? What I am seeking to do is combine 2 outputs as follows: output 1 logic hi or low depending on what it needs to output. output 2 would be a cycling hi/low signal. the output would either cycle opposite output 2 or output 1 in a steady state depending upon what output 2 is doing. I can do this using a 7486 xor gate, I would rather do it in code but have Zero Idea as to how.

Thanks Again
JS

RTFM / CONFUSED = DUMMY W / HEADACHE

Darrel Taylor
- 8th September 2006, 04:20
Hi Joe,

The XOR symbol is ^

Still not sure exactly what you're trying to do, but something like this might work...

PIN VAR PORTB.0
OUT1 VAR BIT
OUT2 VAR BIT

PIN = OUT1 ^ OUT2

HTH,
  DT

Archangel
- 8th September 2006, 09:36
Thanks Darrel,
I'll see what I can do with tidbit.
Joe

blainecf
- 13th September 2006, 16:11
Please provide a "truth table" as example of what you expect:


Pin 1 Pin 2 Pin 0
0 0 ?
1 0 ?
0 1 ?
1 1 ?


bcf

Archangel
- 13th September 2006, 21:27
Hello,
Well something like this:

pin0 pin1 pin2
0 0 0

0 1 1

1 0 1

1 1 0

I want the pic to do exactly what a 7486 TTL chip will do
from signals generated by other code.

example:
sub1
portb.0 high
pause 500
portb.0 low
pause 500
return

sub2
if portb.1 = 1
then portb.0 high
else
return

I need to control 1 output xor from 2 inputs.
It's really simple to combine 2 outputs into a 7486 xor
chip to achieve this, but I am sure it can be done internaly
in a pic.. In the above example the first sub would always output
a flashing signal, whereas sub2 would output a steady signal only
if sub 1 was not running. I haven't had time to get back to this
but I have some ideas as to how to do it.
thanks for asking.
JS

ro37bis
- 14th September 2006, 09:44
hello test some like this:

PIN VAR PORTB.0
OUT1 VAR BIT
OUT2 VAR BIT

PIN = OUT1 ^^ OUT2 ' alternative syntax is PIN = OUT1 XOR OUT2

bye
Roberto