-1

Hi I'm working on watchdog but I'm bit confused It show me some errors. I'm using AVR(AVR128DB48).

Errors:

WDTO_4S' undeclared (first use in this function)
recipe for target 'main.o' failed

code:

#include <avr/io.h>
#include <avr/interrupt.h>
#include <avr/wdt.h>

int main(void)
{
    wdt_enable(WDTO_4S);

    while(1)
    {
        wdt_reset();
    }
    return(0);
}
Gerhard
  • 6,850
  • 8
  • 51
  • 81
Study only
  • 37
  • 6
  • 3
    looks like it isn't supported: https://www.nongnu.org/avr-libc/user-manual/group__avr__watchdog.html#ga752b0b1b5ba9009bc09976494313e30d – Alan Birtles Jun 29 '21 at 09:26
  • 2
    when you grepped for that define what did you find? And when you looked through the include directories did you find other registers that matched the AVR documentation? And from that information were you able to create your own define? And what were the results of that experiment? – old_timer Jun 29 '21 at 09:26
  • 3
    @AhmedMasud That's actually not a valid reason to close a question. If you think it lacks research, then there's down votes for that. Also _DO NOT_ edit out all programming language tags from a question, it screws up code formatting. Questions containing C code _should_ be tagged with C, always. Or in case there is reason to believe it is compiled with a C++ compiler, tag with C++ only. See C and C++ tag wikis for tag usage guidance. – Lundin Jun 29 '21 at 09:44
  • Try reading the datasheet. – TomServo Jun 29 '21 at 21:40

1 Answers1

3

Never used this part, but I can do a quick Google search. From the inline documentation the header itself:

#define WDTO_4S 8

Note: This is only available on the ATtiny2313, ATtiny24, ATtiny44, ATtiny84, ATtiny25, ATtiny45, ATtiny85, ATtiny261, ATtiny461, ATtiny861, ATmega48, ATmega88, ATmega168, ATmega48P, ATmega88P, ATmega168P, ATmega328P, ATmega164P, ATmega324P, ATmega644P, ATmega644, ATmega640, ATmega1280, ATmega1281, ATmega2560, ATmega2561, ATmega8HVA, ATmega16HVA, ATmega32HVB, ATmega406, ATmega1284P, AT90PWM1, AT90PWM2, AT90PWM2B, AT90PWM3, AT90PWM3B, AT90PWM216, AT90PWM316, AT90PWM81, AT90USB82, AT90USB162, AT90USB646, AT90USB647, AT90USB1286, AT90USB1287, ATtiny48, ATtiny88.

See Here

Gerhard
  • 6,850
  • 8
  • 51
  • 81
Lundin
  • 195,001
  • 40
  • 254
  • 396