Maker Pro
Maker Pro

Digital input to an IC - do I need a resistor?

P

Pete Verdon

Jan 1, 1970
0
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
 
P

Peter Bennett

Jan 1, 1970
0
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.
 
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
 
G

Gerard Bok

Jan 1, 1970
0
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.
 
P

Pete Verdon

Jan 1, 1970
0
Peter said:
Pete Verdon wrote:
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
 
P

Peter Bennett

Jan 1, 1970
0
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.
 
P

Pete Verdon

Jan 1, 1970
0
10K should be fine - I'm probably stuck in an older, higher current,
era...

Thanks. The order is going in very shortly!

Pete
 
Top