STM32F030 IO口外部中断应用

来源:本站
导读:目前正在解读《STM32F030 IO口外部中断应用》的相关信息,《STM32F030 IO口外部中断应用》是由用户自行发布的知识型内容!下面请观看由(电工技术网 - www.9ddd.net)用户发布《STM32F030 IO口外部中断应用》的详细说明。
简介:下面是一个STM32F030 IO口外部中断应用程序,感兴趣的朋友可以看看。

//==文件exit.h============================================================#ifndef __EXIT_H#define__EXIT_H#include "stm32f0xx.h"extern void EXIT_HALL_Init(void);#endif /* __EXIT_H *///==文件exit.c============================================================#include "global.h" #include "exit.h"//========霍尔 外部中断 初始化===========================void EXIT_HALL_Init(void){GPIO_InitTypeDef GPIO_InitStruct; //GPIO 定义  EXTI_InitTypeDef EXTI_InitStruct; //外部中断定义  NVIC_InitTypeDef NVIC_InitStruct; //嵌套中断定义    /* config the extiline(PB3 PB4 PB5) clock and AFIO clock */  RCC_APB2PeriphClockCmd(RCC_APB2Periph_SYSCFG, ENABLE);  RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOB, ENABLE);      /* Configyre P[A|B|C|D|E]3  NIVC  */NVIC_InitStruct.NVIC_IRQChannel = EXTI2_3_IRQn;NVIC_InitStruct.NVIC_IRQChannelPriority = 0x00;NVIC_InitStruct.NVIC_IRQChannelCmd = ENABLE;NVIC_Init(&NVIC_InitStruct);    /* Configyre P[A|B|C|D|E]4 5  NIVC  */NVIC_InitStruct.NVIC_IRQChannel = EXTI4_15_IRQn;NVIC_InitStruct.NVIC_IRQChannelPriority = 0x00;NVIC_InitStruct.NVIC_IRQChannelCmd = ENABLE;NVIC_Init(&NVIC_InitStruct);  /* EXTI line gpio config(PB3 PB4 PB5) */GPIO_InitStruct.GPIO_Pin = GPIO_Pin_3|GPIO_Pin_4|GPIO_Pin_5;   GPIO_InitStruct.GPIO_Mode = GPIO_Mode_IN;GPIO_InitStruct.GPIO_Speed = GPIO_Speed_Level_2;    GPIO_InitStruct.GPIO_PuPd = GPIO_PuPd_NOPULL;//GPIO_PuPd_UP; // 上拉输入GPIO_Init(GPIOB, &GPIO_InitStruct);/* EXTI line(PB3 PB4 PB5) mode config */EXTI_ClearITPendingBit(EXTI_Line3);EXTI_ClearITPendingBit(EXTI_Line4);EXTI_ClearITPendingBit(EXTI_Line5);SYSCFG_EXTILineConfig(EXTI_PortSourceGPIOB, EXTI_PinSource3);SYSCFG_EXTILineConfig(EXTI_PortSourceGPIOB, EXTI_PinSource4);SYSCFG_EXTILineConfig(EXTI_PortSourceGPIOB, EXTI_PinSource5);EXTI_InitStruct.EXTI_Line = EXTI_Line3|EXTI_Line4|EXTI_Line5;EXTI_InitStruct.EXTI_Mode = EXTI_Mode_Interrupt;EXTI_InitStruct.EXTI_Trigger = EXTI_Trigger_Rising_Falling ;//EXTI_Trigger_Falling;//上 下降沿中断EXTI_InitStruct.EXTI_LineCmd = ENABLE;EXTI_Init(&EXTI_InitStruct); }

提醒:《STM32F030 IO口外部中断应用》最后刷新时间 2024-03-14 00:58:07,本站为公益型个人网站,仅供个人学习和记录信息,不进行任何商业性质的盈利。如果内容、图片资源失效或内容涉及侵权,请反馈至,我们会及时处理。本站只保证内容的可读性,无法保证真实性,《STM32F030 IO口外部中断应用》该内容的真实性请自行鉴别。