RC network to extend High on a Pin
Erlend
Posts: 612
in Propeller 1
In my program I have a loop going around checking inputs and doing stuff. In general this is ok, but there are a few momentary inputs that could be too short - e.g. a pushbutton. The idea (has probably already been invented but cannot find it) is to connect the input from the pushbutton though R to the input Pin, but having a, say 47uF capacitor to keep it high for a while, preferably until the input Pin has been read (and thereafter made an output=0 to discharge the capacitor).
Questions are:
1) How high is the input Pin impedance, i.e. how long can I expect the signal to be High?
2) How robust is the output circuit, i.e. is 47uF@3.3V too much energy to discharge?
3) Is this silly because there is a much simpler way to do it?
Erlend
Questions are:
1) How high is the input Pin impedance, i.e. how long can I expect the signal to be High?
2) How robust is the output circuit, i.e. is 47uF@3.3V too much energy to discharge?
3) Is this silly because there is a much simpler way to do it?
Erlend
Comments
I prefer to have switches connect to ground rather than the supply as it is much safer (shorts/shielding etc) especially when you run off board.
Not sure how long the cap would retain a charge to keep the input pin high but that should be fairly easy to establish.
http://www.emesystems.com/OLDSITE/OL2wind.htm#Interface_using_the_COUNT_command_
http://emesystems.com/OLDSITE/OWL2rain.htm
I think you work with weather instruments too, say, cup anemometers and rain gages, where the switch closure or pulse can be quite short and asynchronous. If reed switches (or mechanical pushbuttons) are involved, don't discharge a capacitor through the switch itself, which can arc and eventually weld or degrade the contacts. Also, as you noted, don't discharge a big capacitor into the µC pin. Use a a couple of hundred ohms between the capacitor and the pin to be safe. The capacitor also serves the purpose of debouncing the signal from mechanical relay or button contacts.
With weather instruments, the pull-up R or a rain gage or anemometer needs to be strong, because, per Murphy, eventually the path to the instrument will get wet and will leak electrons like crazy, which is bad if you are storing the event on the dynamic memory of a capacitor. For the most part, reed relays are a thing of the past in anemometers, so the pulse may be clean but still short, via a solid state detector that is powered by the charge on a local capacitor.
With the BASIC Stamp -p series, you also had the option to use the latched modes of the POLLed inputs. The equivalent on the Propeller is to use a cog counter to store the pulses that arrive at an input pin. Or simply dedicate a cog to pin monitoring and debouncing, so that a main cog can retrieve the relevant info at leisure.