/************************************************************ * 看門狗定時(shí)器的寄存器定義 ************************************************************/ #define WDTCTL_ 0x0120 sfrw WDTCTL = WDTCTL_; #define WDTIS0 0x0001 /*選擇WDTCNT的四個(gè)輸出端之一*/ #define WDTIS1 0x0002 /*選擇WDTCNT的四個(gè)輸出端之一*/ #define WDTSSEL 0x0004 /*選擇WDTCNT的時(shí)鐘源*/ #define WDTCNTCL 0x0008 /*清除WDTCNT端: 為1時(shí) 從0開始計(jì)數(shù)*/ #define WDTTMSEL 0x0010 /*選擇模式 0: 看門狗模式; 1: 定時(shí)器模式*/ #define WDTNMI 0x0020 /*選擇NMI/RST 引腳功能 0:為 RST; 1:為NMI*/ #define WDTNMIES 0x0040 /*WDTNMI=1時(shí).選擇觸發(fā)延 0:為上升延 1:為下降延*/ #define WDTHOLD 0x0080 /*停止看門狗定時(shí)器工作 0:啟動;1:停止*/ #define WDTPW 0x5A00 /* 寫密碼:高八位*/ /* SMCLK= 1MHz定時(shí)器模式 */ #define WDT_MDLY_32 WDTPW+WDTTMSEL+WDTCNTCL /* TSMCLK*2POWER15=32ms 復(fù)位狀態(tài) */ #define WDT_MDLY_8 WDTPW+WDTTMSEL+WDTCNTCL+WDTIS0 /* TSMCLK*2POWER13=8.192ms " */ #define WDT_MDLY_0_5 WDTPW+WDTTMSEL+WDTCNTCL+WDTIS1 /* TSMCLK*2POWER9=0.512ms " */ #define WDT_MDLY_0_064 WDTPW+WDTTMSEL+WDTCNTCL+WDTIS1+WDTIS0 /* TSMCLK*2POWER6=0.512ms " */ /* ACLK=32.768KHz 定時(shí)器模式*/ #define WDT_ADLY_1000 WDTPW+WDTTMSEL+WDTCNTCL+WDTSSEL /* TACLK*2POWER15=1000ms " */ #define WDT_ADLY_250 WDTPW+WDTTMSEL+WDTCNTCL+WDTSSEL+WDTIS0 /* TACLK*2POWER13=250ms " */ #define WDT_ADLY_16 WDTPW+WDTTMSEL+WDTCNTCL+WDTSSEL+WDTIS1 /* TACLK*2POWER9=16ms " */ #define WDT_ADLY_1_9 WDTPW+WDTTMSEL+WDTCNTCL+WDTSSEL+WDTIS1+WDTIS0 /* TACLK*2POWER6=1.9ms " */ /* SMCLK=1MHz看門狗模式 */ #define WDT_MRST_32 WDTPW+WDTCNTCL /* TSMCLK*2POWER15=32ms 復(fù)位狀態(tài) */ #define WDT_MRST_8 WDTPW+WDTCNTCL+WDTIS0 /* TSMCLK*2POWER13=8.192ms " */ #define WDT_MRST_0_5 WDTPW+WDTCNTCL+WDTIS1 /* TSMCLK*2POWER9=0.512ms " */ #define WDT_MRST_0_064 WDTPW+WDTCNTCL+WDTIS1+WDTIS0 /* TSMCLK*2POWER6=0.512ms " */ /* ACLK=32KHz看門狗模式 */ #define WDT_ARST_1000 WDTPW+WDTCNTCL+WDTSSEL /* TACLK*2POWER15=1000ms " */ #define WDT_ARST_250 WDTPW+WDTCNTCL+WDTSSEL+WDTIS0 /* TACLK*2POWER13=250ms " */ #define WDT_ARST_16 WDTPW+WDTCNTCL+WDTSSEL+WDTIS1 /* TACLK*2POWER9=16ms " */ #define WDT_ARST_1_9 WDTPW+WDTCNTCL+WDTSSEL+WDTIS1+WDTIS0 /* TACLK*2POWER6=1.9ms " */
|