完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
假设一个程序带有一个主()循环和一个中断。DOE的“清除WDT”去哪里。如果是在中断和主锁上,那么重置不会发生,如果是在主中断中断,则不会发生。两者都有吗?
以上来自于百度翻译 以下为原文 Assuming a program with a main() loop and an interrupt. Where doe the 'clear WDT" go. If it is in the interrupt and main locks up, then reset doesn't happen, and if it is in main and the interrupt locks up, it doesn't happen. Does it go in both? |
|
相关推荐
2个回答
|
|
只有你可以判断。如果程序不正确运行,你必须确定程序的哪个部分。如果你把它放在两个地方,那么它们中的任何一个都会保持看门狗重置,这可能不是你想要的。在什么地方没有硬性规定,每个程序都是。不同的。
以上来自于百度翻译 以下为原文 Only you can judge. You have to determine what part of your program it won't get to if it's not running correctly. If you put it in two places, then either one of them will keep the watchdog reset, which probably is not what you want. There's no hard and fast rules on where to put it, every program is different. |
|
|
|
我听说最好不要在ISR中重置看门狗,因为即使主代码被卡住或失控,中断仍然会发生。此外,中断开销可能变得如此之大,以至于它永远不会执行主代码。如果你有很长的延迟,你可能需要重置看门狗。为了避免卡在ISRs,你可以在开始时设置一个“忙”标志,并在结束时重置它。如果在前一个处理完成之前发生另一个中断,则可以跳过太长的代码,也可以增加“ISR错误”计数器。这主要是针对非屏蔽中断(NMIS)。我不知道它们是否存在于任何图片中。它们在Z80中使用。
以上来自于百度翻译 以下为原文 I have heard that it is best not to reset the watchdog in an ISR, because even if the main code is stuck or running wild, the interrupt will still happen. Also it is possible for interrupt overhead to become so great that it never executes main code. If you have long delays, you may need to reset the watchdog there. To avoid getting stuck in ISRs, you can set a "busy" flag at the beginning and reset it at the end. If another interrupt occurs before the previous one has finished processing, you can jump over the code that is taking too long, and also increment an "ISR error" counter. This is mostly for non-maskable interrupts (NMIs). I don't know if they exist in any PICs. They are used in the Z80. |
|
|
|
只有小组成员才能发言,加入小组>>
5166 浏览 9 评论
2000 浏览 8 评论
1928 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3174 浏览 3 评论
请问电源和晶体值之间有什么关系吗?PIC在正常条件下运行4MHz需要多少电压?
2226 浏览 5 评论
733浏览 1评论
615浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
505浏览 1评论
PIC Kit3出现目标设备ID(00000000)与预期的设备ID(02c20000)不匹配。是什么原因
631浏览 0评论
528浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-11-24 04:34 , Processed in 1.177642 second(s), Total 82, Slave 64 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号