Shop OBEX P1 Docs P2 Docs Learn Events
Need help with interrupts....AGAIN — Parallax Forums

Need help with interrupts....AGAIN

ShaileshShailesh Posts: 4
edited 2005-05-12 07:08 in General Discussion
Hello All,

I have just ONE question regarding the SX52 interrupts. It goes as follows:

If i have enabled just one interupt on pin rb.4 shouldnt WKPND contain either 10h or 00h only? There are other pins also on portB which toggle from 0 to 1 but the interrupts for those pins HAVE NOT BEEN ENABLED. Nonetheless, values such as 30h or 18h seem to appear in the WKPND register. Could someone please pretty please help me with this one? I most certainly am running out of ideas but still havent given up hope and most certainly wont in the future either (1st law of programming!). Please advice.

Regards,
Shailesh

Comments

  • Guenther DaubachGuenther Daubach Posts: 1,321
    edited 2005-05-10 16:45
    Shailesh,

    the WKPND register reflects the status of all relevant port B bit changes since the register was cleared last, no matter if some of its bits have been enabled to generate interrupts. or not.

    Think of the "special" port B registers in three steps:

    1: The bits in the WKED_B register define which signal edges of the associated port bits shall affect the matching bit in the WKPND_B register (1 = high to low, 0 = low to high).

    2: When a transition occurs on one of the port B pins according to the definition of the associated bits in the WKED_B register, the matching bits in WKPND_B will be set.

    3: When the matching bit in the WKEN_B register is cleared, a change from 0 to 1 in the WKPND_B register will either issue an interrupt, or a wake-up (in case the SX is in sleep mode).

    IMO, the designers of the SX made a wise decision to NOT only allow bit status changes in the WKPND_B register when they were enabled for interrupts or wakeups by the associated bits in the WKEN_B register. This allows you to recognize short port B transitions even outside of an interrupt routine in a polling loop. Instead of reading the port B input states, just retrieve the status of the WKPND_B bits to catch signal edges you might miss when directly polling the port B input pins at a slow rate.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Greetings from Germany,

    G
  • ieSX52ieSX52 Posts: 15
    edited 2005-05-11 13:39
    Shailesh,

    yeah,if you want to enable only one pin(pin rb.4) to issue an interrupt.You should only clear the corresponding bit in the WKEN_B register.

    Upon reset, the WKEN_B register is set to FFh. This disables the wakeup interrupts by default. You must explicitly enable any pins that you want to use as wakeup/interrupt pins.

    Upon reset, the WKPND_B register contains unknown data. Therefore, the program should clear this register to zero before it enables the Multi-Input Wakeup function in the WKEN_B register. Otherwise, the program will not be able to determine which pin received the wakeup signal.

    To prevent false interrupts, you should clear bits in WKEN_B to enable pins to issue interrupts as the last step in a sequence of Port B configuration steps.
  • ShaileshShailesh Posts: 4
    edited 2005-05-11 16:48
    Hello G
  • Guenther DaubachGuenther Daubach Posts: 1,321
    edited 2005-05-12 07:08
    Hello Shailesh,

    well, actually, there is some information about prot B interrupts in the SX 48/52 data sheet (mine is dated April, 2002).

    On page 13, the function of the WKEN_B, WKED_B, and WKPND_B configuration registers is explained briefly. On pages 23 and 24, you will find a more detailed description of how the interrupts work plus a diagram, showing the functional blocks for a port B pin.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Greetings from Germany,

    G
Sign In or Register to comment.