Skip to main content
Visitor II
August 20, 2004
Question

Spurious interrupts

  • August 20, 2004
  • 4 replies
  • 1058 views
Posted on August 20, 2004 at 09:46

Spurious interrupts

    This topic has been closed for replies.

    4 replies

    isaqueAuthor
    Visitor II
    June 28, 2004
    Posted on June 28, 2004 at 14:52

    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 ]
    Visitor II
    June 28, 2004
    Posted on June 28, 2004 at 19:09

    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

    sjo
    isaqueAuthor
    Visitor II
    June 30, 2004
    Posted on June 30, 2004 at 15:57

    Thanks, when button is pressed it goes Low (GND), my debounce routine has 66ms. Can it be caused by EMC disturbances?

    Visitor II
    August 20, 2004
    Posted on August 20, 2004 at 09:46

    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).