Writing Your First Program with PIC Microcontroller and Setting up Configuration Bits
This is the second tutorial of our PIC Tutorial Series. In our previous tutorial Getting started with PIC Microcontroller: Introduction to PIC and MPLABX, we learnt the basic stuff about our PIC microcontroller, we also installed the required software and purchased a new PicKit 3 programmer which we will be soon using. Now we are ready to get started with our First LED blinking Program using the PIC16F877A. We will also learn about Configuration Registers in this tutorial.
This tutorial expects that you have installed the required software on your Computer and you know some decent basics about the PIC MCU. If not, please bounce back to the previous tutorial and get started from there.
Getting Ready for Programming:
Since we have decided to use the PIC16F877A, with the XC8 compiler let us get started with their datasheet. I recommend everyone to download the PIC16F877A Datasheet and the XC8 Compiler manual, as we will be referring to these frequently as we progress through our tutorial. It is always a good practise to read the complete Datasheet of any MCU before we actually start programming with it.
Now, before we open our MPLAB-X and start programming, there are few basic things that one has to be aware of. Anyway, since this is our first program, I don’t want to harangue you people with lot of theory but we will stop here & there as we program and I will explain you things as such. If you don’t have enough time to read through all these then just have a glimpse and jump into the video at the bottom of the page.
Creating a New Project using MPLAB-X:
Step 1: Launch the MPLAB-X IDE that we installed in the previous class, once loaded it should look something like this.