完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
电子发烧友论坛|
你好,
我有一个cy8c4248lqi-bl583装置和RTC组件有一个很奇怪的问题。 我配置RTC报警我想触发一个报警的日常行动, 在周期性报警功能我试图创建一个详细的测试,每小时或每日闹铃。 但只有日常报警触发正确,它只能触发一次。 我使用下面的代码来设置警报: rtc_setalARMmask(rtc_alarm_sec_mask | rtc_alarm_min_mask | rtc_alarm_hour_mask);//设置周期闹钟 rtc_setalarmhandler(AlarmCallbackHandler);//设置Callback Handler报警 定时报警; MyalARM.DAT= RTCSETSEDY(MyalARM.日期,22); MyalARM.DAT= RTCSET月份(MyalARM.日期,RTC4月); MyalARM.DAT= RTCA年份(MyalARM.日期,2018); MyalARM.tiME=RTCI SETHES(MyalARM.时间,11); MyalARM.TIME=RTCTSETIME(MyalARM.时间,55); MyalARM.Time= RTCA SETSIME(MyalARM.时间,1); rtc_setalarmdateandtime(&;我的);/ /报警触发第二天在11:55:01 / /但报警触发一次,而不是重复在后天。 这是警报回调: 空警报回滚句柄() RTCICALLARMARSTATUS();/ /清除警报状态 led_write(~ led_read());//切换LED检测报警发生 } 什么也不起作用: rtc_setalarmmask(rtc_alarm_sec_mask | rtc_alarm_min_mask);//设置周期计时报警 /或: rtc_setalarmmask(rtc_alarm_sec_mask);//设置定期详细报警 /与以前相同的设置/配置… / /但报警不触发在接下来的一个小时在55分钟和第二01或每分钟每分钟报警。 我必须重新启动警报吗? 如果是这样的话,我该怎么做呢? 谢谢 安德烈亚斯 以上来自于百度翻译 以下为原文 Hi, I have a very strange problem with a CY8C4248LQI-BL583 device and the RTC component. I configured the RTC with alarm and I want to trigger a daily action with the alarm, To test the periodic alarm feature I tried to create a minutely, an hourly or a daily alarm. But only the daily alarm triggers correcty and it triggers only once. I use the following code to set the alarm: RTC_SetAlarmMask( RTC_ALARM_SEC_MASK | RTC_ALARM_MIN_MASK | RTC_ALARM_HOUR_MASK ); // Set periodic daily alarm RTC_SetAlarmHandler( AlarmCallbackHandler ); // set Callback Handler for Alarm RTC_DATE_TIME MyAlarm; MyAlarm.date = RTC_SetDay( MyAlarm.date, 22 ); MyAlarm.date = RTC_SetMonth( MyAlarm.date, RTC_APRIL); MyAlarm.date = RTC_SetYear( MyAlarm.date, 2018 ); MyAlarm.time = RTC_SetHours( MyAlarm.time, 11 ); MyAlarm.time = RTC_SetMinutes( MyAlarm.time, 55 ); MyAlarm.time = RTC_SetSecond( MyAlarm.time, 1 ); RTC_SetAlarmDateAndTime( &MyAlarm ); // Alarm is triggered on the next day at 11:55:01 // But Alarm is triggered only once, and not repeated on the day after tomorrow. This is the Alarm-callback: void AlarmCallbackHandler(){ RTC_ClearAlarmStatus(); // Clear Alarm Status LED_Write( ~LED_READ() ); // toggle LED to detect the alarm has occured } What also does not work: RTC_SetAlarmMask( RTC_ALARM_SEC_MASK | RTC_ALARM_MIN_MASK ); // Set periodic hourly alarm // or: RTC_SetAlarmMask( RTC_ALARM_SEC_MASK ); // Set periodic minutely alarm // Same setup/configuration as before... // But Alarm is NOT triggered in the next hour at minute 55 and second 01 or on each minute with minutely alarm. Do I have to reenable the alarm somehow? And if so, how do I do this? Thanks a lot Andreas |
|
相关推荐
3个回答
|
|
|
如果RTCJSETALMADATEDATEN和TIME()写入的时间条目无效,则RTCHGETARMATATEATEDATABLE和TIME()将返回所有0个。尝试设置后,它确定的日期/时间是有效的,正确的阅读报警的日期和时间。
您还需要调用RTCSSTART()来启动时钟。另外,复选框“实现RTC手动更新”和“启用报警功能”在组件的API将改变行为和。 你也可能想要设置设置之前启动RTC时钟我想。 以上来自于百度翻译 以下为原文 RTC_GetAlarmDateAndTime() will return all 0's if the time entry written by RTC_SetAlarmDateAndTime() is invalid. Try reading the alarm date and time after setting it to make sure the date/time is valid and set correctly. You also need to call RTC_Start() to start the clock. Also, the checkboxes for "Implement RTC update manually" and "Enable alarm functionality" in the component's API will change behavior as well. You also probably want to set the settings before starting the RTC clock I think. |
|
|
|
|
yuhe82 发表于 2018-10-4 16:42 不幸的是,这些暗示并没有解决这个问题。 这就是为什么我用RTC和警报的最小实现创建了一个新的工作区。 谁想看一看,请试试看,也许你发现了虫子。 谢谢 安德烈亚斯 WorkStudio01.CyWrk.CaseV01.Zip 462.6 K 以上来自于百度翻译 以下为原文 Unfortunately the hints didn't solve the problem. Thats why I created a new workspace with the minimal implementation for the RTC and Alarm. Whoever wants to have a look into it, please try it and maybe you find the bug? Thanks a lot Andreas
|
|
|
|
|
rich_fush 发表于 2018-10-4 17:01 最后我发现了一个非常简单而有效的解决方案:我实现了自己的报警功能! 消除报警功能在RTC组件和实施必要的计数器是更快和更灵活。 我的实现是基于一个UInt32计数器递减的每一秒。设置我使用日期unixtime轻松计算计数器的值直到下一个报警触发报警时的初始。 在报警功能,我可以很容易地设置一定的重复频率计数器。60×60×24或60×60日报警,FüR时报警,甚至什么插图! 设置计数器的32位最大值为下一136years禁用报警。-) 只是为了保持你的更新! 安德烈亚斯 以上来自于百度翻译 以下为原文 Finally I found a very simple and effective solution: I just implemented the alarm functionality by myself! Eliminating the alarm-function in the RTC-component and implementing the necessary counter is even faster and more flexible. My implementation is based on a uint32 counter which is decremented each second. When setting the initial alarm I used the Date-to-Unixtime to easily calculate the value of the counter until the next alarm should trigger. In the Alarm-function I can very easily set the counter for a certain repetition rate. 60*60*24 for daily alarm, or 60*60 für hourly alarm, or even anything inbetween! Setting the counter to 32bit-max value disables the alarm for the next 136years. :-) Just to keep you updated! Andreas |
|
|
|
|
只有小组成员才能发言,加入小组>>
786个成员聚集在这个小组
加入小组cyUSB3014一直显示2.1,不能到3.0情况,谁遇到过
7088 浏览 0 评论
2474 浏览 1 评论
2166 浏览 1 评论
4031 浏览 1 评论
请问可以直接使用来自FX2LP固件的端点向主机FIFO写入数据吗?
2073 浏览 6 评论
CY8C4025LQI在程序中调用函数,通过示波器观察SCL引脚波形,无法将pin0.4(SCL)下拉是什么原因导致?
7566浏览 2评论
CYUSB3065焊接到USB3.0 TYPE-B口的焊接触点就无法使用是什么原因导致的?
6114浏览 2评论
CX3连接Camera修改分辨率之后,播放器无法播出camera的画面怎么解决?
742浏览 2评论
710浏览 2评论
使用stm32+cyw43438 wifi驱动whd,WHD驱动固件加载失败的原因?
7962浏览 2评论
/9
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2025-12-2 03:24 , Processed in 0.918564 second(s), Total 74, Slave 57 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191

淘帖
1948