344
void main() { // Set up the watchdog timer prescaler (1:32) OPTION_REGbits.PSA = 0; // Prescaler is assigned to WDT OPTION_REGbits.PS = 0b100; // Prescaler ratio 1:32 TRISB = 0; // All PORTB pins are configured as outputs while(1) { PORTB = 0x0F; // Set PORTB to 0x0F (00001111 in binary) long_delay_with_wdt(1000); // 1 second delay while clearing WDT PORTB = 0xF0; // Set PORTB to 0xF0 (11110000 in binary) long_delay_with_wdt(1000); // 1 second delay while clearing WDT } }