Parallax Forums
  HomeLog InRegisterCommunity CalendarSearch the ForumHelp
   
Parallax Forums > Public Forums > SX Microcontrollers, SX/B Compiler and SX-Key Tool > Is it normal for interrupt initialization to trigger the ISR? RESOLVED- Thanks Mojorizing!  Forum Quick Jump
 
New Topic Post Reply Printable Version
[ << Previous Thread | Next Thread >> ] | Show Newest Post First ]

CarlC
Registered Member

Email Address Not AvailablePersonal Homepage Not AvailablePrivate Messaging Not AvailableAIM Not AvailableICQ Not AvailableY! Not AvailableMSN Not Available
Date Joined Oct 2005
Total Posts : 29
 
   Posted 1/31/2006 9:15 PM (GMT -8)    Quote This PostAlert An Admin About This Post.
While stepping through in debug mode, I find that changing the mode register to set WKPEND causes a triggering of my ISR in my initialization segment.

mov W,#$19

I even tried initially biasing my pins high (pulled up pins not connected to ground) in case seeing a low pin right after activating interrupts was causing a problem without effect.

In normal operation, my ISR uses the state of the WKPEND register (swapped through W) to determine the cause of an interrupt. I have problems when the ISR is called outside of the normal means. I guess I could put in a work around by setting a flag in the main body so the ISR is skipped through if the main hasn't been reached yet, but I'm wondering if there's a proper way to avoid running the ISR after making interrupts available during initialization.

Post Edited (CarlC) : 2/1/2006 6:19:15 AM GMT

Back to Top
 

mojorizing
Registered Member



Email Address Not AvailablePersonal Homepage Not AvailablePrivate Messaging Not AvailableAIM Not AvailableICQ Not AvailableY! Not AvailableMSN Not Available
Date Joined Jul 2004
Total Posts : 141
 
   Posted 1/31/2006 9:59 PM (GMT -8)    Quote This PostAlert An Admin About This Post.
Hi Carl,
In your intialization code you need to clear the WKPEND register before you enable the wake ups following a sequence such as;


;------------------------ INITIALIZATION ROUTINE -----------------------

Initialize
        ;Edge Detection Configuration

        mov     W,#$19            ;Allow Wake-Up Pending access
        mov     M,W
        mov    !rb,#%00000000        ;Clear Wake-Up Pending (WKPND_B)


        mov    W,#$1A            ;Allow Wake-Up Edge configuration
        mov    M,W
        mov    !rb,#%11111111        ;Set port B bits 0-7 to falling edge

        mov    W,#$1B            ;Allow Wake-Up Enable configuration
        mov    M,W
        mov    !rb,#%11110000        ;Set port B bits 4-7 to normal, bits 0-3 to Wake-Up Enable

        mov    W,#$1E            ;disAllow Pull-up configuration
        mov    M,W                
        mov    !rb,#%11111111        ;Port B bits 0-7 without pullups

        mov    W,#$1F            ;Allow Direction configuration
        mov    M,W
        mov    !rb,#%11111111        ;Set port B bits 0-7 to input direction

        mov    W,#$19            ;Allow Wake-Up Pending access
        mov    M,W
        mov    !rb,#%00000000        ;Clear Wake-Up Pending (WKPND_B)


does this answer your question?


Bad spellers of the world untie!

Back to Top
 

CarlC
Registered Member

Email Address Not AvailablePersonal Homepage Not AvailablePrivate Messaging Not AvailableAIM Not AvailableICQ Not AvailableY! Not AvailableMSN Not Available
Date Joined Oct 2005
Total Posts : 29
 
   Posted 1/31/2006 10:18 PM (GMT -8)    Quote This PostAlert An Admin About This Post.
Thanks mojo,

that was exactly my problem. I forgot to clear all the interrupt flags before enabling the interrupts.
Back to Top
 
[ << Previous Thread | Next Thread >> ]
New Topic Post Reply Printable Version
 
Forum Information
Currently it is Friday, November 20, 2009 10:32 PM (GMT -8)
There are a total of 393,733 posts in 55,521 threads.
In the last 3 days there were 82 new threads and 701 reply posts. View Active Threads
Who's Online
This forum has 17687 registered members. Please welcome our newest member, mark09.
66 Guest(s), 6 Registered Member(s) are currently online.  Details
JRetSapDoog, Chris Savage (Parallax), mpark, Kye, Sal Ammoniac, micromang