野火电子论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 18887|回复: 2

多个中断怎么配置

[复制链接]
发表于 2014-10-3 12:12:02 | 显示全部楼层 |阅读模式
两个中断这里怎么配置
  /* ÅäÖÃÖжÏÔ´ */
  NVIC_InitStructure.NVIC_IRQChannel = EXTI0_IRQn;
/* ÅäÖ&Atilde[A|B|C|D|E]13ΪÖжÏÔ´ */
  NVIC_InitStructure.NVIC_IRQChannel = EXTI15_10_IRQn;
回复

使用道具 举报

发表于 2014-10-3 15:02:41 | 显示全部楼层
static void NVIC_Configuration(void)
{
  NVIC_InitTypeDef NVIC_InitStructure;
  
  /* Configure one bit for preemption priority */
  NVIC_PriorityGroupConfig(NVIC_PriorityGroup_1);
  
  /* ÅäÖ&#195[A|B|C|D|E]13ÎaÖD¶ÏÔ′ */
        NVIC_InitStructure.NVIC_IRQChannel = EXTI15_10_IRQn;
        NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;
        NVIC_InitStructure.NVIC_IRQChannelSubPriority = 1;
        NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
        NVIC_Init(&NVIC_InitStructure);
       
       
       
        NVIC_InitStructure.NVIC_IRQChannel = EXTI0_IRQn;
        NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;
        NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
        NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
       
       
        NVIC_Init(&NVIC_InitStructure);
       
}

/**
  * @brief  ÅäÖà PC13 ÎaÏßÖD¶Ï¿ú£¬2¢éèÖÃÖD¶ÏóÅÏ輶
  * @param  ÎT
  * @retval ÎT
  */
void EXTI_PC13_Config(void)
{
        GPIO_InitTypeDef GPIO_InitStructure;
        EXTI_InitTypeDef EXTI_InitStructure;

        /* config the extiline(PC13) clock and AFIO clock */
        RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOC | RCC_APB2Periph_GPIOA |RCC_APB2Periph_AFIO,ENABLE);
                                                                                               
        /* config the NVIC(PC13) */
        NVIC_Configuration();

        /* EXTI line gpio config(PC13) */       
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_13;      
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IPU;         // éÏà-êäèë
GPIO_Init(GPIOC, &GPIO_InitStructure);
       


        /* EXTI line(PC13) mode config */
        GPIO_EXTILineConfig(GPIO_PortSourceGPIOC, GPIO_PinSource13);
        EXTI_InitStructure.EXTI_Line = EXTI_Line13;
        EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt;
        EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Falling; //ϽμÑØÖD¶Ï
        EXTI_InitStructure.EXTI_LineCmd = ENABLE;
       
        EXTI_Init(&EXTI_InitStructure);
       
        /* EXTI line gpio config(PA0) */       
        GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0;      
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IPU;         // éÏà-êäèë
GPIO_Init(GPIOA, &GPIO_InitStructure);

/* EXTI line(PA0) mode config */
        GPIO_EXTILineConfig(GPIO_PortSourceGPIOA, GPIO_PinSource0);
        EXTI_InitStructure.EXTI_Line = EXTI_Line0;
        EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt;
        EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Falling; //ϽμÑØÖD¶Ï
        EXTI_InitStructure.EXTI_LineCmd = ENABLE;
       
       
        EXTI_Init(&EXTI_InitStructure);
回复 支持 反对

使用道具 举报

 楼主| 发表于 2014-10-3 16:31:32 | 显示全部楼层
强烈支持,非常感谢哥们
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

联系站长|手机版|野火电子官网|野火淘宝店铺|野火电子论坛 ( 粤ICP备14069197号 ) 大学生ARM嵌入式2群

GMT+8, 2024-11-22 22:19 , Processed in 0.050888 second(s), 24 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表