用的IRA5.20,代码很简单如下
#include "io430.h"
void main(void)
{
BCSCTL1 |= DIVA_2; // ACLK/4
WDTCTL = WDT_ADLY_1000; // WDT 1s/4 interval timer
IE1 |= WDTIE; // Enable WDT interrupt
P1DIR = 0xFF; // All P1.x outputs
P1OUT = 0; // All P1.x reset
P2DIR = 0xFF; // All P2.x outputs
P2OUT = 0; // All P2.x reset
P3DIR = 0xFF; // All P3.x outputs
P3OUT = 0; // All P3.x reset
P4DIR = 0xFF; // All P4.x outputs
P4OUT = 0; // All P4.x reset
P5DIR = 0xFF; // All P5.x outputs
P5OUT = 0; // All P5.x reset
P6DIR = 0xFF; // All P6.x outputs
P6OUT = 0; // All P6.x reset
while(1)
{
int i;
LPM3; // Enter LPM3
P1OUT |= 0x01; // Set P1.0 LED on
for (i = 5000; i>0; i--); // Delay
P1OUT &= ~0x01; // Clear P1.0 LED off
}
}
#pragma vector=WDT_VECTOR
__interrupt void watchdog_timer (void)
{
LPM3_EXIT; // Clear LPM3 bits from 0(SR)
}
编译时出错了
Error[e46]: Undefined external "_BIS_SR" referred in main ( E:\msp430\prjtestcode430\lpm3\Debug\Obj\main.r43 )
Error[e46]: Undefined external "_BIC_SR_IRQ" referred in main ( E:\msp430\prjtestcode430\lpm3\Debug\Obj\main.r43 )
应该是没有定义这两个,不知道怎么设置才OK,用过的高手来指点指点吧
额,另外还想问下,设置低功耗之后再有中断时,执行完中断推出后,程序会自动进入低功耗模式吗? |