Most of the time, embedded systems have time sensitive inputs that need to be handled as soon as they are triggered, with minimal delay. This is usually done by using interrupts. Interrupts are pieces of code that are run when an event occurs on one of the microcontroller’s ports, or internal components such as a timer. The execution of the main program is paused, and the microcontroller jumps to the interrupt code (in reality, it jumps to a given address in the program memory, reserved to the interrupt instructions). Once it finishes executing the interrupt code, it will go back to where it stopped in the main program. In this tutorial we’re going to learn how to implement an interrupt when a user pushes on a button.
As we’ve seen in the previous tutorial, it’s pretty easy to display a single digit number on a seven segment display. If you want to display two digits though, you’ll quickly see it’s a bit more complicated. Today we’ll learn how to multiplex two 7-segment displays in order to display a 2-digit number.
One of the key elements in embedded systems is the user interface. A good user interface will feature visual elements to communicate with the user, such as LEDs or a screen for example. Seven segment displays are widely used in electronic devices, as they can display information in an easy way. We find 7 segment displays everywhere in our homes: our alarm clocks, microwave ovens or even the screens of some devices. Let’s see how to use this component in an embedded system! We’ll start simple, with a single 7 segment display.