Interaction between Watchdog and TIMER0

Hi everyone,

I was working on a project on a project where i am generating a 34kHz PWM frequency using timer 0 in fast PWM mode and a change in the counter like that :

TCCR0A = 0b01000011;
  // Set prescaler for timer0 to 1
  TCCR0B = 0b00001001;

  // Disable Timer 0 interrupts.
  TIMSK0 = 0;
  OCR0A = 234; //the value can go from 0 to 255,165 for 48k 234 for 34k the lower the value, the higher the frequency

And as Timer0 interrupts are disabled i was wondering if it had an inpact on the Watchdog.
I also need to change my watchdog enable time as the time scale has changed due to the prescaler but the main idea is : Is the Watchdog still generating a proper interruption here or not?
I was looking into the datasheet which is showing that both interrupt adresses are differents, i still have some doubts.

Anyways, thanks in advance!

First, I don't see any Watchdog timer in your code. Second, Watchdog is a 4th timer irrespective of the 3 standard timers. Third, although people adapt the Watchdog timer to use as a 4th timer, Its traditional use is to prevent the micro controller from entering a permanent state and it runs on its own crystal. If it is hard-fused (or software setup to reset), it will reset the micro irrespective of interrupts or the global interrupt enable flag. If it is software setup to trigger an interrupt (an not reset), it will set the appropriate bit if it times out, but the interrupt will cue and execute FIFO with other interrupts when the global interrupt is enabled.

Hey Perehama,

I think i understood more or less everything you just explaned!
So for the watchdog part, i am using the <avr/wdt.h> librairy. The watchdog is defined after for it's main purpose (reset) like followed :

ISR(WDT_vect) {
  Serial.println("Watchdog interrupt - Restarting");
}

void loop() {
  wdt_enable(WDTO_1S);
  ----
  ---- //rest of the code
  ----
  wdt_reset();
}

Thnak you again!

Eeikon:
Hey Perehama,

I think i understood more or less everything you just explaned!
So for the watchdog part, i am using the <avr/wdt.h> librairy. The watchdog is defined after for it's main purpose (reset) like followed :

ISR(WDT_vect) {

Serial.println("Watchdog interrupt - Restarting");
}

void loop() {
  wdt_enable(WDTO_1S);
  ----
  ---- //rest of the code
  ----
  wdt_reset();
}



Thnak you again!

without setting WDIE to 1, you will never ever ever ever ever enter the ISRbitSet(WDTCSR, WDIE);``WDTCSR |= (1 << WDIE)Also, with a watchdog timer of 1 millisecond, and it takes 1.041666 milliseconds to send 1 byte at 9600 8N1, should mention that if the ISR doesn't finish before the watchdog times out again, it resets anyway. For the sake of completion, if you want to only enter the ISR and NOT reset, you need to set WDE to 0.bitClear(WDTCSR, WDE)``WDTCSR &= ~(1 << WDE)

Happily my wathdog timer is set to fire every second if no activity, i can communicate a lot of data in that case!
What you said about the ISR is really interresting, i didn't knew about it. I guess i will have to go back to the watchdog documentation.
Thanks again for all the informations you gave to me!