利用看
门狗中断,实现小灯闪烁,但是小灯居然没动静,哎,苦逼了
#include <msp430x14x.h>
#define uchar unsigned char#define uint unsigned int
uchar temp = 0;
void main(){ WDTCTL=WDTPW+WDTHOLD; BCSCTL1 |= XTS; do { IFG1 &= ~OFIFG; for(uchar temp=0xFF;temp>0;temp--); } while((IFG1&OFIFG)!=0); WDTCTL = WDT_ADLY_1000; IE1 |= WD
tiE; P2DIR = 0xFF; P2OUT = temp; _EINT(); while(1) { LPM3; _NOP(); } }
#pragma vector = WDT_VECTOR__interrupt void watchdog(){ temp = ~temp; P2OUT = temp;}
一周热门 更多>