学前班
最后登录1970-1-1
在线时间 小时
注册时间2016-7-26
|
用的是mini v3 的板子
做外部中断实验,请问,这是怎么设置PA0端口作为外部中断输入的,如果要设置PC13为外部中断输入,应该怎么修改,谢谢,下面是光盘里的源程序代码。
void EXTI_Pxy_Config(void)
{
GPIO_InitTypeDef GPIO_InitStructure;
EXTI_InitTypeDef EXTI_InitStructure;
/* config the extiline clock and AFIO clock */
RCC_APB2PeriphClockCmd(macEXTI_GPIO_CLK,ENABLE);
/* config the NVIC */
NVIC_Configuration();
/* EXTI line gpio config*/
GPIO_InitStructure.GPIO_Pin = macEXTI_GPIO_PIN;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IPD; // ÏÂà-êäèë
GPIO_Init(macEXTI_GPIO_PORT, &GPIO_InitStructure);
/* EXTI line mode config */
GPIO_EXTILineConfig(macEXTI_SOURCE_PORT, macEXTI_SOURCE_PIN);
EXTI_InitStructure.EXTI_Line = macEXTI_LINE;
EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt;
EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Rising; //éÏéyÑØÖD¶Ï
EXTI_InitStructure.EXTI_LineCmd = ENABLE;
EXTI_Init(&EXTI_InitStructure);
}
int main(void)
{
/* config the led */
LED_GPIO_Config();
LED1_ON;
CLI();
SEI();
/* exti line config */
EXTI_Pxy_Config();
/* wait interrupt */
while(1)
{
}
}
|
|