2004-08-20 12:46 AM
2004-06-28 05:52 AM
ST72F264G2
Hello, I have a push-button on PC1, when its pressed the pin goes high (+5V). The pin is configured as input interrupt. ld A, #$18 ; load A with XX01 1000 ld PCDDR, A ; configures port C[3..4] as output push-pull ld A, #$1A ; load A with XX01 1010 ld PCOR, A ; port C Option Register sim ld A, #$c0 ; rising and falling edge ld MISCR1, A rim When the button is pressed/released a LED should toggle ON/OFF, but sometimes it toggles without an action. How can I prevent it? [ This message was edited by: ycks on 28-06-2004 18:23 ]2004-06-28 10:09 AM
As this pin has a pullup when in interrupt mode you would normally connect the other side of the button to gnd.
When the level goes low (falling edge) you would detect the button press. It also would be normal to have debounce in software (min 10ms), depending on whether you use external pullup resistor. Regards sjo2004-06-30 06:57 AM
Thanks, when button is pressed it goes Low (GND), my debounce routine has 66ms. Can it be caused by EMC disturbances?
2004-08-20 12:46 AM
It can indeed. Try an external pullup (i.e. 10k) to enhance robustness. Internal pullups can be quite weak (the spec says 80 kOhm to 250kOhm).