U¿ytkownik Fahrni Pascal <[email protected]> napisa³:
Hi Pascal, it is your fault.
>Hi,
>I have a phenomenon with interrupts and LPM which seams very strange to me.
>I have two methods (A and B) that I think should do the same, but they don't.
>The difference is, where the Interrupt enable bit is cleared.
>My device goes to sleep by timeout or by user command in menu. Some other code
>I omitted for this post is executed when entering and returning from sleep.
>Device wakes up by button press.
>
>behaviour in A:
>Device goes to sleep, by execution of GoSleeping(). Then the button is pressed
>and device wakes up. When going to sleep for the second time, the device will
>never more wake up, when pressing the button.
>
>behaviour in B:
>It works as it should (for my application). Device can be putted in sleep and
>waked up again as many times you want.
>
>Where is the problem in clearing the interrupt enable during the ISR? Or is
>the difference in behaviour caused by something else?
>I hope I post enough to localize the cause. If not please ask me for more
>details.
>
>void GoSleeping(void){
>P2IE |= 0x10; // Enable interrupt
This is error. You shoud first clear flag, next enable interrupts.
In method A here interupt is called (due to switch bounce)
And interrupt function clear P2IE ;-(
>P2IFG &= ~0x10; // clear interrupt flag
>
>_BIS_SR(LPM4_bits);// Enter LPM4 w/ interrupt
So never wakeup.
>P2IE &=~ 0x10; // In method B here
>}
>
>// P2.x isr
>interrupt (PORT2_VECTOR) Port2 (void){
> if(P2IFG & 0x10) {
> P2IE &=~ 0x10;// In method A here
> P2IFG &= ~0x10;// clear interrupt flag (line can be omitted)
> _BIC_SR_IRQ(LPM4_bits);// LPM4_EXIT;
> }
>}
>
>I use:
>- msp430F169
>- mspgcc toolkit Build date: 20070216
>
>
>Best Regards
>
>Pascal
>--------------------------------------------------------
>
>Disclaimer
>This message might contain confidential and privileged information and is
>intended only for the individuals or entities to which it is addressed. It
>should not be copied, reviewed, retransmitted, disseminated or otherwise used
>by persons or entities other than the intended recipient. If this message was
>received in error, please contact the sender and delete the material from your
>computer system(s).
>Receipt of this message does neither generate any right of further use nor
>entitles the recipient to file and/or obtain any intellectual property rights
>based thereon.
>
>-------------------------------------------------------------------------
>This SF.net email is sponsored by: Splunk Inc.
>Still grepping through log files to find problems? Stop.
>Now Search log events and configuration files using AJAX and a browser.
>Download your FREE copy of Splunk now >> http://get.splunk.com/
>_______________________________________________
>Mspgcc-users mailing list
>[email protected]
>https://lists.sourceforge.net/lists/listinfo/mspgcc-users
>