STM32 Study Notes--EXTI

Publisher:Bby1978Latest update time:2016-08-05 Source: eefocusKeywords:STM32  EXTI Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
1. PA0 ... PF0 share an interrupt flag EXT0

      PA1 ... PF1 share an interrupt flag EXT1
       . .
       . .
     PA15... PF15 share an interrupt flag EXT15
2. EXT5-9 share an interrupt source
      EXT10-15 share an interrupt source   
3. Before enabling interrupts, you need to ENABLE the multiplexing function of the IO port (AFIO)      
4. Set the interrupt IO port
5. Register the IO port to the interrupt line (map the IO port to the interrupt line N)
Example: GPIO_EXTILineConfig(GPIO_PortSourceGPIOD, GPIO_PinSource3); Register GPIOD.3 to                  

                                 Interrupt line EXTIline3
       GPIO_EXTILineConfig(GPIO_PortSourceGPIOD, GPIO_PinSource4); Register GPIOD.4 to

                                                                                                                                    Interrupt line EXTIline4
6. Configure interrupt
   EXTI_InitStructure.EXTI_Line = EXTI_Line3;
   EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt; Interrupt
                                                            = EXTI_Mode_Event event (trigger other modules)
   EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Rising Rising edge trigger
                                                              = EXTI_Trigger_Falling Falling edge trigger
                                                              = EXTI_Trigger_Rising_Falling Pulse trigger
7. Configure NVIC   
8. If you use the library function to write interrupts, you must open the corresponding interrupt in stm32f10x_conf.h
----------------------------------------------------------------------------------------------------    
Example:
RCC_APB2PeriphClockCmd( RCC_APB2Periph_GPIOD|RCC_APB2Periph_AFIO, ENABLE);
                                                                                                                             /* PD3,4,5,6 key input*/
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_3|GPIO_Pin_4|GPIO_Pin_5|GPIO_Pin_6;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IPU; //Pull-up input
GPIO_Init(GPIOD, &GPIO_InitStructure);

/* Connect the IO port to the interrupt line*/
GPIO_EXTILineConfig(GPIO_PortSourceGPIOD, GPIO_PinSource3);
GPIO_EXTILineConfig(GPIO_PortSourceGPIOD, GPIO_PinSource4);
GPIO_EXTILineConfig(GPIO_PortSourceGPIOD, GPIO_PinSource5);
GPIO_EXTILineConfig(GPIO_PortSourceGPIOD, GPIO_PinSource6);
/* Configure interrupt line 3 as falling edge Trigger*/ 
EXTI_InitStructure.EXTI_Line = EXTI_Line3;
EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt;
EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Rising_Falling;
EXTI_InitStructure.EXTI_LineCmd = ENABLE;
EXTI_Init(&EXTI_InitStructure);
/*Others are falling edge triggers*/
EXTI_InitStructure.EXTI_Line = EXTI_Line4|EXTI_Line5|EXTI_Line6;
EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt;
EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Falling;
EXTI_InitStructure.EXTI_LineCmd = ENABLE;
EXTI_Init(& EXTI_InitStructure);

Keywords:STM32  EXTI Reference address:STM32 Study Notes--EXTI

Previous article:EXTI external interrupt of stm32F407
Next article:STM32 RTC clock program

Recommended ReadingLatest update time:2024-11-16 14:50

[STM32] RTC real-time clock overview, registers, library functions (RTC general steps)
STM32F1xx official information: "STM32 Chinese Reference Manual V10" - Chapter 16 Real-time Clock (RTC) RTC Real Time Clock Introduction to RTC Real Time Clock The real-time clock is an independent timer. The RTC module has a set of counters that count continuously, and can provide clock calendar functions under t
[Microcontroller]
[STM32] RTC real-time clock overview, registers, library functions (RTC general steps)
STM32 system initialization after startup SystemInit()
The corresponding functions for resetting exceptions in the startup file are as follows: ; Reset trades   Reset_Handler   PROC                   EXPORT  Reset_Handler                               IMPORT  __main                   IMPORT  SystemInit                   LDR     R0, =SystemInit                   BLX    
[Microcontroller]
STM32 learning notes interrupt debugging
1. Basic GPIO configuration. Note that because the ordinary IO port is needed as the interrupt input port, the IO port multiplexing function is used. Therefore, the RCC_APB2Periph_AFIO clock must be turned on to disable the multiplexing IO. 2. IO port multiplexing function mapping 3. Nested interrupt vector configu
[Microcontroller]
STM32 learning notes interrupt debugging
STM32 BootLoader firmware upgrade
Regarding Bootloader, it is difficult to understand what this term is and what it is used for from the text description in the book. After using it this time, I have a better understanding of it. 1. Knowledge points 1. BootLoader is a small program that runs when the microcontroller starts up. This program is respon
[Microcontroller]
STM32 Learning 005_Port Multiplexing and Remapping
1. When using the alternate function (AF), the port bit configuration register must be programmed. 1) For multiplexed input functions, the configuration must be pull-up/pull-down or floating; 2) For alternate output functions, the configuration must be alternate function output mode (push-pull, open drain). For bidire
[Microcontroller]
Circuit design of ECG acquisition system using STM32
  Cardiovascular diseases have become one of the major diseases that threaten human health, and a clear and effective electrocardiogram provides a basis for diagnosing such diseases. The electrocardiogram acquisition circuit is the key part of the electrocardiogram acquisition instrument. The electrocardiogram signal i
[Microcontroller]
Circuit design of ECG acquisition system using STM32
A smart home system design based on S3C6410 and STM32
  With the development of science and technology and the improvement of people's living standards, people's requirements for home safety, comfort, convenience and other aspects are gradually increasing. Modern homes are developing towards highly intelligent and humanized smart homes. Smart home, also known as smart hou
[Microcontroller]
A smart home system design based on S3C6410 and STM32
Solar LED Street Light Solution Using STM32 MCU
As fossil energy is decreasing and the problem of global warming caused by excessive greenhouse gas emissions is becoming more and more important, people are actively developing various types of renewable energy on the one hand, and advocating green environmental protection technologies for energy conservation and
[Power Management]
Solar LED Street Light Solution Using STM32 MCU
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号