<div dir="ltr"><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small">Is there some reason you cannot do this in software?</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small">

<br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small">The MCU knows it got an input from the pin, why does it need to check if it is still high?</div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small">

<br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small">If you need the voltage on the pin for something else, just immediately drive the pin after you read it using a resistor to protect the output from driving the switch while it is still on (although many chips can take that abuse).</div>

<div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small"><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small">You have millions of transistors on the MCU you shouldn't need any more :-)</div>

<div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small"><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small"><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small">

<br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small"><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Apr 10, 2014 at 11:38 AM,  <span dir="ltr"><<a href="mailto:triembed-request@triembed.org" target="_blank">triembed-request@triembed.org</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Send TriEmbed mailing list submissions to<br>
        <a href="mailto:triembed@triembed.org">triembed@triembed.org</a><br>
<br>
To subscribe or unsubscribe via the World Wide Web, visit<br>
        <a href="http://mail.triembed.org/mailman/listinfo/triembed_triembed.org" target="_blank">http://mail.triembed.org/mailman/listinfo/triembed_triembed.org</a><br>
or, via email, send a message with subject or body 'help' to<br>
        <a href="mailto:triembed-request@triembed.org">triembed-request@triembed.org</a><br>
<br>
You can reach the person managing the list at<br>
        <a href="mailto:triembed-owner@triembed.org">triembed-owner@triembed.org</a><br>
<br>
When replying, please edit your Subject line so it is more specific<br>
than "Re: Contents of TriEmbed digest..."<br>
<br>Today's Topics:<br>
<br>
   1. "Latching" device (Grawburg)<br>
   2. Re: "Latching" device (Glen Smith)<br>
   3. Re: "Latching" device (Bill Farrow)<br>
   4. Re: "Latching" device (Carl Nobile)<br>
   5. Re: "Latching" device (Pete Soper)<br>
<br><br>---------- Forwarded message ----------<br>From: Grawburg <<a href="mailto:grawburg@myglnc.com">grawburg@myglnc.com</a>><br>To: Triangle Embedded Devices <<a href="mailto:TriEmbed@triembed.org">TriEmbed@triembed.org</a>><br>

Cc: <br>Date: Thu, 10 Apr 2014 08:55:28 -0400<br>Subject: [TriEmbed] "Latching" device<br>I'm making a traffic light project for the Raspberry Pi using an MCP23017 port expander. The Python code works fine and lights up the<br>


6 LEDs in the correct pattern. Now I want to add some other features and need a way to "latch" a device that is connected to one of the<br>
input pins on the MCP when I press a push button. It needs to remain high until specifically set low by a Python command. Perhaps there is<br>
some type of solid state device (3.3 VDC) that will function in this manner.  <br>
<br>
<br>
Brian Grawburg<br>
Wilson<br>
<br>
--<br>
I use Opera Web Browser.<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br><br>---------- Forwarded message ----------<br>From: Glen Smith <<a href="mailto:mrglenasmith@gmail.com">mrglenasmith@gmail.com</a>><br>To: Grawburg <<a href="mailto:grawburg@myglnc.com">grawburg@myglnc.com</a>><br>

Cc: Triangle Embedded Devices <<a href="mailto:TriEmbed@triembed.org">TriEmbed@triembed.org</a>><br>Date: Thu, 10 Apr 2014 09:20:00 -0400<br>Subject: Re: [TriEmbed] "Latching" device<br><div dir="ltr"><div>

A set reset latch will do just what you are asking for. You can build your own with cross coupled Nand gates or you can plop down a ready made one. The 74LV00 is a 3.3v quad Nand in a 14 pin DIP. With this you can make 2 S-R latch's.<br>



<br>Digikey has the  74LVC574 available for $0.59 each in 20 pin DIP which gets you 8 of them in a pack. <a href="http://www.digikey.com/product-detail/en/SN74LVC574AN/296-12910-5-ND/476078" target="_blank">http://www.digikey.com/product-detail/en/SN74LVC574AN/296-12910-5-ND/476078</a><br>



