EXTI 外部中斷


GPIO as Interrupt

The external interrupt/event controller consists of up to 23 edge detectors for generating event/interrupt requests.

Each input line can be independently configured to select the type (interrupt or event) and the corresponding trigger event (rising or falling or both). Each line can also masked independently. A pending register maintains the status line of the interrupt requests.

GPIO Interrupt

In section one (GPIOs) we have 16 interrupt lines. They are line0 to line15 and they also represent pin number. This means, PA0 is connected to Line0 and PA13 is connected to Line13.

image

All pins with same number are connected to line with same number. They are multiplexed to one line.

  • PA0 and PB0 and PC0 and so on, are connected to Line0, so you can use only one pin at one time to handle interrupt from there.
  • PA0 and PA5 are connected to different lines, they can be used at the same time.
  • Each line can trigger an interrupt on rising, falling or rising_falling enge on signal.

Interrupt handlers

image

This table show you which IRQ you have to set for NVIC (first column) and function names to handle your interrupts (second column). You have probably also figured, that only lines 0 to 4 have own IRQ handler. Yes, lines 5-9 have the same interrupt handler and this is also for lines 10 to 15.

Example

example說明 使用user button製造外部終斷,使led開燈關燈,此程式沒有做Button Debouncing

留言

這個網誌中的熱門文章

freeRTOS Deleting a Task

05 Software Timer Management

Interrupt Management