<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body 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">description</a>.<br>
<br>
<br>
-Pete<br>
<br>
<div class="moz-cite-prefix">On 04/10/2014 09:31 AM, Bill Farrow
wrote:<br>
</div>
<blockquote
cite="mid:CAPm8Nr1ceGD+aeO2WOVDR=oX2twdUAj_wTqaJV-8tEkGqgK6ow@mail.gmail.com"
type="cite">
<pre wrap="">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 class="moz-txt-link-abbreviated" href="mailto:TriEmbed@triembed.org">TriEmbed@triembed.org</a>
<a class="moz-txt-link-freetext" href="http://mail.triembed.org/mailman/listinfo/triembed_triembed.org">http://mail.triembed.org/mailman/listinfo/triembed_triembed.org</a>
TriEmbed web site: <a class="moz-txt-link-freetext" href="http://TriEmbed.org">http://TriEmbed.org</a>
</pre>
</blockquote>
<br>
</body>
</html>