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:

Advertisements

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:

mikroC

Note: the theme may not open this but the default one. You can configure the theme later on from Tools>>Options>>Editor Colors

mikroC

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

mikroC

Alternatively, you can do this from Files>>New>>New Projects

mikroC

Afterward, it will ask for the name, directory, MCU, clock, etc

mikroC

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.

mikroC
Folder creation: under folders or subfolders.

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.

mikroC
mikroC

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.

mikroC

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.

mikroC

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

mikroC

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.

mikroC

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:

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:

Loading


MKDas

Mithun K. Das; B. Sc. in EEE from KUET; Head of R&D @ M's Lab Engineering Solution. "This is my personal blog. I post articles on different subjects related to electronics in the easiest way so that everything becomes easy for all, especially for beginners. If you have any questions, feel free to ask through the contact us page." Thanks.

1 Comment

Enrique · 24/07/2023 at 5:30 pm

Muchas gracias, excelente trabajo,

Leave a Reply

Avatar placeholder

Your email address will not be published. Required fields are marked *