PIC16f877-WDT-Delay Function

by Marwen Maghrebi
// Function to create a longer delay while still clearing the watchdog timer
void long_delay_with_wdt(unsigned int delay_ms) {
    unsigned int i;
    for (i = 0; i < delay_ms; i++) {
        __delay_ms(1);          // 1 ms delay
        CLRWDT();  // Clear the watchdog timer every millisecond
    }
}
Are you sure want to unlock this post?
Unlock left : 0
Are you sure want to cancel subscription?
-
00:00
00:00
Update Required Flash plugin
-
00:00
00:00