A logic gate chip with 1 ea XOR and 2 ea AND gates?


Closed Thread
Results 1 to 22 of 22

Hybrid View

  1. #1
    Join Date
    Mar 2009
    Location
    Colorado
    Posts
    378

    Default A logic gate chip with 1 ea XOR and 2 ea AND gates?

    I am using a PIC16F690 in an application which will control a valve solenoid. The solenoid requires reversing the polarity of the signal to latch open or latch closed the valve. I am using two output pins in the MCU to turn on or off two DPDT relays so that I can switch the polaritiy from a 9 v battery output to the solenoid: 1) MCU Pin1 turning on one relay that is Normally Open (NO) connects the +9 v to the redwire and GND to black wire of the solenoid...turning on the other relay that is NO connects the GND to the redwire and +9 v to the black wire.
    The problem I need to solve is how to make sure as a fail safe that both relays are never activated at once by the MCU when it may be going thru powerup or register settings, which means I need a logic circuit connected to the two PIC output pins with the following logic outputs to the relays so that only one of the relays can ever be turned on:
    Pin 1 Pin2 RL Output1 RL Output 2
    0 0 0 0
    1 0 1 0
    0 1 0 1
    1 1 0 0 'This state is the fail safe!
    I have determined the logic circuit to do this is a 2-input XOR gate with its output wired to one of the inputs on each of 2 AND gates, and the individual inputs to the XOR gate also connected to the other input of each of the AND gates. My question is, where can I find a single DIP IC chip that contains at least one, 2-input XOR gate and two, 2-input AND gates, which I can then wire up per above on my MCU circuit board?? I tried to find a CMOS chip that combined these different types of logic gates with no success. Anyone know where I can find one and the part number?

  2. #2
    Join Date
    May 2008
    Location
    Italy
    Posts
    825


    Did you find this post helpful? Yes | No

    Default

    jellis00, it is not clear how you have connected the two relays to the solenoid, but if you use the schematic attached you will have no fail safe problem.

    Al.
    Attached Images Attached Images  
    All progress began with an idea

  3. #3
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    Most PICs power-up with the I/O's in Analog or Input Mode.

    If your first commands set the Relay I/O's to whichever the Failsafe state is, followed by the TRIS for those I/O's, you should not experience any problems.

    There is a gotcha here... that IF your I/O's are driving something like a ULN2004 or similar High-Current Driver, and you are using a Port with internal Global Pull-Up's (like PORTB on a 16F628), then the act of switching-ON the internal Pull-ups BEFORE you've set any I/O's to OUTPUT would be enough to flip them into an undesired state.

    So the rule is... immediately on Power-Up...

    1. Set your OUTPUTS to the desired High/Low state
    2. Disable any ANALOG
    3. Set appropriate TRIS for that PORT.

    Worst case scenario, is that Relays take a few mS to react, and if you mess up you might pulse the Relays with a few uS in the wrong state... theoretically, it shouldn't affect things... anyone with a Pacemaker please step forward for an experiment...

  4. #4
    Join Date
    Mar 2009
    Location
    Colorado
    Posts
    378


    Did you find this post helpful? Yes | No

    Default This is a scheamatic for PIC/RELAY/SOLENOID connection

    it is not clear how you have connected the two relays to the solenoid
    Attached is a schematic as to how I am connecting the PIC outputs to the RELAYS to control the SOLENOID via its RED and BLACK wires. This shoulld permit switching of the polarity to the RED BLACK wires depending on which control pin is active??
    I guess if I follow the steps from Melanie's email I can do this without inserting the 2XOR and Dual 2AND gates in between the two PIC control pins and the two relay coils??????
    Attached Images Attached Images  

  5. #5
    Join Date
    May 2008
    Location
    Italy
    Posts
    825


    Did you find this post helpful? Yes | No

    Default

    This picture should be more clear.

    Al.

    Edit: picture is too small to see details, I attach a zipped one
    Attached Images Attached Images  
    Attached Files Attached Files
    Last edited by aratti; - 26th June 2009 at 07:13.
    All progress began with an idea

  6. #6
    Join Date
    Mar 2009
    Location
    Colorado
    Posts
    378


    Did you find this post helpful? Yes | No

    Default Have you ever tested or used your circuit with a latching

    aratti,
    Thanks for the schematic. Yours is a better approach than mine because it only requires two SPDT relays instead of two DPDT relays...cheaper! However I am a little concerned about whether "nothing happens" in your circuit for the state where both Relay 1 and 2 coils are turned on and both the Red and Black wires are connected to +9vdc. I am not certain what the latching solenoid does that I am looking at when both wires are high.
    Have your ever tested or used your circuit with an actual latching solenoid? If so what was your experience and can you refer me to the Part No. for the one you used??

  7. #7
    Join Date
    Mar 2009
    Location
    Colorado
    Posts
    378


    Did you find this post helpful? Yes | No

    Question Will this schematic work like yours?

    Quote Originally Posted by aratti View Post
    This picture should be more clear.

    Al.

    Edit: picture is too small to see details, I attach a zipped one
    Anrati, I have designed the Relay Circuit for use with my 16F690 MCU as shown in the attached partial schematic. As you can see, pin RC2 controls one of the two SPDT relays and pin RC3 controls the other. I have purposely wired the ground from the battery rather than the positive terminal to the normally closed contacts on the two relays so that in case there is any leakage in the Solenoid_RED or Solenoid_BLACK wire circuits it won't drain the battery when the relays aren't actuated.

    Do you think this circuit will work? One of my concerns is finding a SPDT relay that can be operated within the 25 mA limit of the MCU output pin. Any suggestions where I can get one?Name:  MCU_Relay_Circuit.jpg
Views: 4694
Size:  31.5 KB

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