#MPLAB XC8 MAKE ERROR 1 SOFTWARE#
I have made use of comments to describe what the program is doing, and also to break up sections of the software to make it easier to read. Remember to place the file name within the symbols. The xc.h file automatically includes the MCU specific header file so that all of the definitions and addresses of the special function registers are there. As stated before, the header files contain a bunch of stuff that the compiler needs in order to generate code.
Following the comments, we need to include the xc header file. It is good practice to place a description of the program at the top of each program we write. In reference to figure 5, please view my post which corrects an error made here.Īs we can see at the very top of the program, I have made use of the ability to place comments in the code. Let's have a look at the program now, then we'll walk through it. A schematic and breadboard image of this project is at the bottom of this post so you can build it and follow along. We'll select GP0 (pin 7) as the output for our LED. Let's use GP3 (pin 4) for our button input. Reading through the datasheet, we discover that the GP3 pin is an input only port, which means that we cannot use it to output data. There are additional functions which reside on these pins, such as analog to digital converters and comparator modules, but we're only interested in the I/O function right now. As a brief rundown though, VDD is +5V, VSS is ground, and pins 2 through 7 are the General Purpose I/O pins. The PIC12F629 datasheet contains the pin diagram for the MCU as seen in figure 4.Įach pin of the MCU and the associated functions available on those pins are described in the datasheet's pinout description section. Planning the hardware in advance is necessary for programming. The first thing we're going to want to do is plan out what I/O pins we want to use for the button and the LED.
#MPLAB XC8 MAKE ERROR 1 HOW TO#
The main purpose is to show how to read an input, and how to place data on an output. The LED will remain lit for as long as we're pressing the button, and will extinguish when we release the button. It will teach you the basic input/output interface by illuminating a light emitting diode when we press a button. c file into the Source Files, as shown in Figure 3.2. c file within the projects window is placed somewhere other than in the "Source Files" drop-down, we should drag the. We should now have a new window within the IDE open as seen in figure 3.1.
#MPLAB XC8 MAKE ERROR 1 CODE#
c file extension is associated with c source code files. Let's name our source file the same as our project "learn_c" and set the file extension to ".c". Under categories, highlight "C" then under file types highlight "C Source File" and click next. This is a blank project (there are no files associated with it), so we need to add a file before we can start writing a program.Ĭlick the file menu and select "New File". We should now see our projects in the top-left portion of the IDE, as seen in figure 2. Let's name our project "learn_c", and click finish. XC8 only appears in this menu after you have installed the compiler, so if you don't see it, make sure that you installed the XC8 compiler software. The next screen asks us to choose a compiler and you should see the XC8 compiler listed there. I have the PICkit 2, which I have selected for my project. This is where we select which programmer we're going to use.
The next step will ask you to select a Supported Debug Header which we will leave selected to "None", then click next again. On the family drop down menu, select "Mid-Range 8-bit MCUs", and then "PIC12F629" under the device drop down menu. We'll now select our device (the MCU we're using). In the new project window you should see that under the categories column "microchip embedded" is selected and "standalone project" under the projects column is selected, click next.
Alternatively, you can click File>Create New Project. Under the Dive In section of the start page, click "Create New Project".
Upon opening MPLAB X IDE you will see the program's Start Page as shown in figure 1. In addition to the software, you will need the following hardware: Since this is our first project, there's quite a bit to cover here, so this lesson will be a little long in order to cover a lot of "basics". We will now use these to set up our first project, using an I/O pin on the PIC12F629 to turn on a light emitting diode. In the first blog post we downloaded and installed MPLAB X and the XC8 compiler.