Lesson 3: Part 2: Interrupt - More about it

Interrupt is important as it enable software to transfer works to hardware and get notified when the hardware has completed its works. A good example is our previous interrupt tutorial. By passing the input checking to hardware, software no longer require to constantly poll the pin state and check if there is state change.

However, interrupt does make the system more complex in the sense that now any code in the main() function can be interrupted and interrupt service routine(ISR) get executed. Refer below for more explanation of interrupt to avoid buggy software.
  1. Embedded.com

Lesson 3: Part 2: Interrupt - External Input


In this lesson we will be showing way to connect STM32 board with external push button. Do take note we are using the source code in previous lesson. The easier way of doing this is following using the same circuit in STM32 board as below:

On Board Push Button Circuit
 By implementing Push button, R28/R29, the actual image will be as below.
*At the time of writing I was unable to find a push button to use, thus I had replace the button with a white wire.
Blue: PA0, Red:3.3V, Green: Ground
White: Button
White Wire is Not Connect/Button is Release
LED is Off

White Wire is Connect/Button is Press
LED is On

To properly design a input push button detection, a debounce circuit or software has to be implement. I found a useful article discussing on push button(including debounce)  here. Do take note it is on MSP430 from TI, just understand the theory section, skip the MSP430 SFR settings.