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.

[参考译文] MSP430FR2355:SFRIFG1寄存器帮助?

Guru**** 2526700 points


请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/microcontrollers/msp-low-power-microcontrollers-group/msp430/f/msp-low-power-microcontroller-forum/1025898/msp430fr2355-sfrifg1-register-help

器件型号:MSP430FR2355

我在尝试使用 HAL 方法访问 SFRIFG1寄存器时遇到问题。  头文件如下所示:

#ifndef DRIVERS_INC_SFR_H_
#define DRIVERS_INC_SFR_H_

#include <msp430.h>
#include <stdint.h>

typedef struct
{
    volatile uint16_t SFRIE;       /*SFR interrupt enable register                   Offset 0x00 */
    volatile uint16_t SFRIFG;      /*SFR interrupt flag register                     Offset 0x02 */
}SFR_RegDef_t;

#define SFR   (SFR_RegDef_t*)SFR_BASE

typedef struct
{
    SFR_RegDef_t *pSFR; /*holds base address of special function register */
}SFR_Handle_t;


#endif /* DRIVERS_INC_SFR_H_ */

我也在其他驱动器上使用这种技术...它们看起来都很好。  例如、当我查看指针时、所有工作的指针都指向寄存器集的正确基址(即 TB1指向0x3C0)、这符合预期。  但是、当我尝试访问 SFR 时、我的调试器指向0x6904TM??  这应该是0x0100。  有什么想知道为什么会这样做?

我的代码不起作用:

    do
    {
        pECSHandle->pECSx->CSCTL[7] &= ~(XT1OFFG | DCOFFG);
        (clock_SFR.pSFR->SFRIFG) &= ~OFIFG;
    } while ((clock_SFR.pSFR->SFRIFG) & OFIFG);

如果我用 SFRIFG1替换(clock_SFR.PSR->SFRIFG)(如示例 Resource Explorer 代码中所示)、则一切正常。

谢谢