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.