--_003_BN6PR12MB18424F7DD220FBD53BC06DD7FD370BN6PR12MB1842namp_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Some ASCII art attached which explains the connection I (and David before m= e) was explaining. This is explained in tip #1 of the document you linked t= o before. http://ww1.microchip.com/downloads/en/DeviceDoc/01146B_chapter%202.pdf Suppose RA0 is a spare I/O and your DIP switches are connected to RB0-RB7. = Connect the resistors to RA0 as the "art". Make RA0 an OUTPUT and RB INPUTS= .. They stay that way. When you want to read the DIP switches, set RA0 to '1= '. Closed switches now read as '0' and open switches as '1'. Current flows = through the resistors of the closed switches. Once done, set RA0 to '0'. No= w there will be no current even through the closed switches because both si= des are at the same 0V. IF you read the switches now you would get all '0's= but you won't read them because you know they are "off". Why do other people do it other ways? Their needs are different and/or they= don't know of other ways. Tip #1! Stephen (Do attachments come through with the digest? Here is what is in it but you= might need to reformat into fixed space font: 3.0V =20 | ------------- | Vdd |------ | RA0 |---------------------- | | | | | | > > > > resistors | > > ...... > > 1.2kohm (min) | > > > > . | | | | | RB0 |----| | | | RB1 |-------| | | . | | | | | . | | | | | . | | | | | RB6 |------------------| | RB7 |---------------------| | | | | | | | | | | | / / / /DIP Switches | / / / / | | | | | | | | | | Vss |---------------------- | | ------------- v GND ) -----Original Message----- From: piclist-bounces@mit.edu [mailto:piclist-bounces@mit.edu] On Behalf Of= James Wages Sent: Friday, 31 March 2017 12:29 PM To: piclist@mit.edu Subject: Re: [PIC] RE: PIC Weak Pull-ups & DIP Switches Gentlemen,=20 Thank you for your replies. My comments are as follows... - - - - - - - - - - - - - - - - - - - - - - - Thu, 30 Mar 2017, stephen.forrest@agilent.com: > Make that pin an output and set it to '1' when you want to read the=20 > switches. Set it to '0' > otherwise - zero current now, regardless of the switch setting. You=20 > have maximum of 20 mA drive (depending on PIC) at 3.0 V so about > 1.2 K ohm minimum per switch. Now you also need to take account of the=20 > time for the inputs to stabilize after turning on the pull-ups... Stephen, you are suggesting almost the same thing as Alan in that no extern= al pull-ups should be used at all, and software wizardry should solve the p= roblem. But more specifically, what you seem to be saying is that the PIC = "INPUTS" (which in my case are tied to DIP switches, the opposite side bein= g to Ground, or inputs tied to NPN or PNP circuits -- see my PNG schematic = below) be set to OUTPUTS (at voltage level LO), and then when I want to REA= D I would first need to ENABLE the PIC's INTERNAL WEAK PULL-UPS (which are = not available for all I/O pins), wait for things to stabilize, then READ, t= hen switch back to the Output (LO). That would add complexity to the code,= but I agree it seems reasonable to eliminate external pull-ups. =20 If I am not understand what you or Alan meant, my apologizes. I simply nee= d a bit more explanation from you. Thank you, James Wages -- http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive View/chang= e your membership options at http://mailman.mit.edu/mailman/listinfo/piclis= t --_003_BN6PR12MB18424F7DD220FBD53BC06DD7FD370BN6PR12MB1842namp_ Content-Type: text/plain; name="PIC.txt" Content-Description: PIC.txt Content-Disposition: attachment; filename="PIC.txt"; size=1029; creation-date="Fri, 31 Mar 2017 03:49:15 GMT"; modification-date="Fri, 31 Mar 2017 04:12:18 GMT" Content-Transfer-Encoding: base64 DQogICAgICAgICAgICAgICAgIDMuMFYgIA0KICAgICAgICAgICAgICAgICAgfA0KLS0tLS0tLS0t LS0tLSAgICAgfA0KICAgICAgICBWZGQgfC0tLS0tLQ0KICAgICAgICAgICAgfA0KICAgICAgICBS QTAgfC0tLS0tLS0tLS0tLS0tLS0tLS0tLS0NCiAgICAgICAgICAgIHwgICAgfCAgfCAgICAgICAg ICB8ICB8DQogICAgICAgICAgICB8ICAgID4gID4gICAgICAgICAgPiAgPiByZXNpc3RvcnMNCiAg ICAgICAgICAgIHwgICAgPiAgPiAuLi4uLi4gICA+ICA+IDEuMmtvaG0gKG1pbikNCiAgICAgICAg ICAgIHwgICAgPiAgPiAgICAgICAgICA+ICA+DQogICAgICAgICAuICB8ICAgIHwgIHwgICAgICAg ICAgfCAgfA0KICAgICAgICBSQjAgfC0tLS18ICB8ICAgICAgICAgIHwgIHwNCiAgICAgICAgUkIx IHwtLS0tLS0tfCAgICAgICAgICB8ICB8DQogICAgICAgICAuICB8ICAgIHwgIHwgICAgICAgICAg fCAgfA0KICAgICAgICAgLiAgfCAgICB8ICB8ICAgICAgICAgIHwgIHwNCiAgICAgICAgIC4gIHwg ICAgfCAgfCAgICAgICAgICB8ICB8DQogICAgICAgIFJCNiB8LS0tLS0tLS0tLS0tLS0tLS0tfCAg fA0KICAgICAgICBSQjcgfC0tLS0tLS0tLS0tLS0tLS0tLS0tLXwNCiAgICAgICAgICAgIHwgICAg fCAgfCAgICAgICAgICB8ICB8DQogICAgICAgICAgICB8ICAgIHwgIHwgICAgICAgICAgfCAgfA0K ICAgICAgICAgICAgfCAgICAgLyAgLyAgICAgICAgICAvICAvRElQIFN3aXRjaGVzDQogICAgICAg ICAgICB8ICAgIC8gIC8gICAgICAgICAgLyAgLw0KICAgICAgICAgICAgfCAgICB8ICB8ICAgICAg ICAgIHwgIHwNCiAgICAgICAgICAgIHwgICAgfCAgfCAgICAgICAgICB8ICB8DQogICAgICAgIFZz cyB8LS0tLS0tLS0tLS0tLS0tLS0tLS0tLQ0KICAgICAgICAgICAgfCAgICAgICAgICAgIHwNCi0t LS0tLS0tLS0tLS0gICAgICAgICAgICB2DQogICAgICAgICAgICAgICAgICAgICAgICBHTkQ= --_003_BN6PR12MB18424F7DD220FBD53BC06DD7FD370BN6PR12MB1842namp_ Content-Type: text/plain; name="ATT00001.txt" Content-Description: ATT00001.txt Content-Disposition: attachment; filename="ATT00001.txt"; size=224; creation-date="Fri, 31 Mar 2017 04:27:44 GMT"; modification-date="Fri, 31 Mar 2017 04:27:44 GMT" Content-Transfer-Encoding: base64 LS0gDQpodHRwOi8vd3d3LnBpY2xpc3QuY29tL3RlY2hyZWYvcGljbGlzdCBQSUMvU1ggRkFRICYg bGlzdCBhcmNoaXZlDQpWaWV3L2NoYW5nZSB5b3VyIG1lbWJlcnNoaXAgb3B0aW9ucyBhdA0KaHR0 cDovL21haWxtYW4ubWl0LmVkdS9tYWlsbWFuL2xpc3RpbmZvL3BpY2xpc3QNCg== --_003_BN6PR12MB18424F7DD220FBD53BC06DD7FD370BN6PR12MB1842namp_-- .