dz̸STM32F10XоƬRTCʵʱʱÖÓ
upConfig(up_1);
NVIC_InitStructure.NVIC_IRQChannel =RTCAlarm_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 1;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
/*ÉèÖÃÄÖÖÓÖжÏÓÅÏȼ¶¸ßÓÚÈ«¾ÖÖжÏ*/
NVIC_InitStructure.NVIC_IRQChannel =RTC_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 1;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 1;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
}
void RTC_Configuration(void)
{
RCC_APB1PeriphClockCmd(RCC_APB1Periph_BKP | RCC_APB1Periph_PWR,ENABLE);
PWR_BackupAccessCmd(ENABLE);
BKP_DeInit();
RCC_LSICmd(ENABLE);
while(RESET == RCC_GetFlagStatus(RCC_FLAG_LSIRDY))
{
}
RCC_RTCCLKConfig(RCC_RTCCLKSource_LSI);
RCC_RTCCLKCmd(ENABLE);
RTC_WaitForSynchro();
RTC_WaitForLastTask();
RTC_ITConfig(RTC_IT_ALR,ENABLE);
RTC_ITConfig(RTC_IT_SEC,ENABLE);
RTC_SetPrescaler(6000);
RTC_WaitForLastTask();
RTC_SetAlarm(29);
RTC_WaitForLastTask();
BKP_TamperPinCmd(DISABLE);
BKP_RTCOutputConfig(BKP_RTCOutputSource_Second);
}
void EXTI_Configuration(void)
{
EXTI_InitTypeDef EXTI_InitStructure;
EXTI_InitStructure.EXTI_Line = EXTI_Line17;
EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt;
EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Rising;
EXTI_InitStructure.EXTI_LineCmd = ENABLE;
EXTI_Init(&EXTI_InitStructure);
}
/*Öжϴ¦Àíº¯Êý*/
void RTC_IRQHandler(void)
{
if(SET == RTC_GetITStatus(RTC_IT_SEC))
{
RTC_ClearITPendingBit(RTC_IT_SEC);
GPIO_WriteBit(GPIOB,GPIO_Pin_13,(BitAction)(1-GPIO_ReadOutputDataBit(GPIOB,GPIO_Pin_13)));
}
}
void RTCAlarm_IRQHandler(void)
{
if(SET == RTC_GetFlagStatus(RTC_IT_ALR))
{
RTC_ClearFlag(RTC_IT_ALR); /*Çå³ýÖжϱê־룬°üÀ¨ÍⲿÖжÏÏß±êÖ¾*/
if(EXTI_GetITStatus(EXTI_Line17));
{
EXTI_ClearITPendingBit(EXTI_Line17);
GPIO_WriteBit(GPIOB,GPIO_Pin_8,(BitAction)(0));
}
}
}
STM32F10XRTCʵʱʱ Ïà¹ØÎÄÕ£º
- Windows CE ½ø³Ì¡¢Ï̺߳ÍÄÚ´æ¹ÜÀí(11-09)
- RedHatLinuxÐÂÊÖÈëÃŽ̳Ì(5)(11-12)
- uClinux½éÉÜ(11-09)
- openwebmailV1.60°²×°½Ìѧ(11-12)
- LinuxǶÈëʽϵͳ¿ª·¢Æ½Ì¨Ñ¡ÐÍ̽ÌÖ(11-09)
- Windows CE ½ø³Ì¡¢Ï̺߳ÍÄÚ´æ¹ÜÀí(¶þ)(11-09)