In SX Microcontrollers, SX/B Compiler and SX-Key Tool, dkemppai wrote: Paul, [2] I'm posting the routine that I use to put the SX to sleep. As for my wakeup routine, I check the Power Down bit, and run the wakeup routine, or initialization routine depending of if the SX was reset from sleep or normal powerup. If the SX was reset from a sleep mode, I read the WKPND_B register, pulse an IO pin several times (Temporary routine), and put the SX to sleep again. On a normal powerup, I initialize some external IC's and then put the SX to sleep. I'm pretty sure all of my code is correct. The SX wakes up as expected, when expected, just not with the correct value in WKPND_B. If I move my code to the ISR vector, and run the code with the an endless loop in place of the sleep command, my code functions as I would expect it to. I'm wondering if the resetting of the direction register or Edge configuration register on wakeup is causing the WKPND_B to show that all pins had a transition? I don't know. At this point, I'm sure it's not my code. However, I can't prove it. I wish I could post my current code, but due to business agreements I cannot. As time permits I will try to generate and example showing my issues. [/2] Thanks! -Dan [code] ;---------------Sleep Routine to Power Down the SX Chip----------------------- SX_Sleep BANK BANK6 MOV RA_Shadow,RA ;Copy Ports to Shadow Register MOV RC_Shadow,RC ;Copy Ports to Shadow Register ;Set Mode (WKED_B) to Allow Edge Configuration MODE $0A ;Mode for Edge Configuration MOV !RB,#%00000000 ;0 = Rising Edge, 1 = Falling ;Set Mode (WKEN_B) to Allow Wake Up Configuration. MODE #$0B ;Set Mode for Wakeup Config MOV !RB,#WakeupMask ;1 = No Wakeup, 0 = Wakeup ;Set Mode for Direction Register MODE $0F ;0 = Output, 1 = Input MOV !RB,#%11111111 ;Clear Pending Register to Allow Interrupts. MODE #$0B ;Mode to Set Wakeup Pins MOV !RB,#WakeupMask ;1 = No Wakeup, 0 = Wakeup SLEEP ;--------------- End Sleep Routine -------------------------------------------- [/code] ---------- End of Message ---------- You can view the post on-line at: http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=78775#m79119 Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2005 (http://www.dotNetBB.com)