<br></div>Glen<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Apr 10, 2014 at 8:55 AM, Grawburg <span dir="ltr"><<a href="mailto:grawburg@myglnc.com" target="_blank">grawburg@myglnc.com</a>></span> wrote:<br>



<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I'm making a traffic light project for the Raspberry Pi using an MCP23017 port expander. The Python code works fine and lights up the<br>




6 LEDs in the correct pattern. Now I want to add some other features and need a way to "latch" a device that is connected to one of the<br>
input pins on the MCP when I press a push button. It needs to remain high until specifically set low by a Python command. Perhaps there is<br>
some type of solid state device (3.3 VDC) that will function in this manner.  <br>
<br>
<br>
Brian Grawburg<br>
Wilson<br>
<span><font color="#888888"><br>
--<br>
I use Opera Web Browser.<br>
<br>
<br>
<br>
<br>
<br>
_______________________________________________<br>
Triangle, NC Embedded Computing mailing list<br>
<a href="mailto:TriEmbed@triembed.org" target="_blank">TriEmbed@triembed.org</a><br>
<a href="http://mail.triembed.org/mailman/listinfo/triembed_triembed.org" target="_blank">http://mail.triembed.org/mailman/listinfo/triembed_triembed.org</a><br>
TriEmbed web site: <a href="http://TriEmbed.org" target="_blank">http://TriEmbed.org</a><br>
</font></span></blockquote></div><br></div>
<br><br>---------- Forwarded message ----------<br>From: Bill Farrow <<a href="mailto:bill@arrowsreach.com">bill@arrowsreach.com</a>><br>To: Triangle Embedded Devices <<a href="mailto:TriEmbed@triembed.org">TriEmbed@triembed.org</a>><br>

Cc: <br>Date: Thu, 10 Apr 2014 09:31:23 -0400<br>Subject: Re: [TriEmbed] "Latching" device<br>I was wondering if there is a "tricky" way you could do this using<br>
only a single pin, a capacitor, and a resistor.<br>
<br>
When the push button connects it charges the capacitor. The MCU pin,<br>
configured as an input, can read the state of the capacitor. When the<br>
MCU wants to reset the latch it can change the pin to an output and<br>
set it to 0 (low) which discharges the capacitor to ground via the<br>
resistor.<br>
<br>
Let's see how bad my ascii art is:<br>
<br>
mcu pin --- resistor --- switch --- 3.3v<br>
                             |<br>
                       capacitor<br>
                             |<br>
                           GND<br>
<br>
Bill<br>
<br>
<br>
<br><br>---------- Forwarded message ----------<br>From: Carl Nobile <<a href="mailto:carl.nobile@gmail.com">carl.nobile@gmail.com</a>><br>To: Bill Farrow <<a href="mailto:bill@arrowsreach.com">bill@arrowsreach.com</a>><br>

Cc: Triangle Embedded Devices <<a href="mailto:TriEmbed@triembed.org">TriEmbed@triembed.org</a>><br>Date: Thu, 10 Apr 2014 10:31:29 -0400<br>Subject: Re: [TriEmbed] "Latching" device<br><div dir="ltr">Something to be aware of is that the <span style="font-family:arial,sans-serif;font-size:13px">MCP23017 is a 5V device not a 3.3V device. It seems to work without a level converter, but could fail on some occasions like when adding more than one load to the output pins of the RPi, so it's best practice to always use a level converter between the RPi and a </span><span style="font-family:arial,sans-serif;font-size:13px">MCP23017.</span><div>


<span style="font-family:arial,sans-serif;font-size:13px"><br></span></div><div><span style="font-family:arial,sans-serif;font-size:13px">Carl</span><br></div><div><span style="font-family:arial,sans-serif;font-size:13px"><br>


