Exclusive OR - XOR


Closed Thread
Results 1 to 6 of 6
  1. #1
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818

    Cool Exclusive OR - XOR

    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
    Last edited by Archangel; - 8th September 2006 at 09:38.

  2. #2
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Hi Joe,

    The XOR symbol is ^

    Still not sure exactly what you're trying to do, but something like this might work...
    Code:
    PIN   VAR PORTB.0
    OUT1  VAR BIT
    OUT2  VAR BIT
    
    PIN = OUT1 ^ OUT2
    HTH,
      DT

  3. #3
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default Thanks

    Thanks Darrel,
    I'll see what I can do with tidbit.
    Joe

  4. #4
    blainecf's Avatar
    blainecf Guest


    Did you find this post helpful? Yes | No

    Default truth (or consequences) table example?

    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

  5. #5
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default Truth Table

    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

  6. #6
    ro37bis's Avatar
    ro37bis Guest


    Did you find this post helpful? Yes | No

    Default xor

    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

Similar Threads

  1. A logic gate chip with 1 ea XOR and 2 ea AND gates?
    By jellis00 in forum mel PIC BASIC Pro
    Replies: 21
    Last Post: - 5th August 2009, 05:29
  2. XOR result different with PC application
    By Pic2008 in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 26th January 2009, 04:56
  3. Exclusive bit settings (i.e. PORTS)
    By flotulopex in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 31st March 2007, 21:37
  4. Xor Sum
    By Sphere in forum General
    Replies: 3
    Last Post: - 7th December 2006, 07:52
  5. Exclusive OR howto?
    By Ali_en in forum General
    Replies: 2
    Last Post: - 5th May 2005, 12:11

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts