Shop OBEX P1 Docs P2 Docs Learn Events
Ex-or gate — Parallax Forums

Ex-or gate

Tony11Tony11 Posts: 41
edited 2010-04-23 01:58 in Propeller 1
How do I go about program A EX-OR GATE? With two input's and one output. I know how to do an And GATE.


EX-OR GATE

S.......S.......output
L.......L.......L
L.......H......H
L.......H......H
H.......L......L


S=Switch or input
L=Off
H=On

Here I code for And Gate


if ina[noparse][[/noparse]25] and ina[noparse][[/noparse]24]

Comments

  • LeonLeon Posts: 7,620
    edited 2010-04-22 21:52
    You have a bitwise XOR operation in Spin.

    This is how it actually works:

    A XOR B = (!A & B) OR (!B & A)

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Leon Heller
    Amateur radio callsign: G1HSM

    Post Edited (Leon) : 4/22/2010 10:18:35 PM GMT
  • pullmollpullmoll Posts: 817
    edited 2010-04-22 23:49
    If you don't want to use the XOR function, you can also write
    if ina[noparse][[/noparse]25] <> ina[noparse][[/noparse]24]
    
    

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Pullmoll's Propeller Projects
  • BeanBean Posts: 8,129
    edited 2010-04-23 00:26
    Right, XOR means "not equal".

    Bean

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Use BASIC on the Propeller with the speed of assembly language.
    PropBASIC thread http://forums.parallax.com/showthread.php?p=867134

    March 2010 Nuts and Volts article·http://www.parallax.com/Portals/0/Downloads/docs/cols/nv/prop/col/nvp5.pdf
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    There are two rules in life:
    · 1) Never divulge all information
  • kuronekokuroneko Posts: 3,623
    edited 2010-04-23 01:28
    Tony11 said...
    EX-OR GATE

    S.......S.......output
    L.......L.......L
    L.......H......H
    L.......H......H
    H.......L......L
    Whatever it is, it's not XOR. But I think we all got the idea [noparse]:)[/noparse]
  • Tony11Tony11 Posts: 41
    edited 2010-04-23 01:58
    It's A 4070 QUAD Exclusive or gate.
    Thank You people for your help.
Sign In or Register to comment.