</span></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Apr 10, 2014 at 9:31 AM, Bill Farrow <span dir="ltr"><<a href="mailto:bill@arrowsreach.com" target="_blank">bill@arrowsreach.com</a>></span> wrote:<br>


<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I was wondering if there is a "tricky" way you could do this using<br>
only a single pin, a capacitor, and a resistor.<br>
<br>
When the push button connects it charges the capacitor. The MCU pin,<br>
configured as an input, can read the state of the capacitor. When the<br>
MCU wants to reset the latch it can change the pin to an output and<br>
set it to 0 (low) which discharges the capacitor to ground via the<br>
resistor.<br>
<br>
Let's see how bad my ascii art is:<br>
<br>
mcu pin --- resistor --- switch --- 3.3v<br>
                             |<br>
                       capacitor<br>
                             |<br>
                           GND<br>
<span><font color="#888888"><br>
Bill<br>
</font></span><div><div><br>
_______________________________________________<br>
Triangle, NC Embedded Computing mailing list<br>
<a href="mailto:TriEmbed@triembed.org" target="_blank">TriEmbed@triembed.org</a><br>
<a href="http://mail.triembed.org/mailman/listinfo/triembed_triembed.org" target="_blank">http://mail.triembed.org/mailman/listinfo/triembed_triembed.org</a><br>
TriEmbed web site: <a href="http://TriEmbed.org" target="_blank">http://TriEmbed.org</a><br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br>-------------------------------------------------------------------------------<br>Carl J. Nobile (Software Engineer)<br><a href="mailto:carl.nobile@gmail.com" target="_blank">carl.nobile@gmail.com</a><br>


-------------------------------------------------------------------------------
</div>
<br><br>---------- Forwarded message ----------<br>From: Pete Soper <<a href="mailto:pete@soper.us">pete@soper.us</a>><br>To: <a href="mailto:triembed@triembed.org">triembed@triembed.org</a><br>Cc: <br>Date: Thu, 10 Apr 2014 11:38:29 -0400<br>

Subject: Re: [TriEmbed] "Latching" device<br>
  
    
  
  <div bgcolor="#FFFFFF" text="#000000">
    In my browser the vertical bar from the cap is further to the right
    than you intended, but I think we get it.<br>
    <br>
    So the capacitor will be discharged by the mcu pin's input
    resistance in series with the resistor. I agree this should work
    wonderfully as long as the cap is made large enough to keep the
    voltage high "long enough." If the latching action is only needed
    for a minute or two then a conventional cap may work well. For a
    longer time a supercap might be required.  The MCU (or expander port
    chip) data sheet and the resistor value could be used to calculate
    the time constant. But that's for a perfect cap: the super caps will
    approach this, but regular electrolytics will discharge faster where
    the other resistance involved is very large.<br>
    <br>
    A key issue is whether the resistor helps or hurts. If the latch
    needs to stay valid for a couple days, for instance, then when the
    pin is set to output and driven to ground it could take a very long
    time to discharge the capacitor. The software also has to keep track
    of that discharge time, re-testing the pin to confirm it's
    discharged or ignoring the pin "long enough" to avoid being tricked
    by another button press happening too soon after the earlier one.<br>
    <br>
    So the size of the capacitor in relation to how long the "latching"
    must last as well as how fast the discharge has to go would allow
    judging whether this circuit would meet Brian's requirements.  But
    it surely wins the simplicity award!<br>
    <br>
    If two pins could be used a classic SR latch should work. This would
    be a pair of gates (such as two CMOS nor gates) where the pushbutton
    applies a potential to the "set" input and the mcu pin senses Q or Q
    bar and applies a potential to the "reset" input. Here's a <a href="http://en.wikipedia.org/wiki/Latch_%28electronics%29#SR_NOR_latch" target="_blank">description</a>.<br>
    <br>
    <br>
    -Pete<br>
    <br>
    <div>On 04/10/2014 09:31 AM, Bill Farrow
      wrote:<br>
    </div>
    <blockquote type="cite">
      <pre>I was wondering if there is a "tricky" way you could do this using
