Page 1 of 1

16F877A programming with mikroC problem

PostPosted: Sat Jun 11, 2011 9:39 am
by wilsonz91
Hi,

I'm new to PIC. I'm using 16F877A and using mikroC to program it. However, i face a problem when i 'build' the program. It says 'can't open include pic.h'. My code is something as follow:

#include<pic.h>

#define pb1 RB0

.......(so on so forth)

What should I do? please help, thank you.

Re: 16F877A programming with mikroC problem

PostPosted: Sat Jun 11, 2011 4:02 pm
by robosang
the #include <pic.h> is for HI-TECH Compiler. since you are using Mikro C, you should not need that line. Anyway 2 different compiler will have some different setting and library, so still a lot of modification needed. Good luck.

Re: 16F877A programming with mikroC problem

PostPosted: Sat Jun 11, 2011 9:45 pm
by Brian Griffin
wilsonz91 WROTE:Hi,

I'm new to PIC. I'm using 16F877A and using mikroC to program it. However, i face a problem when i 'build' the program. It says 'can't open include pic.h'. My code is something as follow:

#include<pic.h>

#define pb1 RB0

.......(so on so forth)

What should I do? please help, thank you.


The Pic.h is only in Hi-tech compilers.

Next time, try not to blindly paste the code inside the compiler. Please check the compiler and the code before you compile. I've seen similar threads about that already this week.

Re: 16F877A programming with mikroC problem

PostPosted: Sat Jun 11, 2011 10:26 pm
by wilsonz91
My friend gave me the code with #include<pic.h> and he told me to use mikroC so I just did as he told. Anyway,since that's for Hi-tech compiler, is there any '#include' needed for programming the pic using mikroC? i tried doing simple programming such as LED turning on and it worked.

Another question, for mikroC and Hi-tech C, is the initialization the same? eg.

TRISA0 = 0;

Is it applicable to both mikroC and Hi-tech C in initializing only port A0 as output port?

Re: 16F877A programming with mikroC problem

PostPosted: Sat Jun 11, 2011 10:47 pm
by Brian Griffin
wilsonz91 WROTE:My friend gave me the code with #include<pic.h> and he told me to use mikroC so I just did as he told. Anyway,since that's for Hi-tech compiler, is there any '#include' needed for programming the pic using mikroC? i tried doing simple programming such as LED turning on and it worked.

Another question, for mikroC and Hi-tech C, is the initialization the same? eg.

TRISA0 = 0;

Is it applicable to both mikroC and Hi-tech C in initializing only port A0 as output port?


If you need to compile it into MikroC, take out the "#include <pic.h>".

You then go to Project->Edit Project (or Control+Shift+E) and edit whatever configurations that suits you and the microcontroller.

Different compilers have different ways of describing the ports.

In MikroC, it's just simply TRISA = 0 if you want them all outputs.