Microcontroller is a type of integrated circuits designed to govern a specific operation in an embedded system. A typical microcontroller includes a processor, memory and input/output (I/O) peripherals on a single chip. Microcontroller sometimes referred to as Microcontrollers unit (MCU) can be found in almost every modern systems ranging from vehicles, robots, vending machines and home appliances, etc. A microcontroller is embedded inside these systems to control their operations. It does this by interpreting data it receives through its I/O peripherals using its central processor. The temporary information that the microcontroller receives is stored in its memory, where the processor accesses and uses the instructions to determine how to operate control the system.
There are thousands of Microcontroller families in existence but for this tutorial, we are going to stick to the PIC family of microcontrollers. PIC microcontroller is very convenient choice to get started with a microcontroller projects, because it has excellent support forums and will act as a strong base to build upon all your advanced Microcontrollers that you are yet to learn.
PIC Microcontroller Architecture and Family
The PIC microcontroller was introduced by Microchip Technologies in the year 1993. Microcontrollers are built based on a particular architecture. And the PIC microcontrollers are built based on the famous Harvard Microcontroller architecture.
PIC Microcontrollers are divided into 4 large families. And each family has a variety of components and features that set them apart from other groups.
- First family – PIC10 (10FXXX) – is called Low End.
- Second family – PIC12 (PIC12FXXX) – is called Mid-Range.
- Third family – PIC16 (16FXXX).
- Fourth family – PIC 17/18(18FXXX).
For this tutorial, we will use the PIC16F64 which is from the third family. There is no special reason for choosing this particular IC. As we progress in this series, there may be need to choose another IC from the same family or even one from a different family of the PIC microcontrollers. It is a rule of thumb that as soon as you choose a microcontroller for a project, that you read the MCs datasheet to understand how it works and what it can do. So we can head to the MicroChip website to download the PIC16F84 datasheet.
Some of the features of the PIC16F84 MCU include:
- An 8-bit timer which can be used to create timing functions in our program.
- 13 I/O pins with individual direction control – which will help us feed in
- 10,000 erase/write cycles Enhanced FLASH Program memory typical, meaning you can program it for about 10,000 times.
- In-Circuit Serial Programming™ (ICSP™), helps us to program the IC directly in our circuit using programmers like PICKIT3.
- Watchdog Timer (WDT), which is a self reliable timer that resets the whole program if required.
As we will see later, there are some other PIC microcontrollers that are more feature rich and powerful than the PIC16F84 that we have chosen here. But never mind, as we progress to more bigger and better projects, there will be reason to choose another one.
PIC16F84 MCU PIN Specifications
In other to program the PIC Microcontrollers, you need to know some sort of programming language. You can use machine language, if you can write that. Some people use Assembly Language. But for this tutorial, we are going to use Embedded C Language which I feel is easier (from my own point of view). Embedded C is just a version of the C programming language for embedded systems.
Now, apart from the programming language based on which we will be writing our instructions, we also need some software’s and hardware’s to actually push the program we wrote into the PIC microcontroller. We will need an integrated development environment (IDE) – which is the interface where we will be writing the program codes. A compiler that will convert our program code to a format that the PIC microcontroller will understand, that is hex code. An Integrated Programming Environment (IPE), which is used to push the hex file into the PIC microcontroller’s memory. And of cource you need a PIC microcontroller itself, the PIC16F84 MCU.
In addition to this software’s, we also need a hardware device, (PIC programmer) which will be connected between the computer and the PIC microcontroller to actually send the program code in.
So, here are the software’s and hardware’s needed for this tutorial:
- Integrated development environment (IDE) – MPLABX
- Embedded C Compiler – XC8
- Integrated Programming Environment (IPE) – MPLAP IPE (the MPLAP X comes with the MPLAB IPE)
- PIC programmer (hardware) PICKit3
All the software’s in the list are free from Microchip, the makers of the PIC Microcontrollers. The PICKit3 can be purchased from our store or any other stores around you.
If you may want to simulate your programs to ensure that they are working before pushing it into the PIC, you may get simulator software like the Proteus or PICSimLab.
Thanks for reading this far. See you in the next episode where we will start practicals.