Code One:
/************************** function: Led flashes once every 1 seconds ****************************/#include<msp430x14x.h>voidMain () {P6dir=0XFF; P6out=0x00; TACCR0=4095; TACCTL0=CCIE; Tactl= Tassel_1 + Id_3 +mc_1; _eint (); LPM3;}#pragmaVector=timera0_vector__interruptvoidTimer_a (void) {P6out^=0XFF;}
Code two:
1 /*********************************2 Program Flow:3 off watchdog--timing interrupt 10ms--> on total interrupt--Interrupt Set4 *********************************/5#include <msp430x14x.h>6 7 intflag=0, time=0;8 voidINT_CLK ();//Initializing the Clock9 voidInt_timer ();//Set Timer aTen voidMain () One { AWdtctl = Wdtpw +Wdthold; -P6dir =0XFF; -P6out =0XFF; the int_clk (); - Int_timer (); - _eint (); - + for(;;) - { + while(flag) A { atflag=0; -time++; - if(time== -) - { -P6out ^=0XfF; -Time =0; in } - } to } + } - the voidINT_CLK () * { $BCSCTL1 &= ~Xt2off;Panax NotoginsengBCSCTL2 |= selm_1 +SELS; - Do the { +IFG1 &= ~OFIFG; A for(intI= -;i>0; i--) the _nop (); +} while((IFG1 & OFIFG)! =0); -IFG1 &= ~OFIFG; $ } $ - voidInt_timer () - { theTactl |= taclr + tassel_2 + id_3 +mc_1; -Tactl |=Taie;WuyiTACCR0 =9999;//10ms the } - #pragmaVector = Timera0_vector Wu__interruptvoidTimer_a (void) - { AboutP6out =0x00; $ Switch(TAIV) - { - Case 2: Break; - Case 4: Break; A Case Ten: Flag =1; Break; + } the}
msp430f149 Learning path-Clock 1