Getting Started With Pic18F Series Microcontroller
Getting Started With Pic18F Series Microcontroller
PIC18F SERIES
MICROCONTROLLER
The first thing we need to write A program for the
MICROCONTROLLER is a pc program which understands
the programming language we use, C in this case, and
provides a window for writing program. Besides, the
software must know the architecture of the
microcontroller in use. In this case, we need A compiler
for C language. We are using mikroC pro compiler,
which can be downloaded from MIKROELEKTRONIKA
website.
STEP 1: Download and Install MikroC Pro
Create a Folder for this project in any of your drives
Open microC Pro For PIC
STEP 2: Click on Project >> New Project
Also you can import the sample examples from the last option of the Project Menu
STEP 3: Click on next to create Standard project
STEP 4: In This step you have to do Project settings.
Enter your Project Name as per your choice.
And Save the Project to Your Directory wherever you want to Save it.
STEP 5: In This you have to select Your device Name which is on your Microcontroller IC
Select clock frequency for Your Microcontroller on which you want operate it.
Clock Frequency is the frequency of oscillator used with microcontroller.
Here we use PIC 18F4520 microcontroller with 8MHz crystal.
STEP 6: Here we can Add Source File If we have already which is the C file (.c extension files)
If not then just Click on the Next
STEP 7: For including all the Default Libraries select Include All.
Click Finish, to complete the New Project Wizard.
Then you will see the editor, where you can enter the MikroC Code.
STEP 8: Write your C code in void main which is our main function.
So here we just writing simple LED BLINKING code.
Save it, In your Project directory for your easy access.
STEP 9: Next To Compile the Project Click on the Build OR just press the CTRL+F9.
This will Automatically generate the HEX file which is in Machine understanding language.
And to Load the this Hex to your Connected Microcontroller Click on the Build+Program which
you will get in Build Option Menu.
STEP 10: Download and Install MikroC Pro
Create a Folder for this project in any of your drives
Open microC Pro For PIC