我是新手,上电延时充电50ms触发,再延时12ms再触发,晶振32.768,这个程序调不到,请高手帮忙改一下,
#include <msp430x11x.h>
#define uint unsigned int
unsigned int time;
void delay(unsigned int time)
{ while(time--);
}
void main(void)
{ unsigned int i; WDTCTL = WDTPW + WDTHOLD; // Stop watchdog timer _BIS_SR(OSCOFF+SCG0+SCG1); BCSCTL1 &=XTS; do { IFG1&=~OFIFG; for(i=0xFF;i>0;i--); } while((IFG1&=~OFIFG)!=0); IFG1&=~OFIFG; BCSCTL2|=SELM1+SELM0+DIVM_3; //P1DIR=0x00; //P1口高三位输入 P1OUT=0x00; P1DIR=0x0E; //P2口低三位输出 delay(2); // 8分频后,delay(30); 延时50ms P1OUT=0x02; delay(2); P1OUT=0x00; delay(2); P1OUT=0x04; delay(2); //再延时12ms P1OUT=0x00; while(1); }
|