Interrupt handler

How to handle interrupts on a PIC microcontroller

08-26-2017 Alexandre 0

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.

How to control a 74HC595 shift register with a PIC microcontroller

08-18-2017 Alexandre 0

The number of pins is often limited on microcontrollers, and when we have a significant number of outputs to control, we can quickly run out of pins. An easy solution to fix this problem is to use a shift register. In this tutorial we’re going to learn how to use a 74HC595 shift register, to output 8 bits of data with only 3 bits from the PIC.

uart_communication

How to use UART with a PIC microcontroller

08-06-2017 Alexandre 0

As we’ve seen in the tutorial about creating a distance sensor for your garage, it’s important to have a convenient method to debug the systems we’re developing. This allows us to quickly access the values of variables, and lets us know the state of our program. In the distance sensor tutorial we used a LCD display, which is very user-friendly, but not the most efficient as it uses many pins of the PIC, and a lot of space on the board. In this tutorial, we’ll learn how to use one of the easiest and most lightweight embedded communication interface, the UART interface.

Result on the LCD display

How to control a HD44780 LCD display from a PIC16F microcontroller

10-13-2016 Alexandre 0

In this tutorial we’ll learn how to control a LCD display from a PIC microcontroller. LCD displays are one of the most used devices to display information. It allows an electronic system to show text and is easily programmable using a microcontroller. We’ll use a PIC16F88 from Microchip. This tutorial can be used to control any LCD display based on a HD44780 controller. Let’s create a little library to control a LCD display!

7 segment display

Interfacing a 7 segment display with a PIC16F microcontroller

09-21-2016 Alexandre 0

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.

PIC microcontrollers

Starting PIC microcontroller programming – Part 1/2 (Setting up the tools)

08-29-2016 Alexandre 0

In this series of tutorials we’re going to learn how to create our first embedded program for PIC microcontrollers. They are built by Microchip, and massively used in the industry. There are several other big actors in the world of microcontroller, such as Atmel with their AVR products (although they’ve recently been bought by Microchip), NXP, Freescale and much more. I decided to present Microchip’s microcontrollers because they are one of the most used brand of microcontrollers, and because the tools are easy to set up. They’re also relatively cheap and available on Windows, Mac and Linux, making it accessible to most people.