| |
 |
|
|
Science Forum Index » Electronics - Misc Forum » Digital input to an IC - do I need a resistor?
Page 1 of 1
|
| Author |
Message |
| Pete Verdon |
Posted: Fri Jan 12, 2007 9:51 am |
|
|
|
Guest
|
Hi,
I'm currently designing a device based around a PIC microcontroller.
However, in getting to this point I have rather leapfrogged over more
basic electronics - I'm a software developer by trade. Any general
advice people care to give is welcome, but my specific question today is
whether I need to include resistors in digital input lines. That is, can
a pin which is configured on the chip as a digital input be connected
directly to a push-to-make button and thence to the power rail, or
should I include a resistor in series to limit the current that can
flow? (I'm aware that I will also need debounce, but intend to implement
this in firmware since the PIC is not working very hard).
The IC, if it matters, is Microchip's PIC16F914:
http://www.microchip.com/stellent/groups/picmicro_sg/documents/devicedoc/en020956.pdf
Thanks,
Pete |
|
|
| Back to top |
|
| Peter Bennett |
Posted: Fri Jan 12, 2007 1:49 pm |
|
|
|
Guest
|
On Fri, 12 Jan 2007 13:51:14 +0000, Pete Verdon
<news@verdonet.organisation.unitedkingdom.invalid> wrote:
Quote: Hi,
I'm currently designing a device based around a PIC microcontroller.
However, in getting to this point I have rather leapfrogged over more
basic electronics - I'm a software developer by trade. Any general
advice people care to give is welcome, but my specific question today is
whether I need to include resistors in digital input lines. That is, can
a pin which is configured on the chip as a digital input be connected
directly to a push-to-make button and thence to the power rail, or
should I include a resistor in series to limit the current that can
flow? (I'm aware that I will also need debounce, but intend to implement
this in firmware since the PIC is not working very hard).
If the switch is going to ground or the processor's Vcc, you don't
need a series resistor, but you will need a pull-up or pull-down
resistor to ensure that the input goes to the opposite state when the
switch is open.
From long experience with TTL logic, I would connect the switch from
the input pin to ground, and a 3 - 5K resistor from the input pin to
+Vcc. |
|
|
| Back to top |
|
| Guest |
Posted: Sat Jan 13, 2007 12:20 am |
|
|
|
|
If im not mistaken, PICs are voltage controlled devices. Meaning that
if you are inputting TTL voltages, you will not need a series resistor
to limit current flow (assuming your logic voltages are being generated
by other such devices). If your logic is somehow directly connected to
your Vcc (ie, a switch, or a transistor switch) then you will need a
series resistor because you will short your entire Vcc source to
ground..and that quite frankly...is bad..
eP
On Jan 12, 8:51 am, Pete Verdon
<n...@verdonet.organisation.unitedkingdom.invalid> wrote:
Quote: Hi,
I'm currently designing a device based around a PIC microcontroller.
However, in getting to this point I have rather leapfrogged over more
basic electronics - I'm a software developer by trade. Any general
advice people care to give is welcome, but my specific question today is
whether I need to include resistors in digital input lines. That is, can
a pin which is configured on the chip as a digital input be connected
directly to a push-to-make button and thence to the power rail, or
should I include a resistor in series to limit the current that can
flow? (I'm aware that I will also need debounce, but intend to implement
this in firmware since the PIC is not working very hard).
The IC, if it matters, is Microchip's PIC16F914:http://www.microchip.com/stellent/groups/picmicro_sg/documents/device...
Thanks,
Pete |
|
|
| Back to top |
|
| Gerard Bok |
Posted: Sat Jan 13, 2007 11:49 am |
|
|
|
Guest
|
On Fri, 12 Jan 2007 13:51:14 +0000, Pete Verdon
<news@verdonet.organisation.unitedkingdom.invalid> wrote:
Quote: I'm currently designing a device based around a PIC microcontroller.
However, in getting to this point I have rather leapfrogged over more
basic electronics - I'm a software developer by trade. Any general
advice people care to give is welcome, but my specific question today is
whether I need to include resistors in digital input lines. That is, can
a pin which is configured on the chip as a digital input be connected
directly to a push-to-make button and thence to the power rail, or
should I include a resistor in series to limit the current that can
flow?
No. You don't need a series-resistor to limit the current.
As others noted: you may need a pull-up or pull-down resistor.
But if you realy want to connect a push button, you may need
something else: a debounce circuit.
If you push the button near your frontdoor, your bell will
(simply) ring.
If you connect a push button to an electronic circuit it will
'see' a train of pulses, for upto 1 or 2 mSec at least.
Normally, you have to cope with that, either in software or by a
hardware circuit.
--
Kind regards,
Gerard Bok |
|
|
| Back to top |
|
| Pete Verdon |
Posted: Mon Jan 15, 2007 6:03 am |
|
|
|
Guest
|
Peter Bennett wrote:
Quote: Pete Verdon wrote:
my specific question today is whether I need to include resistors
in digital input lines. That is, can a pin which is configured on
the chip as a digital input be connected directly to a push-to-make
button and thence to the power rail, or should I include a resistor
in series to limit the current that can flow?
If the switch is going to ground or the processor's Vcc, you don't
need a series resistor, but you will need a pull-up or pull-down
resistor to ensure that the input goes to the opposite state when the
switch is open.
From long experience with TTL logic, I would connect the switch from
the input pin to ground, and a 3 - 5K resistor from the input pin to
+Vcc.
Thanks very much, that's really helpful.
How crucial is the resistor value, though? I ask because it seems my
colleagues are planning to use a lot of 10K resistors elsewhere; would
these be OK or is your 5K pretty much the limit?
Thanks,
Pete |
|
|
| Back to top |
|
| Peter Bennett |
Posted: Mon Jan 15, 2007 4:19 pm |
|
|
|
Guest
|
On Mon, 15 Jan 2007 10:03:09 +0000, Pete Verdon
<news@verdonet.organisation.unitedkingdom.invalid> wrote:
Quote: Peter Bennett wrote:
Pete Verdon wrote:
From long experience with TTL logic, I would connect the switch from
the input pin to ground, and a 3 - 5K resistor from the input pin to
+Vcc.
Thanks very much, that's really helpful.
How crucial is the resistor value, though? I ask because it seems my
colleagues are planning to use a lot of 10K resistors elsewhere; would
these be OK or is your 5K pretty much the limit?
10K should be fine - I'm probably stuck in an older, higher current,
era...
You might also put an 0.01 uF capacitor across the switch to reduce
the contact bounce problem. |
|
|
| Back to top |
|
| Pete Verdon |
Posted: Tue Jan 16, 2007 8:01 am |
|
|
|
Guest
|
Peter Bennett wrote:
Quote: On Mon, 15 Jan 2007 10:03:09 +0000, Pete Verdon wrote:
How crucial is the resistor value, though? I ask because it seems my
colleagues are planning to use a lot of 10K resistors elsewhere; would
these be OK or is your 5K pretty much the limit?
10K should be fine - I'm probably stuck in an older, higher current,
era...
Thanks. The order is going in very shortly!
Pete |
|
|
| Back to top |
|
| |
|
Page 1 of 1
All times are GMT - 5 Hours
The time now is Fri Jan 09, 2009 5:38 am
|
|