Maintained input
StarMan
Posts: 306
Hi,
This is my first post.· I'm very new to this.· I'm a mechanical engineer with very little electronics experience.
I would like to build a custom board with a 24 pin socket to accept a BS2.· After programming the BS2 I will install it on the board and ship it to the end user.· I want to give the end user a choice of four pause times, one of which·will be contained within a DO LOOP.· The choice will be made once and then the board will be installed in a junction box in the wall.· The user will be able to change the pause times only by opening the junction box to access the board.· I plan to use either jumpers or DIP switches on pins·0·and 1.· Once the pause time is set in the program, the DO LOOP runs continuously until the power is turned off.
And now my question.· If I pull the two pins down with pulldown resistors and the user switches one or both of them high, will this fry anything?· Will there be a current draw the whole time the power is on or can I disconnect the pins with a command once the pause time is set.
I've done a fair amount of reading so far but perhaps I need to do more.· Please advise.
Thanks,
Chris Isaacson
·
This is my first post.· I'm very new to this.· I'm a mechanical engineer with very little electronics experience.
I would like to build a custom board with a 24 pin socket to accept a BS2.· After programming the BS2 I will install it on the board and ship it to the end user.· I want to give the end user a choice of four pause times, one of which·will be contained within a DO LOOP.· The choice will be made once and then the board will be installed in a junction box in the wall.· The user will be able to change the pause times only by opening the junction box to access the board.· I plan to use either jumpers or DIP switches on pins·0·and 1.· Once the pause time is set in the program, the DO LOOP runs continuously until the power is turned off.
And now my question.· If I pull the two pins down with pulldown resistors and the user switches one or both of them high, will this fry anything?· Will there be a current draw the whole time the power is on or can I disconnect the pins with a command once the pause time is set.
I've done a fair amount of reading so far but perhaps I need to do more.· Please advise.
Thanks,
Chris Isaacson
·
Comments
Normally make pin2 an input (so there will be no current even if the switches are closed).
When you want to read the switches, make pin2 an output and set it high, then read the switches and set pin2 back to an input.
Hope that makes sense.
············ 470Ohm···· · \
Pin 0·----\/\/\/\--+--o ·\---- Pin 2
························|
······················· |-\/\/\/\-- GND
····························· 10K
············ 470Ohm···· · \
Pin 1·----\/\/\/\--+--o ·\---- Pin 2
························|
······················· |-\/\/\/\-- GND
····························· 10K
The 470 Ohms resistor is just for insurance.
Bean.
Post Edited (Bean) : 11/11/2004 1:22:24 AM GMT
·· You can easily do what you're asking...If you connect DIP switches to 2 pins, and have them pulled low with say, 10K resistors, and the DIP switches tied high, then when the DIP switches are open, the pins will read as 0, when closed, the pins will read as 1.· Using a little advanced thought, you could tied the switches to a pin group so that the port can be read as a variable.
·· For example, if you used P0 & P1 (You would have to pull P2 & P3 low for this to work) then you could use code like:
Delay would equal 0, 1, 2 or 3, depending on the state of the 2 switches.· 4 possibilities.· Then you could assign your PAUSE variable based on the returned value.
As for the pulldown resistors, they will draw very little current.· Will this help?
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Knight Designs
324 West Main Street
P.O. Box 97
Montour Falls, NY 14865
(607) 535-6777
Business Page:·· http://www.knightdesigns.com
Personal Page:··· http://www.lightlink.com/dream/chris
Designs Page:··· http://www.lightlink.com/dream/designs
·
Clarification: Pins 2 thru 15 are being used.· If I had more pins I would use them as well but I don't want to upgrade to another BS.
Any other suggestions that use only 2 pins?
The attached diagram is for an active-low input; just change the pull-up to a pull-down (to Vss) to make it active-high.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
Dallas Office
Post Edited (Jon Williams) : 11/11/2004 3:56:25 AM GMT
The two pin solution is to hang your 8 position (8 bit) DIP switch off of a 74HC165 8-bit parallel-in, serial-out shift register, and use SHIFTIN to grab all 8 bits with one command. Bring +5V to each element of the DIP switch thorugh an appropriate resistor, and the other side of the DIP switch goes directly to the input pins of the 74HC165. The serial pins (clock and data) of the 74HC165 go directly to the two Stamp pins you've chosen to use.
If you find the need for more DIP switch input, there are also 16-bit (and more!) shift registers available.
Regards,
Bruce Bates
This will mask the bits from P2 & P3 off the value.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Knight Designs
324 West Main Street
P.O. Box 97
Montour Falls, NY 14865
(607) 535-6777
Business Page:·· http://www.knightdesigns.com
Personal Page:··· http://www.lightlink.com/dream/chris
Designs Page:··· http://www.lightlink.com/dream/designs
·
Chris Isaacson
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Knight Designs
324 West Main Street
P.O. Box 97
Montour Falls, NY 14865
(607) 535-6777
Business Page:·· http://www.knightdesigns.com
Personal Page:··· http://www.lightlink.com/dream/chris
Designs Page:··· http://www.lightlink.com/dream/designs
·