STM32 MCU external interrupt configuration - memo

  External interrupt Profile

  The external interrupt is caused by an external interrupt signal, such as the level change (high, low) on the microcontroller pins, edge change (rising, falling) and the like. Microcontroller 51 has five interrupt sources, two of which are external interrupts INT0 and the INT1, respectively, are assigned INT0 pin P3.2, P3.2 are assigned the INT1 pin is to say if the microcontroller 51 using external interrupt 0, the signal must be connected to the P3.2, otherwise invalid.

  02

  What are examples of interruption

  SCM There are two ways in the implementation of the program:

  inquiry mode

  Interrupt

  The so-called single-chip query is scanned over and over again, to view the monitored target has not changed, is a proactive monitoring method, it can be objectively described by a phrase: sit back and wait.

  The so-called single-chip interrupt mode is not taking the initiative to monitor the target, but the target MCU proactive notification status has changed, is a passive surveillance method, you can also use an idiom to describe: uninvited guests.

  There is a school of walls broke a hole, in order to prevent students from middle of the night and ran out the Internet, before the wall repaired, schools and night security arrangements observe every day in the hole next to the monitor, which is sit back and wait. At midnight the security sleepy want to sleep but was afraid to deduct wages, how do? The security is very clever in the hole to pull a rope to the other end of the rope tied to his wrist, as long as people want to go out in order to wake up the rope will stumble security sleep, this is the uninvited guest. This will not affect the security sleep, but also middle of the night to catch students out of the Internet, but also to avoid security have been deducted, we can see significant savings by using the interrupt energy security. This is the benefit of using interrupts.

  03

  STM32 MCU external interrupt Profile

  Each GPIO STM32 microcontroller may be provided as an external interrupt input, it can be different according to the external interrupt pin into a number of different groups, respectively, as PA0-PG0 EXti0 group, and so on, PA15-PG15 group is EXTI15 a total of 16 groups, and each group in the same time, only one interrupt source to work, so, STM32 microcontroller allows up to 16 external interrupts. External interrupt distribution shown in the following table:

  External trigger STM32 microcontroller interrupt is edge-triggered, i.e., the rising and falling edge triggered.

  04

  STM32 external interrupt configuration steps

  When STM32 microcontroller external interrupt configuration may operate as follows:

  1. Initialize GPIO input;

  2. To turn on the clock, set mapping relationship;

  3. Set the trigger condition;

  4. Assign the interrupt vector controller, and can be;

  5. Write interrupt service function;

  05

  STM32 external interrupt related registers

  1. Initialization When GPIO register to use the following:

  APB2ENR: Open GPIO multiplexing clock and the clock;

  CRH: High port configuration register;

  CRL: Low port configuration register;

  EXTICR [0] -EXTICR [3]: External Interrupt Configuration Registers

  IMR: Interrupt Mask Register;

  EMR: event mask register;

  FTSR: falling edge trigger selection register;

  RTSR: rising edge trigger selection register

  ISER [0] -ISER [3]: NVIC vector interrupt controller;

 

 

(STM32 interrupt system)
http://www.makeru.com.cn/live/1392_1124.html?s=45051

The SPI communication stm32
http://www.makeru.com.cn/live/3523_1795.html?s=45051

(Stm32 serial application)
http://www.makeru.com.cn/live/1392_1164.html?s=45051

(STM32 DC motor with speed)
http://www.makeru.com.cn/live/1392_1218.html?s=45051

Guess you like

Origin www.cnblogs.com/QianD/p/11303192.html