#include
__CONFIG(INTIO & WDTDIS &DEBUGDIS& PWRTEN & MCLRDIS & UNPROTECT & DUNPROTECT & BORXSLP & IESODIS & FCMDIS & LVPDIS); void delay50us(unsigned char z) {
unsigned char i,j; for(i=0;i void main() { unsigned int count; unsigned char temp; unsigned char i; OSCCON = 0x61; OPTION = 0x0f; WDTCON = 0x09; temp = 1; // ANSEL = 0; TRISD = 0x00; delay50us(20); PORTD = ~temp; while(1) { SLEEP(); //进入睡眠模式;等待WDT溢出唤醒 if(temp>254) temp = 0; else temp ++; PORTD = ~temp; } } #include __CONFIG(INTIO & WDTDIS &DEBUGDIS& PWRTEN & MCLRDIS & UNPROTECT & DUNPROTECT & BORXSLP & IESODIS & FCMDIS & LVPDIS); void delay50us(unsigned char z) { unsigned char i,j; for(i=0;i ; } void main() { unsigned int count; unsigned char temp; unsigned char i; OSCCON = 0x61; OPTION = 0x0f; WDTCON = 0x09; temp = 1; // ANSEL = 0; TRISD = 0x00; delay50us(20); PORTD = ~temp; while(1) { SLEEP(); //进入睡眠模式;等待WDT溢出唤醒 if(temp>254) temp = 0; Else temp ++; PORTD = ~temp; } }
PIC16F887单片机内部时钟,看门狗唤醒睡眠模式
![](/skin/haowen/images/icon_star.png)
![](/skin/haowen/images/icon_star.png)
![](/skin/haowen/images/icon_star.png)
![](/skin/haowen/images/icon_star.png)