PIC microcontrollers are one the popular and basic microcontrollers. Based on importance and usability, I started this series of tutorials on ‘Learning PIC Microcontrollers Programming in C’. This series will cover from A-Z to learning both PIC microcontrollers and programming easily. In this chapter, you are going to learn about the compiler mikroC Pro for PIC and how to create a new project in mikroC. So let’s start!
Disclaimer:
Handling electricity carries inherent risks. It’s essential to have the appropriate skills to manage it safely. Proceed at your own risk, as the author disclaims responsibility for any misuse, harm, or errors. All content on this website is unique and copyrighted; please avoid unauthorized copying. While most articles are open-source for your benefit, feel free to use the knowledge provided. If you find our resources helpful, consider purchasing available materials to support our work.
For assistance or guidance, leave a comment below; the author is committed to helping. Some articles may contain affiliate links that support the author with a commission at no additional cost to you. Thank you for your understanding and support.
Table of Contents
Last chapter in short:
In the previous chapter, we have seen what software we need to install. How to download it and also some details about that. If you miss the last chapter, you can read it here, Chapter 2.
Compiler window:
After installing the mikroC pro for PIC open the software. You will find a window like my one:
Note: the theme may not open this but the default one. You can configure the theme later on from Tools>>Options>>Editor Colors
This is optional for you, it depends on your choice of which theme you want to keep. But let’s go ahead with the important parts.
Creating a project in mikroC:
To create a new project in mikroC, click on the start page >> New Projects
Alternatively, you can do this from Files>>New>>New Projects
Afterward, it will ask for the name, directory, MCU, clock, etc
You can give any name without space, special characters, symbols, etc but like I’ve given in this image. Also, select a directory and create folders for individual projects. Then select the device. Here, I’m selecting PIC16F73 (P16F73). Then the crystal oscillator value you want to use in the project.
Now go to the next step clicking ok.
If your project configuration settings option is marked, it will redirect you to that page where you can edit the project configuration register.
Here, you can set the type of Oscillator. Usually, we use an HS oscillator. But if you use an RC oscillator, you can select that from here. Then if you want to use Watchdog Timer you can edit that. The FLASH Program Memory Code Protection is the protection to prevent copying the uploaded hex file from the MCU. If this selection is enabled, no one can read the MCU files.
Main code window:
Click ok and it will redirect you to the main code window where you can write the code.
On the top portion, you will not find any comments or signatures written. You need to do that yourself. And the meantime it may ask to save the project, simply do it.
On the top portion, you’ll get a button to build the project which will compile your code and generate a *.hex file that you can use for the microcontroller.
Note: in default or just after installation, you may not find all the buttons on the status bar. You can view that from View>>Tool Bars
You can select as I did here. Also some drag and drop works in the toolbar section. You can arrange it as you like.
Writing the code in MikroC:
Now, our compiler is ready to write the code and do something.
It’s a good practice to keep comments using ” //comments… ” beside code lines. And also should comment on each function end, this will help you find anything easily.
In the next chapter:
Now we are ready to write our codes. And this chapter ends here, we will continue writing our first code in the next chapter. If you miss the previous chapters, you can read those from the below list.
Read more on:
- Learning PIC Microcontrollers Programming in C: Chapter 1
- Learning PIC Microcontrollers Programming in C: Chapter 2
- Learning PIC Microcontrollers Programming in C: Chapter 4
Also, if you are capable of buying the license, I suggest getting either a dongle license or a code license. Because using any illegal activators is not good. Also, this compiler gives you the option to practice small projects. But if you are ready to earn money, better to get a valid license.
I’ve been using a dongle license since 2012.
For Professional Designs or Help:
1 Comment
Enrique · 24/07/2023 at 5:30 pm
Muchas gracias, excelente trabajo,