So you are interested in learning about tiny, yet fascinating devices? Most MCUs (micro controller unit) share many commonalities, despite their inherent complexity. Before you flash (or program) a PIC microcontroller, you will need knowledge about computer science and electricity. Continue reading to know the requirements for PIC microcontrollers.
Don't forget to check out other posts about PIC on the blog
Table of Contents
Knowledge requirements for PIC microcontrollers
Here are a few concepts that you will need to understand before programming you first PIC microcontroller:
- Ohm's Law.
- Joule's Law.
- Basic Electric Components (Resistors, Inductors, Capacitors, Switches and Relays are the most important).
- Semiconductors (Diodes, Transistors, LEDs, etc).
- Computer Architecture (RAM, ROM, Input and Output, etc).
- A good command of a programming language (‘C‘ would be better).
You should click on the links above to have a general idea of the concept. But, to get a practical knowledge and understanding, I have two recommendations for you.
Books Recommendation
A few years ago, I wanted to start in the broad world of electronics. If you are a completely newbie, like I was, these 2 books will certainly help you to pave the way. They make the process fun and gives you the joy of discovery.
The Hardware
The physical tool that will flash (or program) is one of the requirements for PIC microcontrollers. It will take the firmware from your computer to the device.
For a newbie, I recommend starting with the PICkit (3 or 4 would be fine).
PICkit
The official tool for flashing any PIC microcontroller, therefore it is flawless (most of the time). The PICkit can program the microcontroller while plugged to the PCB, therefore, it doesn't need to be unplugged. This technique is called In Circuit Serial Programmer or ICSP Programming.
You just need to connect the following pins with the corresponding pins of the microcontroller:
- MCLR (Master Clear).
- VDD (Positive Voltage).
- VSS (Ground).
- PGD (data wire).
- PGC (clock wire).
I learned to program microcontrollers using the PICkit 3 and also to use some tools for debugging purposes, which I will talk about in another blog post. Nowadays, the PICkit 4 is available and it is worth the new investment. The choice is yours. You can buy the PICkit 4 in this website.
Programmer with ZIF socket
It is possible to use a microcontroller to program another microcontroller. Sounds crazy, right? The ISPs have USB connector to connect to your computer and a socket where you place the microcontroller to be programed.
The downside of this method is that you need to take the microcontroller out from the PCB in order to program it, which is inconvenient:
- takes time.
- the connectors may deteriorate.
- not possible to use the real time debugging tool.
But there are advantages like it's price and the errors in the programming are absent, especially if your circuit is using pins PGD and PGC.
I have never used them but my former university classmates seemed to love them. You should try them at least once.
ICD
Everything the ICSP includes, plus it incorporates tool to monitor the program running in the PIC microcontroller. It is a powerful tool for Real-Time Emulation. Take the time to read more details in the products page or in the Developers Help page.
I haven't had yet the privilege to use one of them. But for starting of, the PICkit ICSP will suffice.
The Software
Some of the requirements for PIC microcontrollers is the software where you write the code, it helps you with tools for debugging and uses the programmer (such as the PICkit). I have tested all the resources below and they work fine.
IDE
Now you have to choose the IDE (Integrated Development Environment) which is an application where you write the code. IDEs are quite helpful because they provide tools and indicators that will ease to “programming process”. After debugging or checking out for mistakes, IDEs will generate the files (called ‘compile') for programming the PIC microcontroller. Some of them are capable of programming the PIC themselves.
I list here 2 programs which I have used in the past. For a newbie, I recommend starting with MPLAB X IDE.
MPLAB X
Perhaps the most popular IDE for PIC microcontrollers since its developed by the same company which makes the microcontrollers. It is completely free to download and it's supported on Windows, macOS and Linux.
The user interface is very friendly. If you tried once the NetBeans IDE, you will see that both share the same interface. You can check in MPLAB official page how to install the program properly.
mikroC
An IDE with tons of libraries preinstalled with great support too. I learned to program microcontrollers using this tool and I recommend it also for beginners.
The IDE costs some money but you can try it out for free.
IPE
This is the software that takes the compiled program and writes into the microcontroller.
MPLAB IPE
Integrated Programing Environment comes as an install option when you download the IDE. That means, its completely free and it also runs in Windows, macOS and Linux. It supports all of its PICkits and MCUs (naturally).
If you are a developer, this software can be used within PCBAs Testing JIGs. Just run a script for automate MCUs firmware flashing.
PICkit 3 Standalone Programmer.
The interface is easy to get used and I used this software for a very long time, during my years in the university in fact. Not only does the job of programming the microcontroller with a HEX file, but it also has a couple of cool features.
Now it's legacy and only supports Windows. I recommend using the MPLAB IPE instead but I might get handy in certain situations, like when using with third party IDEs. You can check another legacy programs of Microchip in this website.
Coming Next
The next episode will explain further about the next steps for learning about PIC microcontrollers.
techZorro's Index of Content
Keep Reading!
- 008 – Variable Frequency Drives: how this controller can transform induction motors foreverAC induction motors can be transformed into a highly controllable machine with Variable Frequency Drives or VFD. Click here to listen.
- 006 – Regenerative Braking, an awesome Feature found in Electric MotorsThis episode is related to this hidden feature of electric motors called regenerative braking. Click here to listen.
- 005 – 7 types of Electric Motors that you should know aboutThere are several types of electric motors that differs in efficiency, power, cost, torque output, etc. Click here to listen.
- 004 – AC Voltages, Frequencies and Plugs around the WorldLet's talk about electricity! Specifically about how the standards around the world. Click here to listen.
- 002 – RISC vs CISC, how a few Differences are crucial to ComputingToday in the market is found two kinds of processor architectures: RISC and CISC. Both have some advantages. Click here to listen.
You have reached this far!
Thank you for reading the blog post. Your comments and suggestions are welcomed. At the bottom of this page, leave a message or just say hi! The whole team of techZorro will appreciate it. Don't forget to share it on social media as well.
techZorro’s Index of Content
Click on the following link to browse likewise content in the blog in techZorro. This index will help you see what you are looking for in a bird’s eye view.
techZorro's Newsletter!
If you enjoyed this blog post, please subscribe to techZorro’s newsletter so you don’t miss any future blog posts!
[…] you want to know what are the requirements for programming a microcontroller or a fresh guide to start, click in the link […]