MIKROC NEW PROJECT SETUP

on Sunday, 13 October 2013
In this post we will look at the general setup for starting new project in 'MikroC for PIC' compiler. I'm currently using version v5.6.1 pro version. The latest version i.e v6.0 is available now, download it from http://www.mikroe.com/mikroc/pic/ . Do remember that as a demo version i.e free version we will have restriction of using only 2k program memory. If your program is more than 2k then in demo version your software will not compile your program, in this case you need to shift to full version by buying license. If you don't want to spend money for buying licensed software then google for cracked version ;-)

STEP1: Install software on to your PC.
STEP2: Double click on the 'MikroC icon' which will be in general on your desktop if not go to
'start'> All programs> Mikroelektronica> MikroC Pro For PIC (folder) > MikroC Pro For PIC (icon)
STEP3: After your software startups, it will look something like this shown below
mikroC tutorial






















It is not possible to explain each option from each panel, when we start doing projects soon we will understand each of them.
If you want to open your existing project then choose 'Open project' from left panel.
If you want to create a new project then choose 'New project' .
For now we are starting up with new project so i'm selecting 'New project' option from left panel.

STEP4: As soon as we click 'New Project' then a window will appear with the title "WELCOME TO THE NEW PROJECT WIZARD" , just click 'NEXT' to continue.

STEP5: Now a window will appear, look below
mikroC tutorial

  • Give any valid name of your project beside 'Project Name:
  • Select the location on the disk, in which folder your files should be saved(Do remember this location, because all your project files including .hex file will be saved in this location). 
  • As we are using PIC18f452 microcontroller, select it as 'Device Name' .
  • Select your Crystal oscillator frequency you are going to use in your project. I'm just selecting 10Mhz as an example. 
  • Now click on  'Next' . 


STEP6: Now you will see a window with the title " Select files you want to add to your project" .
If you want to use any other previous existing files in your project then click 'Add' option, for now we dont use any previous files. so just click 'Next'.
mikroC tutorial

STEP7: As we want to use library functions so select 'Include All(Default)' radio button and click on 'Next'.

mikroC tutorial

STEP8: Now a window with the title "You have successfully created a new project.Select 'Finish' to close the wizad" will appear.
So just click on 'Finish' to complete the process.

STEP9:  Now 'Program Editing Window' will appear. Whatever program we want to write we should write on this window.
Notice the below fig. in which
void main() {
}
appear by default
mikroC tutorial





















STEP10:

  • Write the program, for instance we write program for Led blinking. Save the program , to do this just go to FILE>SAVE. (or just use keyboard shortcut Ctrl+s). 
  • After we saved our program, it has to be compiled i.e we need to generate .hex file. For this go to 'Build' > 'Build' (or use keyboard shortcut Ctrl+F9). Notice the below fig. 

mikroC tutorial
























You will see the 'Messages' status of your program at the bottom of your 'Program Editing Window', if your program successfully compiled then you will see 'Finished Successful: date' at the end, if your program have any errors then it will be indicated in red color with the 'Line' number. Use that line number to know on which line your compiler shown error.

STEP11: After your program have been successfully compiled, all the necessary files(including .hex) related to your project will be generated in the predefined location( refer step5).
As our project name is " Name_of_the_project" to find its hex just see the name of the file with the extension .hex (i.e Name_of_the_project.hex) . We use this .hex file for burning/programming/loading our microcontroller as we have seen in our previous post  " How to program microcontroller using pickit2/3" 

All these steps are common for every project we do.
AUTHOR: YOUSTRON SIC

2 comments:

Anonymous said...

awesome effort...............
quite helpful
and learnt alot

Unknown said...

Morning! Pls when I was starting new project there was a window that always pumps up with #line 1 "stdin" on black screen. Pls help

Post a Comment