之前學習51的時候,寫的看門狗的程序
單片機源程序如下:
- #include<reg52.h>
- #define uchar unsigned char
- #define uint unsigned int
- sfr WDT_CONTR=0xe1;
- sbit led=P1^0;
- void delay(uint x)
- {
- uint i,j;
- for(i=x;i>0;i--)
- for(j=110;j>0;j--);
- }
- void main()
- {
- WDT_CONTR=0x35;
- led=0;
- delay(500);
- led=1;
- while(1)
- {
- delay(1000);
- WDT_CONTR=0x35;
- }
- }
復制代碼
所有資料51hei提供下載:
看門狗.zip
(17.4 KB, 下載次數: 12)
2018-6-27 17:14 上傳
點擊文件名下載附件
看門狗
|