|
重大发现
要想实现真正意思上的低功耗在进入LPM3之前应当关闭所有已经打开的功能模块。比如串口,定时器,AD等。再就是要把所有I/O的特殊功能关闭,设置成输出,输出值为低。否则是不会达到说明书上所给的低功耗指标。比如LPM3电流2uA。我在初始化时使用了定时器A, AD12, 两个串口。为了保持MSP430F5418的RTC在纽扣电池供电时继续工作。在进入LPM3前我是这样做的:
void turnOFF()
{
TA1CTL = 0; // stop TimerA
ADC12CTL0 = 0; // stop ADC12
UCA0CTL1 |= UCSWRST;
UCA1CTL1 |= UCSWRST;
P1SEL = P2SEL = P3SEL = P4SEL = P5SEL = P6SEL = P7SEL = P8SEL = P9SEL = P10SEL = P11SEL = 0;
P1DS = P2DS = P3DS = P4DS = P5DS = P6DS = P7DS = P8DS = P9DS = P10DS = P11DS = 0;
P1DIR = P2DIR = P3DIR = P4DIR = P5DIR = P6DIR = P7DIR = P8DIR = P9DIR = P10DIR = P11DIR = 0xFF;
P1OUT = P2OUT = P3OUT = P4OUT = P5OUT = P6OUT = P7OUT = P8OUT = P9OUT = P10OUT = P11OUT = 0x00;
P1DIR &= ~BIT4; //P1.4 input pin
P1IE |= BIT4; //P1.4 interrupt ena××e
P1IES &= ~BIT4; //P1.4 low-to-high edge
LPM3; //MSP430F5418 standby
}
经测量。此时单片机在3V钮扣电池供电的情况下为6个uA |
|