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.

[参考译文] CCS/MSP430G2553:更改通过 WDT 或 P1.2中的外部中断从 LMP3唤醒时的功耗

Guru**** 2595770 points


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

https://e2e.ti.com/support/microcontrollers/msp-low-power-microcontrollers-group/msp430/f/msp-low-power-microcontroller-forum/649439/ccs-msp430g2553-changing-power-consumption-when-waking-up-from-lmp3-with-wdt-or-with-external-interrupt-in-p1-2

器件型号:MSP430G2553

工具/软件:Code Composer Studio

大家好、  

我正在开发一种应用、其中 MCU 需要从 LMP3唤醒、30秒或由于 P1.2中的外部中断。 由于某种原因、在0.5s 的周期内、功耗从40uA 变为接近600uA。 当我创建类似的程序、但分别使用 WDT 中断和 P1.2中断时、它们消耗的电流为40uA。  

是否存在任何不兼容性? 对于30s 中断、我应该使用与 WDT 不同的计时器吗?

遵循主函数的基本结构。  

int main (void)
{
//WDTCTL = WDTPW + WDTHOLD; //停止看门狗计时器
BCSCTL1 |= DIV_0; // ACLK/1
BCSCTL3 |= XCAP_3; //12.5pF cap -设置32768Hz 晶振
StartupOsc ();

P1DIR = 0xFF; //所有 P1.x 输出
P1OUT = 0; //所有 P1.x 复位
P1REN = 1;
P2DIR = 0xE7; //除 P2.3 (天信号)和 P2.4 (3V4信号)以外的所有 P2.x 输出(输入
P2OUT = 0); //所有 P2.x 复位
P2REN = 1;
P3DIR = 0xFF;
P3OUT = 0;
P3REN = 0xFF;

WDTCTL = WDT_ADLY_1000; // WDT 1s/4间隔计时器
IE1 |= WDTIE; //启用 WDT 中断
P1IE |= BIT2; // P1.2中断使能
P1IES &=~BIT2; // P1.2低/高边
沿 P1REN |= BIT2; //使能上拉(P1.2)
P1IFG &&~BIT2; // P1.2 IFG 清零

,同时(1)
{
check_State();
_bis_SR_register (LPM3_bits + GIE); //输入带中断
的 LPM3} 

ISR:

#if defined (__TI_Compiler_version__)|| defined (__IAR_systems_icc_)
#pragma vector=WDT_vector
__interrupt void watchdog_timer (void)
#elif defined (__GNU__)
void __attribute__((interrupt (WDT_vector)))) Watchdoget_timer (void
#elt
!#else not supported!
#endif
{
_BIC_SR_REGISTER_ON_EXIT (LPM3_BITS);//从0 (SR)清除 LPM3位

}

//端口1中断服务例程
#if defined (__TI_Compiler_version__)|| defined (__IAR_systems_ICC__)
#pragma vector=Port1_vector
__interrupt void Port_1 (void)
#Elif defined (__GNU__)
void __attribute__((interrupt (Port1_vector)))))#pragma

Compiler #void Port #1 (void!
#endif
{
P1OUT |= BIT4; //LED 亮起
CCTL0 = CCIE; //启用 CCR0中断
TACTL = tassel_1 + MC_2+ ID_3; // ACLK,contmode (高达0xFFFF),/8 ->(1/32768*0xFFFF)=2s x8 = 16秒
P1IFG &=~BIT2; //清除 P1.2 IFG
}

//计时器 A0中断服务例程
#if 已定义(__TI_Compiler_version__)||已定义(__IAR_systems_ICC__)
#pragma vector=TIMER0_A0_Vector
__interrupt void Timer_A0 (void)
#Elif Defined (__GERA0__)


支持的__TIMER0_TRIBU_(void Timer_ERROR)(void Timer0_ERROR)(void Timer0_interrupt)(void TimerA0)(void Timer0_timer_trador_en_tr
#endif
{
P1OUT &=~BIT4; //LED 关闭
TACTL=MC_0; //停止 TIMERA
} 

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

    假设 ACLK 为32kHz、WDT_ADLY_1000会创建一个1秒的中断间隔。 我不确定您的代码为什么每半秒生成一次 WDT 中断。 使用 DIV_3时、可能的最长 WDT ISR 间隔为8秒。 相反、使用计时器可为您提供高达30秒的间隔、其中 ACLK 源除以2 (DIV_1)、计时器输入分频器8 (ID_3)、向上计数模式(MC_1)的 TACCR0值为61440。 61440/(32768/2/8)= 30秒。

    此致、
    Ryan