问题描述
嗨,我正在研究看门狗,但我有点困惑它显示了一些错误。我正在使用 AVR(AVR128DB48)。
错误:
WDTO_4S' undeclared (first use in this function)
recipe for target 'main.o' Failed
代码:
#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);
}
解决方法
从未使用过这部分,但我可以在 Google 上进行快速搜索。从内联文档标题本身:
#define WDTO_4S 8
注意:这仅适用于 ATtiny2313、ATtiny24、ATtiny44、ATtiny84、ATtiny25、ATtiny45、ATtiny85、ATtiny261、ATtiny461、ATtiny861、ATmega48、ATmega88、ATmega168、ATmega486、ATmega486、ATmega486P、ATmega486P、ATmega486P、ATmega486P、ATmega486P、ATmega486P、ATmega486P、ATmega486P、ATmega488P、ATmega48P、ATme48P ,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。