Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Question about AVR internal pullup for input

Status
Not open for further replies.

andyyau

Junior Member level 2
Joined
Jul 12, 2002
Messages
24
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
116
Hello,

When I use ATMEL AVR MCU, it has internal pullup for input. If I connect a push button switch to this pullup input pin, shall I add a resister to this pin? If so what is the value of the resistor or what is it current?

Thanks!
 

avr pullup resistor

The AVR datasheet will tell you what the I/O current limit may be. For the AVRs that I have used, it has been 20ma.

You do not need any current limiting resistor to pull an input low - a push button switch connected between the input and the power supply negative will do the job.

Often in AVR application schematics, you will see a resistor (about 470 ohms) added in series to limit the current to 10ma if the switch is accidentally subjected to a static discharge that causes the input limiting MOS pullup resistor to break down. In most applications the added resistor is unnecessary.
 

avr internal pullup

House_Cat,

Thanks!

I also find a problem for a normally open push button switch. If it is open and the micro is placed at high noise environment, I find that noise will make program reads "0" for the input pin even the switch is not pushed. Adding a small capacitor to the pin solves the problem. Is this correct way to do?
 

avr pullup

Yew I think it's the right way.
 

avr pull up resistor

Hi,

You can use and software solution instead capacitors.

Always be carefull with capacitator and pull-up inputs.

If you take large capacitors you will charge capacitor with constatnt current source and shift input DC level.

Beter solution is to use CMOS buffers (e.g Schmit triggers) without pull-up and capacitor.

Another solution is to turn of pull-up from AVR I/O pin and add external R and C to push button.

Optimal solution :) is to use software integrator without any external components.

You need to make finite loop and monitor state on I/O pin.

.equ INTEGRATOR_CONST = 64;

ldi r16,INTEGRATOR_CONST;

LOOP:
sbic PORTB,PUSHBUTTON
rjmp LOOP_EXIT
dec r16
brne LOOP

; Push button is pressed

. . .

LOOP_EXIT:

; Push button is not pressed

. . .


You can set desired time of integration (integrator constant) with .equ directive.

For better noise imunity use large integrator constant. This is equivalent to larger input capacitor and incresed time delay.

If time delay is not problem use large integrator constant for better noise imunity.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top