STM32--EXIT例子
来源:互联网 发布:云计算的资源类型 编辑:程序博客网 时间:2024/06/14 18:18
通用I/O端连接到16个外部中断/事件线上,所有IO都可以作为中断输入引脚。
(注意:同一个IO位只能分配一个IO,例如:PA0,PB0,...PG0只能选择一个作为EXIT0,即不能同时作为中断输入引脚)
EXTI9_5_IRQn表示----External Line[9:5] Interrupts
GPB.9配置外外部中断IO口
void NVIC_Configuration(void)
{
NVIC_InitTypeDef NVIC_InitStructure;
#ifdef VECT_TAB_RAM
/* Set the Vector Table base location at 0x20000000 */
NVIC_SetVectorTable(NVIC_VectTab_RAM, 0x0);
#else /* VECT_TAB_FLASH */
/* Set the Vector Table base location at 0x08000000 */
NVIC_SetVectorTable(NVIC_VectTab_FLASH, 0x0);
#endif
/* Configure one bit for preemption priority */
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_1);
/* Enable the EXTI9_5 Interrupt */
NVIC_InitStructure.NVIC_IRQChannel = EXTI9_5_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0;
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
}
void GPIO_Configuration(void)
{
GPIO_InitTypeDef GPIO_InitStructure;
/* Enable GPIO clock */
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB | RCC_APB2Periph_AFIO, ENABLE);
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_9;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN_FLOATING;
GPIO_Init(GPIOB, &GPIO_InitStructure);
}
/* Connect Key Button EXTI Line to Key Button GPIO Pin */
GPIO_EXTILineConfig(GPIO_PortSourceGPIOB, GPIO_PinSource9);
/* Configure Key Button EXTI Line to generate an interrupt on falling edge */
EXTI_InitStructure.EXTI_Line = EXTI_Line9;
EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt;
EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Falling;
EXTI_InitStructure.EXTI_LineCmd = ENABLE;
EXTI_Init(&EXTI_InitStructure);
void EXTI9_5_IRQHandler(void)
{
if(EXTI_GetITStatus(EXTI_Line9) != RESET)
{
EXTI_ClearITPendingBit(EXTI_Line9);
}
}
- STM32--EXIT例子
- STM32之EXIT函数一览
- Stm32使用Usart代码例子
- STM32学习笔记:基础例子
- 关于STM32中can的例子
- exit
- exit
- exit
- Exit()
- exit
- exit
- exit()
- exit
- exit
- exit()
- exit
- Exit()
- exit
- select()
- excel转换txt文本(matlab版本)
- Linux 测试工具
- 今天终于注册csdn账号了
- matlab生成html调用flash示例
- STM32--EXIT例子
- 可排序的Properties
- 重新来过
- 传微软将停止Windows XP和Office 2003主流支持服务
- 数学运算解题方法之时钟问题——找准路程、时间和速度
- 虚函数、纯虚函数详解
- 换行符‘/n’和回车符‘/r’的区别
- 男生最帅的41个瞬间 你认同几个。。。。
- 人生若只如初见!