在线时间18 小时
UID3090727
ST金币0
蝴蝶豆0
注册时间2015-1-9
初级会员
- 最后登录
- 2015-6-15
|
a0a.1 32b0c
**********
RTC_TimeTypeDef RTC_TimeStructure;
RTC_AlarmTypeDef RTC_AlarmStructure;
RTC_GetTime(RTC_Format_BIN, &RTC_TimeStructure);
sec = RTC_TimeStructure.RTC_Seconds;
min = RTC_TimeStructure.RTC_Minutes;
hour = RTC_TimeStructure.RTC_Hours;
Alarm_Init();
/* Alarm A */
RTC_GetAlarm(RTC_Format_BIN, RTC_Alarm_A, &RTC_AlarmStructure);
RTC_AlarmCmd(RTC_Alarm_A, DISABLE);
/* Disable the RTC Alarm A Interrupt */
RTC_ITConfig(RTC_IT_ALRA, DISABLE);
RTC_AlarmStructure.RTC_AlarmTime.RTC_Seconds = (sec+0X01);
RTC_AlarmStructure.RTC_AlarmTime.RTC_Minutes = (min+0X01);
RTC_AlarmStructure.RTC_AlarmTime.RTC_Hours = (hour+0X00);
RTC_AlarmStructure.RTC_AlarmDateWeekDaySel = RTC_AlarmDateWeekDaySel_Date;
RTC_AlarmStructure.RTC_AlarmDateWeekDay = day;
RTC_SetAlarm(RTC_Format_BIN, RTC_Alarm_A, &RTC_AlarmStructure);
/* Enable the RTC Alarm A Interrupt */
RTC_ITConfig(RTC_IT_ALRA, ENABLE);
/* Enable the alarm A */
RTC_AlarmCmd(RTC_Alarm_A, ENABLE);
/* Alarm B */
RTC_GetAlarm(RTC_Format_BIN, RTC_Alarm_B, &RTC_AlarmStructure);
RTC_AlarmCmd(RTC_Alarm_B, DISABLE);
/* Disable the RTC Alarm B Interrupt */
RTC_ITConfig(RTC_IT_ALRB, DISABLE);
RTC_AlarmStructure.RTC_AlarmTime.RTC_Seconds = (sec+0X01);
RTC_AlarmStructure.RTC_AlarmTime.RTC_Minutes = (min+0X00);
RTC_AlarmStructure.RTC_AlarmTime.RTC_Hours = (hour+0X00);
RTC_AlarmStructure.RTC_AlarmDateWeekDaySel = RTC_AlarmDateWeekDaySel_Date;
RTC_AlarmStructure.RTC_AlarmDateWeekDay = day;
RTC_SetAlarm(RTC_Format_BIN, RTC_Alarm_B, &RTC_AlarmStructure);
/* Enable the RTC Alarm B Interrupt */
RTC_ITConfig(RTC_IT_ALRB, ENABLE);
/* Enable the alarm B */
RTC_AlarmCmd(RTC_Alarm_B, ENABLE);
*****************
void RTC_Alarm_IRQHandler(void)
{
/* Clear the EXTIL line 17 */
EXTI_ClearITPendingBit(EXTI_Line17);
/* Check on the AlarmA falg and on the number of interrupts per Second (60*8) */
if (RTC_GetITStatus(RTC_IT_ALRA) != RESET)
{
// STM_EVAL_LEDOn(LED4);
alarm_now2 = 0;
/* Clear RTC AlarmA Flags */
RTC_ClearITPendingBit(RTC_IT_ALRA);
RTC_HandlerFlag = ENABLE;
}
if (RTC_GetITStatus(RTC_IT_ALRB) != RESET)
{
// STM_EVAL_LEDOn(LED4);
alarm_now = 0;
/* Clear RTC AlarmA Flags */
RTC_ClearITPendingBit(RTC_IT_ALRB);
RTC_HandlerFlag = ENABLE;
}
}
~~~~~~~~~~~~~~~~~~~~~~
错在哪里?
|
|