This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

看门狗状态溢出能不能进入中断?是什么时序执行的?



设置看门狗,注意,不是看门狗的普通定时器方式,就是看门狗。
如果程序飞了没有按一定时间给看门狗清零,就要引起PUC复位。
那么请问,可不可以给看门狗设置中断(看手册好像可以呀)?如果可以,那这个中断是在真正复位前执行的还是复位后执行的?

G2系列手册中说:

When using the WDT+ in the watchdog mode, the WDTIFG flag sources a reset vector interrupt. The
WDTIFG can be used by the reset interrupt service routine to determine if the watchdog caused the
device to reset. If the flag is set, then the watchdog timer+ initiated the reset condition either by timing out
or by a security key violation. If WDTIFG is cleared, the reset was caused by a different source.

如果是复位前执行,如果我在中断中执行很长时间的程序,也会等待执行完了才复位?不知道单片机内部硬件是怎么处理的。

如果是复位后执行,看手册如图:

中断使能在PUC后是复位的

当然,这个问题是可以通过小程序来检验出来的吧?例如检验PUC后会变化的寄存器有无变化并通过IO口指示出来。

不过还是直接问问