共2条
1/1 1 跳转至页
MEGA8 请教一个MEGA8看门狗问题。

问
我用MEGA8,程序都调试好了,就把看门狗程序加到里面:
初始化
//Watchdog initialisation
// prescale: 2048K cycles
void watchdog_init(void)
{
WDR(); //this prevents a timout on enabling
WDTCR = 0x0F; //WATCHDOG ENABLED - dont forget to issue WDRs
}
然后在主程序里喂狗,系统电压5V,采用外部3.6864M晶振,熔丝位只编程了BOOTSZ1、BOOTSZ0,按道理看门狗应该2.2s复位,可是我的程序疯狂复位,间隔绝对小于0.5s,不知道哪里出了问题? 答 1: 用bascom试试config watchdog = 2048 看门狗定时器复位时间2048ms
start watchdog 启动看门狗
reset watchdog 复位
stop watchdog 停止
taihen ketsukou!
初始化
//Watchdog initialisation
// prescale: 2048K cycles
void watchdog_init(void)
{
WDR(); //this prevents a timout on enabling
WDTCR = 0x0F; //WATCHDOG ENABLED - dont forget to issue WDRs
}
然后在主程序里喂狗,系统电压5V,采用外部3.6864M晶振,熔丝位只编程了BOOTSZ1、BOOTSZ0,按道理看门狗应该2.2s复位,可是我的程序疯狂复位,间隔绝对小于0.5s,不知道哪里出了问题? 答 1: 用bascom试试config watchdog = 2048 看门狗定时器复位时间2048ms
start watchdog 启动看门狗
reset watchdog 复位
stop watchdog 停止
taihen ketsukou!
共2条
1/1 1 跳转至页