Archive for January, 2011

Creating The First Project in MiKroC pro for PIC

we  will create a new  project,write code,compile it in the mikroC pro for PIC  compiler .

First, Start up the mikroC pro for pic compiler and select the new project option from project menu,as shown in figure on below.

When you will select new project option,then you will get a window ,as shown in figure on below.Click Next.Now Follow the given steps.

  • Select the device that you want to use
  • Select the  device clock
  • Specify where project will be saved
  • Select initial library manager state

After all,Click finish and  a new blank window to write a program in will appear.See figure below.

Now,type your program .when the  program is written,it is necessary to compile it into a program code(.hex),by selecting one of the build options from the build menu.

All the errors detected during compilation will be shown in the message window.If no errors are encountered,the compiler will generate output files in the project folder containing the project file.


Led blinking program with pic16f887 and mikroC PRO for PIC


The following program flashes 8 LEDs on  the PORTC pins of the pic16f887.

Source Code

void main() {
PORTC=0;  //initialize portc
TRISC=0b00000000;   //configure portc as output
ANSELH=0;    //configure an pin as digital I/O
PORTC=~PORTC;     //toggle portc
delay_ms(10000);   //1s delay


Circuit Diagram

Led blinking circuit