int main(void) {uint32 regval; RCCcfg(); /*enable gpio port A clock*/ regval =RCC_APB2ENR&0x0000FFFB; RCC_APB2ENR=regval|PORT_A_CLK_ENA; /*enable AFIO clock */ regval =RCC_APB2ENR&0x0000FFFE; RCC_APB2ENR=regval|AFIO_CLK_ENA; /*set portA.0 as GPIO to drive LED */ PORT_A_CRL =0x01; //set port_a.0 as out put /*set portA.8 as Clock out */ PORT_A_CRH =0x03 //set port_a.8 as out put,and set max speed at 50Mhz |(0x02 |
RE:请教EXTI的设置
void RTC_It(void)
{
NVIC_InitTypeDef NVIC_InitStructure;
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_1);
NVIC_InitStructure.NVIC_IRQChannel = RTC_IRQChannel;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority =6;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
}
可以根据你的需求将RTC_IRQChannel换成自己所需要开通的通道。