Home
JAQForum Ver 20.06
Log In or Join  
Active Topics
Local Time 20:49 29 Apr 2024 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : Hardware Debounce for Micromite?

     Page 2 of 2    
Author Message
robert.rozee
Guru

Joined: 31/12/2012
Location: New Zealand
Posts: 2289
Posted: 04:40am 18 Oct 2014
Copy link to clipboard 
Print this post

well now, you see the rabbit hole is rather deep, and we have just fallen down quite a bit further:

http://en.wikipedia.org/wiki/Wetting_current

i do always like to keep a bit of current flowing through a switch when closed, in order to break through any contact oxidisation and maintain the wires to the switch at a fairly low impedance when the switch is open. a milliamp or thereabouts is a pretty good rule of thumb.

this leaves one inclined to keep the 1k5 pullup resistor (R1) unchanged, and bump up just the 15k resistor (R2) or 0.1uF capacitor.



i've just checked the input leakage of a 32MX150 digital pin, and it is extremely high. so one can safely push R2 up to 150k, and C up to 1uF or more. but, beware - not all devices have such high impedance input pins.

as for contact bounce, 100mS or more is an extremely long time. if a switch exhibits this sort of bounce it is perhaps unsuitable for the job (has wiper contacts) or best made use of to augment the rubbish bin contents.

a valid approach is also to consider using 2 input pins per switch. in critical applications this is not uncommon.


rob :-)
 
paceman
Guru

Joined: 07/10/2011
Location: Australia
Posts: 1328
Posted: 03:59pm 18 Oct 2014
Copy link to clipboard 
Print this post

Well yes the rubbish bin would be a good place for it except you wouldn't know that unless you tested it with a scope - and it looks like a common enough switch. Using two pins would be a very uncommon approach for most of us Micro/Maxi-Miter's but for critical or big systems certainly an option - but if you were designing them you'd presumably be well au fait with switch bounce issues. Anything permanently powered or only intermittently used wouldn't worry about 1mA 'wasted' through the switch either but lots of battery powered things wouldn't want 1mA running constantly.

Depending how you read his page 4 graph, there looks to be six of the eighteen switch types with either one or both of the open/close bounce times between 20 and 60mS, which is a bit surprising, and then there's that bad standout at 150. The good news from his tests though is that most of the small PCB ones we'd commonly use are pretty good, i.e. <10mS. Inputs from limit switches is one you'd have to watch carefully if your application was controlling moving things.

I wonder how different R1/R2/C combinations of that circuit might affect a rotary encoder (as in page 22 of the MicroMite Manual) and the rotation speed you could accurately track. Comparisons of that and also TZ's MMBasic code Vs a 'C' plugin, a la Geoff's new plugin feature, would be interesting. Not that it would matter much for just setting parameters on a project, but for some jobs it would matter.

Greg
 
     Page 2 of 2    
Print this page


To reply to this topic, you need to log in.

© JAQ Software 2024