only a single pin, a capacitor, and a resistor.

When the push button connects it charges the capacitor. The MCU pin,
configured as an input, can read the state of the capacitor. When the
MCU wants to reset the latch it can change the pin to an output and
set it to 0 (low) which discharges the capacitor to ground via the
resistor.

Let's see how bad my ascii art is:

mcu pin --- resistor --- switch --- 3.3v
                             |
                       capacitor
                             |
                           GND

Bill

_______________________________________________
Triangle, NC Embedded Computing mailing list
<a href="mailto:TriEmbed@triembed.org" target="_blank">TriEmbed@triembed.org</a>
<a href="http://mail.triembed.org/mailman/listinfo/triembed_triembed.org" target="_blank">http://mail.triembed.org/mailman/listinfo/triembed_triembed.org</a>
TriEmbed web site: <a href="http://TriEmbed.org" target="_blank">http://TriEmbed.org</a>
</pre>
    </blockquote>
    <br>
  </div>

<br>_______________________________________________<br>
TriEmbed mailing list<br>
<a href="mailto:TriEmbed@triembed.org">TriEmbed@triembed.org</a><br>
<a href="http://mail.triembed.org/mailman/listinfo/triembed_triembed.org" target="_blank">http://mail.triembed.org/mailman/listinfo/triembed_triembed.org</a><br>
<br></blockquote></div><br><br clear="all"><div><br></div>-- <br><br>Martin Brooke<div><br></div><div>-- <br> <table border="1"><tbody><tr><td align="left" valign="CENTER"><b><font size="+1">Martin Brooke</font></b> <br>

<font size="-1">Associate Professor</font>, <br><small>and Philip Baugh Scholar</small><br><font size="-1"><a href="http://www.ee.duke.edu" target="_blank">Department of Electrical and Computer Engineering</a></font><br>
<small>Box 90291</small><br>
<font size="-1"><a href="http://www.duke.edu/" target="_blank">Duke University</a></font><br><font size="-1">Durham, NC 27708-0291</font></td><td valign="top"><br><p><font size="-1"><b>Phone:</b> (919) 660-5504</font><br>

<font size="-1"><b>Secretary:</b> </font> <small>(919)-660-5252</small><br><font size="-1"><b>Fax:</b> </font>  <small>(919)-660-5293</small> <br><font size="-1"><b>E-Mail:</b> <a href="mailto:mbrooke@ee.duke.edu" target="_blank">mbrooke@ee.duke.edu</a></font></p>

</td><td valign="top"><br><br><b>Office:</b><br><br><small>3581 FCIEMAS Building<br>3rd Floor South Wing</small><br><small>Duke University<br>Durham, NC 27708</small><br><br><br><br></td><td valign="top"><br><br><b>Physical Delivery Address:</b><br>

<br><small>Department of Electrical and Computer Engineering<br>130 Hudson Hall<br>Duke University<br>Durham, NC 27708<br>Phone: (919)-660-5252</small><br><br></td></tr></tbody></table><center></center><center><table border="0" cellpadding="0" cellspacing="0">

<tbody><tr><td bgcolor="#ffffff"><a href="http://www.ee.duke.edu/%7Embrooke/index.html" target="_blank">[Home]</a></td><td bgcolor="#ffffff">[<a href="http://www.ee.duke.edu/%7Embrooke/00courses.html" target="_blank">Academic</a>]</td>

<td bgcolor="#ffffff"><a href="http://www.ee.duke.edu/%7Embrooke/00research.html" target="_blank">[Research]</a></td><td bgcolor="#ffffff">[<a href="http://www.ee.duke.edu/%7Embrooke/Papers.html" target="_blank">Publications</a>]</td>

<td bgcolor="#ffffff"><a href="http://www.ee.duke.edu/%7Embrooke/my_index.html" target="_blank">[More...]</a></td></tr></tbody></table></center></div>
</div>