Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.arch.embedded > #28059

Re: How do you read digital inputs from microswitch, jumpers, dip-switches...?

From David Brown <david.brown@hesbynett.no>
Newsgroups comp.arch.embedded
Subject Re: How do you read digital inputs from microswitch, jumpers, dip-switches...?
Date 2018-09-21 11:09 +0200
Organization A noiseless patient Spider
Message-ID <po2ch2$pgs$1@dont-email.me> (permalink)
References <pnvqld$pfh$1@dont-email.me> <po0460$10nr$1@gioia.aioe.org> <po27ck$t0e$1@dont-email.me>

Show all headers | View raw


On 21/09/18 09:42, pozz wrote:
> Il 20/09/2018 14:35, John Speth ha scritto:
>> On 9/20/2018 2:52 AM, pozz wrote:
>>> Often I have digital inputs connected to switches managed by the
>>> user. For example: microswitches, tactile switches, push-buttons,
>>> dip-switches, simple jumpers and so on.
>>>
>>> What is your preferred method to read the status of this inputs?
>>
>> Typically dip-switches and jumpers are used for easy user system
>> configuration so FW will read them at init time and never again.  
> 
> Sincerely I don't like this approach.  When I, as a user, read the
> manual that says "dip-switch 1 enables option 1", I think I can change
> its position at any time.  Maybe somewhere the manual says "Dip-switches
> are read only at startup, so power cycle or press RESET button when you
> change them"... but it's not friendly.
> 
> When possible I read dip-switches during normal working.

That will depend entirely on what the DIP switches are for.  In some
cases it makes sense to be able to change them at run-time.  In other
cases, it does not.

A compromise that I have used on a number of systems is to read the DIP
switches at reset.  Then I also read them regularly while running - and
if they have changed, I reset the card.  That gives the best of both worlds.

> 
> 
>> Of course, requirements dictate it so it's not a rule.  If you really
>> do need to read these kinds of switches periodically, your user
>> requirements will tell you to debounce or not.  It comes down to the
>> answer to this question: Will the consequences of ever misreading the
>> switches have a negative effect on the function?
> 
> Generally yes.
> 

DIP switches read at reset don't need debouncing to be stable.  You only
get bouncing when you read the switches at approximately the same time
as a user is changing them.  So DIP's read at reset are always stable.
(If they are not, it's time to fix your power supply!)

> 
>> Push buttons and tactile switches are typically used in occasional
>> user interactions.  They are typically debounced but, as always, you
>> need to ask the same question as above about whether to debounce or not.
>>
>> Advice from the trenches: A brand new switch will often not display
>> characteristics requiring debouncing but it very well might as it ages
>> and collects dirt, etc.  Plan for that possibility when you are
>> deciding to debounce or not.
> 

Back to comp.arch.embedded | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

How do you read digital inputs from microswitch, jumpers, dip-switches...? pozz <pozzugno@gmail.com> - 2018-09-20 11:52 +0200
  Re: How do you read digital inputs from microswitch, jumpers, dip-switches...? John Speth <johnspeth@yahoo.com> - 2018-09-20 05:35 -0700
    Re: How do you read digital inputs from microswitch, jumpers, dip-switches...? pozz <pozzugno@gmail.com> - 2018-09-21 09:42 +0200
      Re: How do you read digital inputs from microswitch, jumpers, dip-switches...? David Brown <david.brown@hesbynett.no> - 2018-09-21 11:09 +0200
        Re: How do you read digital inputs from microswitch, jumpers, dip-switches...? Grant Edwards <invalid@invalid.invalid> - 2018-09-24 14:53 +0000
          Re: How do you read digital inputs from microswitch, jumpers, dip-switches...? gnuarm.deletethisbit@gmail.com - 2018-09-29 12:34 -0700
      Re: How do you read digital inputs from microswitch, jumpers, dip-switches...? Andrew Smallshaw <andrews@sdf.org> - 2018-09-21 09:16 +0000
      Re: How do you read digital inputs from microswitch, jumpers, dip-switches...? gnuarm.deletethisbit@gmail.com - 2018-09-21 06:22 -0700
        Re: How do you read digital inputs from microswitch, jumpers, dip-switches...? Robert Wessel <robertwessel2@yahoo.com> - 2018-09-21 10:04 -0500
          Re: How do you read digital inputs from microswitch, jumpers, dip-switches...? lasselangwadtchristensen@gmail.com - 2018-09-21 14:47 -0700
            Re: How do you read digital inputs from microswitch, jumpers, dip-switches...? Robert Wessel <robertwessel2@yahoo.com> - 2018-09-22 21:57 -0500
              Re: How do you read digital inputs from microswitch, jumpers, dip-switches...? Andrew Smallshaw <andrews@sdf.org> - 2018-09-23 04:55 +0000
              Re: How do you read digital inputs from microswitch, jumpers, dip-switches...? gnuarm.deletethisbit@gmail.com - 2018-09-22 22:55 -0700
          Re: How do you read digital inputs from microswitch, jumpers, dip-switches...? gnuarm.deletethisbit@gmail.com - 2018-09-22 09:27 -0700
          Re: How do you read digital inputs from microswitch, jumpers, dip-switches...? Grant Edwards <invalid@invalid.invalid> - 2018-09-24 14:57 +0000
            Re: How do you read digital inputs from microswitch, jumpers, dip-switches...? Ed Prochak <edprochak@gmail.com> - 2018-10-05 09:52 -0700
              Re: How do you read digital inputs from microswitch, jumpers, dip-switches...? Richard Damon <Richard@Damon-Family.org> - 2018-10-05 14:40 -0400
              Re: How do you read digital inputs from microswitch, jumpers, dip-switches...? gnuarm.deletethisbit@gmail.com - 2018-10-05 12:48 -0700
  Re: How do you read digital inputs from microswitch, jumpers, dip-switches...? Robert Wessel <robertwessel2@yahoo.com> - 2018-09-20 23:38 -0500
  Re: How do you read digital inputs from microswitch, jumpers, dip-switches...? Chris <xxx.syseng.yyy@gfsys.co.uk> - 2018-09-21 14:43 +0100
    Re: How do you read digital inputs from microswitch, jumpers, dip-switches...? Grant Edwards <invalid@invalid.invalid> - 2018-09-24 15:00 +0000
      Re: How do you read digital inputs from microswitch, jumpers, dip-switches...? Richard Damon <Richard@Damon-Family.org> - 2018-09-25 06:57 -0400
        Re: How do you read digital inputs from microswitch, jumpers, dip-switches...? Chris <xxx.syseng.yyy@gfsys.co.uk> - 2018-09-25 15:12 +0100
          Re: How do you read digital inputs from microswitch, jumpers, dip-switches...? Richard Damon <Richard@Damon-Family.org> - 2018-09-28 08:10 -0400
            Re: How do you read digital inputs from microswitch, jumpers, dip-switches...? Chris <xxx.syseng.yyy@gfsys.co.uk> - 2018-09-28 15:43 +0100
              Re: How do you read digital inputs from microswitch, jumpers, dip-switches...? Richard Damon <Richard@Damon-Family.org> - 2018-09-28 21:23 -0400
              Re: How do you read digital inputs from microswitch, jumpers, dip-switches...? Richard Damon <Richard@Damon-Family.org> - 2018-09-28 21:42 -0400
              Re: How do you read digital inputs from microswitch, jumpers, dip-switches...? Ed Prochak <edprochak@gmail.com> - 2018-10-05 10:04 -0700

csiph-web