This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

LEA中断问题

Other Parts Discussed in Thread: MSP-DSPLIB, MSP430FR5992

我用的是msp430fr5992,最近在尝试使用MSP-DSPLib里的API来实现矩阵的加法运算(使用了LEA功能),现在的问题是我把相关代码移植到我的工程后,程序全速运行时,当计算完矩阵加法后一直处在LEA中断服务程序中,无法退出继续执行其他程序。矩阵加法计算的结果是对的。

中断程序如下:

#pragma  vector = LEA_VECTOR

__interrupt void LEA_isr(void)

{

LEAIFG=0;

LPM0_EXIT;

}

说明:刚开始的时候中断里面只有退出休眠的语句,后来加了清除标志的语句,都不能退出中断。之前从哪看到过说程序调用了lea功能后会进入LPM0,计算完成后会产生中断,所有我才这样写了,不知道错在哪了?求专家指点!!

  • 是的,您可以看一下 http://dev.ti.com/tirex/#/?link=Software%2FMSP430Ware%2FLibraries%2FDSPLib%2FUser's%20Guide

    Low Power Mode Usage

    Functions using LEA will enter LPM0 with interrupts enabled while LEA is running to achieve the lowest possible energy. The LEA interrupt routine is provided by DSPLib and will wake the device upon completion of the command. The application is free to leave other interrupts enabled and service them as needed, exiting from the interrupt back into LPM0.

    关于LEA中断的使用,您可以看一下下面的代码,希望对您有所帮助!

    /* --COPYRIGHT--,BSD
     * Copyright (c) 2017, Texas Instruments Incorporated
     * All rights reserved.
     *
     * Redistribution and use in source and binary forms, with or without
     * modification, are permitted provided that the following conditions
     * are met:
     *
     * *  Redistributions of source code must retain the above copyright
     *    notice, this list of conditions and the following disclaimer.
     *
     * *  Redistributions in binary form must reproduce the above copyright
     *    notice, this list of conditions and the following disclaimer in the
     *    documentation and/or other materials provided with the distribution.
     *
     * *  Neither the name of Texas Instruments Incorporated nor the names of
     *    its contributors may be used to endorse or promote products derived
     *    from this software without specific prior written permission.
     *
     * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
     * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
     * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
     * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
     * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
     * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
     * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
     * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
     * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
     * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     * --/COPYRIGHT--*/
    
    #include "DSPLib.h"
    
    #if defined(MSP_USE_LEA)
    
    #if defined(__TI_COMPILER_VERSION__) || (__IAR_SYSTEMS_ICC__) 
    #pragma vector=LEA_VECTOR
    __interrupt void msp_lea_isr(void)
    #elif defined(__GNUC__) && (__MSP430__)
    void __attribute__ ((interrupt(LEA_VECTOR))) msp_lea_isr(void)
    #endif
    {
        /* Save the interrupt flags, clear interrupt and exit LPM0. */
        uint16_t flags = LEAIFG;
        LEAIFG |= flags;
        msp_lea_ifg = flags;
        __bic_SR_register_on_exit(LPM0_bits);
    }
    
    #endif
    

  • 谢谢,问题已解决,原来写1是清除标志位。我弄反了。再次感谢!!
  • 很高兴您能解决问题!