完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
嗨,所有,我使用一个MPC795W20与一个PIC24F16KA102K CON的微控制器I编程2相互交织一个来自一个按钮,另一个皱眉的RTC报警。每次我按下按钮,我问的时间到RTC,并采取不同的旧旧的时间。问题是当我SH到Muh按钮一次一个接一个,非常快,RTC的闹钟停止工作,我也认为RTC.当TE时间戳在两个点击是大EffeWork工作罚款。有什么建议吗?谢谢
以上来自于百度翻译 以下为原文 hi all, Im using a mpc795w20 with a pic24f16ka102 µC on the microcontroller i programmed 2 interrups one that comes from a button and an other frow the rtc an alARM . every time i push on the button i ask the time to the rtc and take the difference between the old an new time. the problem is when i push to mush time the button like 40 times one after an other and very fast the alarm of the rtc stops working and i thinks also the rtc. when te timestamp between two clicks is big everething works fine. any suggestion? thanks |
|
相关推荐
9个回答
|
|
第一个想法-不要那样做!第二个想法-你的代码中有一个bug(ZED,我们有一个bug)第三的想法-高兴你没有张贴你的代码,因为那时我可能不得不花时间除草
以上来自于百度翻译 以下为原文 First thought - Don't Do That ! Second thought - There is a BUG in your code (Zed, we have a bug) Third thought - Glad you didn't post your code because then I might have had to spend time weeding through it |
|
|
|
嗨,建议:如果你想得到一些帮助……请张贴你的代码(甚至你的完整项目拉链)。
以上来自于百度翻译 以下为原文 Hi, Suggestion : post your code (or even your full project zipped) if you want to get some help... Regards |
|
|
|
该死,对不起,我忘了代码HTTPS://GITHUB.CO/ZWAKRI…R/Sayp1.x/SaypMe.c。
以上来自于百度翻译 以下为原文 damn , sorry i forgot the code https://github.com/zwakri...r/shayp1.X/shaypMain.c |
|
|
|
我想知道按钮中断是否会导致警报中断失败。当警报发生时,状态机进入状态2,当计数器从0增加到3时,它循环通过状态2。如果按钮发生在计数器定时器为3之前,则状态=1,状态2的最后一部分永远不会被执行。这样,警报就不会再次被设置,你再也无法达到状态2。你通常不希望在中断和主程序中这样修改变量,因为这是可能发生的。您可能需要一个不同的变量:状态机读取和清除状态机的ISR集,并告诉状态机改变状态变量。
以上来自于百度翻译 以下为原文 I'm wondering if the pushbutton interrupt could cause the alarm interrupt to fail. When the alarm occurs and the state machine goes to state 2, it cycles through state 2 as counterTimer is incremented from 0 to 3. If the pushbutton happens before counterTimer makes it to 3, then state = 1 and the last portion of state 2 is never executed. Thus the alarm is never set again and you can never get to state 2 again. You generally don't want variables to be modified this way in both interrupt and main routines because this is what can happen. You probably need a different variable the ISR sets that the state machine reads (and clears) and tells the state machine to chang the state variable. |
|
|
|
嗯,我理解这个问题,但不是解决方法:(你能给我举些例子吗?)
以上来自于百度翻译 以下为原文 hmm i understand the probleme but not the solution :( could you please give me some example |
|
|
|
在两个ISR中有两个标志变量,每个ISR中仅设置(=1),并且只在其他地方清除。在每个状态结束时,检查标志是否被设置,然后为适当的状态设置状态变量并清除标志。
以上来自于百度翻译 以下为原文 Have two flag variables for the two ISRs, each only set (=1) in the ISR and only cleared anywhere else. At the end of each state check the flags if one is set then set the state variable for the appropriate state and clear the flag. |
|
|
|
可能还有其他方法,但基本上,在使用它们时,需要防止中断修改变量。
以上来自于百度翻译 以下为原文 There are probably other ways to do this but basically you need to prevent the interrupt from modifying variables while you are using them |
|
|
|
|
|
|
|
|
|
|
|
只有小组成员才能发言,加入小组>>
5250 浏览 9 评论
2037 浏览 8 评论
1958 浏览 10 评论
请问是否能把一个ADC值转换成两个字节用来设置PWM占空比?
3218 浏览 3 评论
请问电源和晶体值之间有什么关系吗?PIC在正常条件下运行4MHz需要多少电压?
2266 浏览 5 评论
788浏览 1评论
680浏览 1评论
有偿咨询,关于MPLAB X IPE烧录PIC32MX所遇到的问题
609浏览 1评论
PIC Kit3出现目标设备ID(00000000)与预期的设备ID(02c20000)不匹配。是什么原因
685浏览 0评论
582浏览 0评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-12-28 21:20 , Processed in 1.311365 second(s), Total 65, Slave 59 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号