366
// 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 } }