본문 바로가기
dev, tech/embedded

<img src="http://blogimgs.naver.com/nblog/ico_scrap01.gif" class="i_scrap" width="50" height="15" alt="본문스크랩" /> watchdog timer operation

by 구띵 2006. 7. 13.

void delay(void)

{

            

            // 1. disable WDT

             rWTCON = 0;

 

            // 2. Set WTCNT

             rWTCNT = 500000/128;   // 0.5 sec

 

            // 3. Set WTDAT

             rWTDAT = 0;              // Initial Value : 0x8000

 

            // 4. Set WTCON and Enable WDT (t_wdt : 128 us -> 1*128)

             rWTCON = (PCLK/1000000)-1 << 8 |  1 << 5 | 3 << 3;

            

            // 5. Polling WTCNT

             while(rWTCNT);

 

            // 6. Disable WDT

             rWTCON = 0;

 

}

 

댓글